diff --git a/extensions/qa-lab/src/parity-shared.test.ts b/extensions/qa-lab/src/parity-shared.test.ts index 0ffaafa72e46..6a39978dc5e4 100644 --- a/extensions/qa-lab/src/parity-shared.test.ts +++ b/extensions/qa-lab/src/parity-shared.test.ts @@ -13,6 +13,13 @@ describe("compareCapturedToolCallShape", () => { expect(compareCapturedToolCallShape([call, call, call], [call, call])).toBeUndefined(); }); + it("preserves execution count for non-image tools", () => { + const readCall = { tool: "read", argsHash: "same-args" }; + expect(compareCapturedToolCallShape([readCall, readCall], [readCall])).toBe( + "tool call count differs (2 vs 1)", + ); + }); + it("preserves canonical execution count", () => { expect(compareCapturedToolCallShape([call], [call, call])).toBe( "tool call count differs (1 vs 2)", diff --git a/extensions/qa-lab/src/parity-shared.ts b/extensions/qa-lab/src/parity-shared.ts index 0531ff87cd1b..ff6c181130a3 100644 --- a/extensions/qa-lab/src/parity-shared.ts +++ b/extensions/qa-lab/src/parity-shared.ts @@ -75,10 +75,12 @@ export function compareCapturedToolCallShape( rightIndex += 1; continue; } - const knownShape = right.some( - (candidate) => candidate.tool === leftCall.tool && candidate.argsHash === leftCall.argsHash, - ); - if (!knownShape) { + const duplicatedImageShape = + leftCall.tool === "image_generate" && + right.some( + (candidate) => candidate.tool === leftCall.tool && candidate.argsHash === leftCall.argsHash, + ); + if (!duplicatedImageShape) { return exactMatch; } }