QA: tighten Matrix media upload body bytes

This commit is contained in:
Gustavo Madeira Santana
2026-04-15 22:11:16 -04:00
parent 5a051e3460
commit 78d7af42f4
3 changed files with 5 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- QA/Matrix: split the private QA lab runtime into smaller tested modules, add Matrix media contract coverage for image understanding and generated-image delivery, and update the memory-dreaming QA sweep to assert the separate phase-report layout. (#67430) Thanks @gumadeiras.
- Gateway/tools: anchor trusted local `MEDIA:` tool-result passthrough on the exact raw name of this run's registered built-in tools, and reject client tool definitions whose names normalize-collide with a built-in or with another client tool in the same request (`400 invalid_request_error` on both JSON and SSE paths), so a client-supplied tool named like a built-in can no longer inherit its local-media trust. (#67303)
- Agents/replay recovery: classify the provider wording `401 input item ID does not belong to this connection` as replay-invalid, so users get the existing `/new` session reset guidance instead of a raw 401-style failure. (#66475) Thanks @dallylee.
- Gateway/webchat: enforce localRoots containment on webchat audio embedding path [AI-assisted]. (#67298) Thanks @pgondhi987.

View File

@@ -238,7 +238,9 @@ describe("matrix driver client", () => {
expect(requests[0]?.url).toBe(
"http://127.0.0.1:28008/_matrix/media/v3/upload?filename=red-top-blue-bottom.png",
);
expect(Buffer.isBuffer(requests[0]?.body)).toBe(true);
expect(requests[0]?.body instanceof Uint8Array || Buffer.isBuffer(requests[0]?.body)).toBe(
true,
);
expect(requests[1]?.url).toContain(
"/_matrix/client/v3/rooms/!room%3Amatrix-qa.test/send/m.room.message/",
);

View File

@@ -270,9 +270,7 @@ async function uploadMatrixQaContent(params: {
"content-type": params.contentType ?? "application/octet-stream",
...(params.accessToken ? { authorization: `Bearer ${params.accessToken}` } : {}),
},
body: new Blob([Uint8Array.from(params.buffer)], {
type: params.contentType ?? "application/octet-stream",
}),
body: new Uint8Array(params.buffer),
signal: AbortSignal.timeout(20_000),
});
const body = (await response.json().catch(() => ({}))) as {