fix(antigravity): strip orphan tool_use/tool_result pairs before upstream send (#6026) - #6055
Closed
diegosouzapw wants to merge 1 commit into
Closed
diegosouzapw wants to merge 1 commit into
diegosouzapw wants to merge 1 commit into
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Owner
Author
|
Closing as superseded — the underlying issue #6026 (orphan Antigravity tool_result) was fixed and merged into the release via #6115 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6026.
Bug
Antigravity (Claude-opus-4.6 on Vertex) via AgentBridge/MITM returned 400:
The client shipped a history whose first message already carried a
tool_resultwith no precedingtool_use(an orphan).Root cause
open-sse/services/contextManager.ts::fixToolPairs()already strips exactly this orphan — butAntigravityExecutoroverridesBaseExecutor.execute(), and the base executor's tool-pair guard (base.ts~L1099,fixToolPairs/fixToolAdjacency/stripTrailingAssistantOrphanToolUse) lives in the baseexecute(). So the Antigravity path never ran it — the orphan reached Vertex/Anthropic unmodified.Fix
Add
sanitizeAntigravityToolMessages()that mirrors the exact sequence the base executor uses for Claude-bound providers (fixToolPairs→fixToolAdjacency→ re-fixToolPairs→stripTrailingAssistantOrphanToolUse), and call it inAntigravityExecutor.execute()on the upstream body before tool cloaking (which only remaps names). Idempotent on clean histories.Validation (Hard Rule #18 — TDD)
tests/unit/antigravity-orphan-toolresult-6026.test.ts(3) — reproduces the orphan-tool_result-at-messages[0]payload and asserts it's stripped; asserts a valid tool_use→tool_result pair is preserved; asserts a no-op on bodies without amessagesarray. Fails on the pre-fix path (no sanitization ran).typecheck:core✓ ·lint✓ (0 errors) ·check:cycles✓ ·check:docs-sync✓ · existing antigravity suites (43) ✓Note
Reproduced from the issue's error + confirmed root cause in code (executor override bypasses the base guard). Applied the proven base-executor sequence rather than a bespoke fix to avoid over/under-stripping.