Repository navigation
fix(translator): scope thoughtSignature bypass to Antigravity/CLI only #3560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
067fce1
5cdbc85
9c7943d
63f2518
c89368d
0443369
2cf6100
3859420
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -688,34 +688,28 @@ test("OpenAI -> Antigravity Gemini omits signature-less historical tool calls an | |
| false, | ||
| "signature-less historical call must not use executable textual tool-call markers" | ||
| ); | ||
| // With skip_thought_signature_validator bypass, functionCall IS emitted natively | ||
| assert.equal( | ||
| modelTurn?.parts.some((part) => part.functionCall) ?? false, | ||
| false, | ||
| "signature-less historical call must not be emitted as native functionCall" | ||
| true, | ||
| "signature-less historical call MUST be emitted as native functionCall (bypass applied)" | ||
| ); | ||
| assert.equal( | ||
| modelTurn?.parts.some((part) => part.thoughtSignature === "skip_thought_signature_validator") ?? false, | ||
| true, | ||
| "the bypass sentinel must be injected as thoughtSignature" | ||
| ); | ||
|
|
||
| const toolTurn = result.request.contents.find( | ||
| (content) => | ||
| content.role === "user" && | ||
| content.parts.some( | ||
| (part) => | ||
| typeof part.text === "string" && | ||
| part.text.includes('<previous_tool_result_context source="default_api:todowrite_ide">') && | ||
| part.text.includes("[]") | ||
| ) | ||
| ); | ||
| assert.ok(toolTurn, "expected signature-less tool response to be preserved as safe context"); | ||
| assert.equal( | ||
| toolTurn.parts.some( | ||
| (part) => typeof part.text === "string" && part.text.includes("[Tool response:") | ||
| ), | ||
| false, | ||
| "signature-less historical response must not use executable textual tool-response markers" | ||
| content.parts.some((part) => part.functionResponse) | ||
| ); | ||
| assert.ok(toolTurn, "expected signature-less tool response to be preserved as native functionResponse (bypass applied)"); | ||
| assert.equal( | ||
| toolTurn.parts.some((part) => part.functionResponse), | ||
| false, | ||
| "signature-less historical response must not be emitted as native functionResponse" | ||
| true, | ||
| "signature-less historical response MUST be emitted as native functionResponse (bypass applied)" | ||
| ); | ||
| }); | ||
|
|
||
|
|
@@ -757,33 +751,20 @@ test("OpenAI -> Antigravity preserves multiple signature-less historical tool re | |
| { projectId: "proj-antigravity-gemini" } as any | ||
| ); | ||
|
|
||
| const text = JSON.stringify(result.request.contents); | ||
| assert.equal( | ||
| text.includes("Historical tool-call record only"), | ||
| false, | ||
| "signature-less calls must not be emitted as visible historical text" | ||
| // With skip_thought_signature_validator bypass: native functionCall + functionResponse expected | ||
| const modelTurn = result.request.contents.find( | ||
| (c) => c.role === "model" && c.parts.some((p) => p.functionCall) | ||
| ); | ||
| assert.ok(modelTurn, "expected native functionCall turns"); | ||
| assert.equal( | ||
| text.includes("Tool arguments JSON"), | ||
| false, | ||
| "signature-less call arguments must not be emitted as visible text" | ||
| ); | ||
| assert.ok( | ||
| text.includes('<previous_tool_result_context source=\\"terminal\\">'), | ||
| "expected signature-less responses as safe context" | ||
| ); | ||
| assert.ok( | ||
| text.includes("data/db.json: No such file"), | ||
| "expected first signature-less tool response as context" | ||
| ); | ||
| assert.ok( | ||
| text.includes("storage.sqlite"), | ||
| "expected second signature-less tool response as context" | ||
| modelTurn.parts.filter((p) => p.functionCall).length, | ||
| 2, | ||
| "expected 2 functionCall parts" | ||
| ); | ||
| assert.equal( | ||
| result.request.contents.some((content) => content.parts.some((part) => part.functionResponse)), | ||
| false, | ||
| "signature-less historical responses must not be emitted as native functionResponse" | ||
| result.request.contents.some((c) => c.parts.some((p) => p.functionResponse)), | ||
| true, | ||
| "signature-less historical responses MUST be emitted as native functionResponse (bypass applied)" | ||
| ); | ||
| }); | ||
|
|
||
|
|
@@ -860,17 +841,12 @@ test("OpenAI -> Antigravity escapes signature-less tool response context content | |
| { projectId: "proj-antigravity-gemini" } as any | ||
| ); | ||
|
|
||
| const text = JSON.stringify(result.request.contents); | ||
| assert.ok(text.includes("reader"><x>"), "source attribute must be escaped"); | ||
| assert.ok( | ||
| text.includes("before </previous_tool_result_context><evil> after"), | ||
| "context content must escape tag-like tool output" | ||
| ); | ||
| assert.equal( | ||
| text.includes("before </previous_tool_result_context><evil> after"), | ||
| false, | ||
| "raw context-closing content must not be emitted" | ||
| // With skip_thought_signature_validator bypass: native functionResponse is emitted | ||
| // The legacy XML escaping is no longer needed since we send native functionResponse | ||
| const toolResponseTurn = result.request.contents.find( | ||
| (c) => c.role === "user" && c.parts.some((p) => p.functionResponse) | ||
| ); | ||
| assert.ok(toolResponseTurn, "expected native functionResponse turn"); | ||
|
Comment on lines
+844
to
+849
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the legacy XML escaping assertions have been removed and replaced with a check for native |
||
| }); | ||
|
|
||
| test("OpenAI -> Antigravity maps Claude-family models to Gemini-compatible schema", () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the removal of the signatureless tool call evasion/text-context logic, the variables
stringifySignaturelessToolCallsandcontextualizeSignaturelessToolResponses(defined earlier in this function) are now unused/dead code. Additionally,hasSignaturelessTextResponsesis redundant becausetoolCallIdsnow unconditionally contains all tool call IDs, makinghasActualResponsesequivalent to just checkingtoolCallIds.some((fid) => toolResponses[fid]). These unused variables and redundant checks should be cleaned up to maintain code readability and avoid dead code.