fix(github-copilot): preserve encrypted reasoning ids with encrypted_content (#71448)

Preserve encrypted Copilot Responses reasoning item IDs during replay and harden the live Copilot replay probe.

Thanks @a410979729-sys.
This commit is contained in:
a410979729-sys
2026-04-25 15:57:47 +08:00
committed by GitHub
parent 10ed007fb4
commit 8fd15ed0e5
4 changed files with 89 additions and 17 deletions

View File

@@ -35,6 +35,28 @@ describe("github-copilot connection-bound response IDs", () => {
expect(input[4]?.id).toMatch(/^msg_[a-f0-9]{16}$/);
});
it("preserves reasoning IDs when encrypted_content is present", () => {
const originalId = Buffer.from(`reasoning-${"e".repeat(24)}`).toString("base64");
const input = [
{
id: originalId,
type: "reasoning",
encrypted_content: "opaque-encrypted-payload",
},
];
expect(rewriteCopilotConnectionBoundResponseIds(input)).toBe(false);
expect(input[0]?.id).toBe(originalId);
});
it("still rewrites reasoning IDs when encrypted_content is absent", () => {
const originalId = Buffer.from(`reasoning-${"n".repeat(24)}`).toString("base64");
const input = [{ id: originalId, type: "reasoning" }];
expect(rewriteCopilotConnectionBoundResponseIds(input)).toBe(true);
expect(input[0]?.id).toMatch(/^rs_[a-f0-9]{16}$/);
});
it("patches response payload input arrays only", () => {
const messageId = Buffer.from(`message-${"m".repeat(24)}`).toString("base64");
const payload = { input: [{ id: messageId, type: "message" }] };