Repository navigation
Description
Client or integration
Codex App
Area
Provider adapter
Summary
Two turns in one Codex Desktop thread failed with Provider error 400: Antigravity invalid request: Request contains an invalid argument. on google-antigravity/gemini-3.8-flash. The same thread served 200s on the same model immediately before and (minutes later) on the identical input payloads. Evidence points at the thoughtSignature replay cache supplying an invalid value on the first replay of a freshly captured entry, with no retry fallback.
Expected: a 400 invalid_request / payload-rejected on the google family should trigger one sentinel-only retry before surfacing the error.
Reproduction
- Run a turn on
google-antigravity/gemini-3.8-flashthat replays a just-captured thoughtSignature for the first time (history + one new tool-call round) → 400. - Surrounding requests that replay already-once-replayed signatures return 200. Switching the same history to
zai/glm-5.3-flashreturns 200 immediately. - Restore the client-side input arrays from
~/.opencodex/responses-state.jsonand re-post them to the local proxy with the same model and effort ~1h later → both previously failing inputs return 200. - The differing component is
~/.opencodex/antigravity-replay.json: the freshly captured entries existed at failure time and had aged out (1h TTL) by replay time, so the replays went out via theTHOUGHT_SIGNATURE_BYPASSsentinel path instead of the replay-injection path.
Failed requests (from usage.jsonl):
| time (local) | request id | outcome |
|---|---|---|
| 20:12:53 | ocx-9fbb9c906d42c117ccb6d2719a64a45e |
400, failureCause=payload-rejected, failureStage=headers-only, resendPermission=refused-futile |
| 20:14:22 | ocx-d796b0061cb30ab673dac9954bd2499c |
400, same fields |
Version
2.93.0 (npm install, bundled Bun runtime)
Operating system
macOS 26.6.2 (25G83)
Provider and model
google-antigravity / gemini-3.8-flash (OAuth, cloud-code-assist)
Logs or error output
Provider error 400: Antigravity invalid request: Request contains an invalid argument.
failed request ids: ocx-9fbb9c906d42c117ccb6d2719a64a45e, ocx-d796b0061cb30ab673dac9954bd2499c
failureCause=payload-rejected failureStage=headers-only resendPermission=refused-futile
Additional context
applyAntigravityReplayinjects the cached signature for matching functionCall parts; when no entry exists,applyAntigravityThoughtSignatureFallbackinjects the validator-bypass sentinel, which upstream accepts. An entry holding an invalid value therefore turns a would-be-accepted request into a blanket 400, andresendPermission: refused-futileblocks the sentinel-only retry that would have succeeded.- 2.93.0 already guards the known
ctc_/toolu_id leak (Antigravity 400 "Base64 decoding failed" when a thread with Claude history switches to a Gemini model (ctc_* signatures forwarded as thoughtSignature) #174); this error is the generic message rather than theTYPE_BYTES / Base64 decoding faileddetail from Antigravity 400 "Base64 decoding failed" when a thread with Claude history switches to a Gemini model (ctc_* signatures forwarded as thoughtSignature) #174, so this looks like a different corruption mode (capture-side truncation or call-key mismatch) rather than foreign-id forwarding. - Could not capture the exact poisoned entry: TTL expired before investigation and no filesystem snapshot was available. The surviving snapshot shows the turn's signatures with
touchedAtMsin the 20:13:42–20:14:13 window.
Suggested fix
- On upstream 400
invalid_request/payload-rejectedfor the google family, retry once with all replay-injectedthoughtSignaturevalues stripped (sentinel-only path) before surfacing the error. - Add optional debug logging of each injected signature's provenance (captured-at ms, call-key hash, length) so a bad entry can be identified when this recurs.
First reported in #7907 (auto-closed by the issue-quality bot for template non-use; resubmitting with this template). Happy to provide ocx logs get output for the two request ids if useful.
Activity
Ingwannu commentedon Nov 4, 2026
Thanks for the detailed resubmission. I traced it against current
dev(72e80d2).Confirmed gap: the Google adapter's clear-on-invalid path (
handleSignatureRejection,src/adapters/google.ts:948) runs only when the error arrives inside a 200 body/stream (:1365,:1677). A real HTTP 400INVALID_ARGUMENTis normalized infetchGoogleWithRetry(src/adapters/google-http.ts:104-134) and returned by the dispatcher without reaching the adapter parser. So the Antigravity replay entry for that session is not cleared, and the same signature is replayed until the 1h TTL expires. That fits your observation: back-to-back 400s, then the same input succeeding after the entry aged out. The existing invalidation tests use status-200 error bodies, so they don't cover this path. A narrow fix is to call the same invalidation from the adapter'sfetchResponsewrapper on a 400. The next turn would then fall back to the sentinel instead of re-sending the bad signature.The broader "retry once with only the sentinel" behaviour is a separate design question:
payload-rejectedis intentionally treated as futile to resend, and a genericINVALID_ARGUMENTdoes not tell us the signature was the cause.To narrow down why the signature was rejected in the first place:
usage.jsonlshow for the 200 that captured the signatures and for the two failing requests (ocx-9fbb9c906d42c117ccb6d2719a64a45e,ocx-d796b0061cb30ab673dac9954bd2499c)? In 2.93.0 the replay session id was not scoped per account. fix(google,cursor): isolate Antigravity session/replay and Cursor H2 pool/JWT sub scope #7842 (shipped in 2.94.0) added that scope.antigravity-wire-shapeprovider debug diagnostic for the failing request id would help (signature counts and placement only, no signature values).Please don't post signature values or tokens.
github-actions commentedon Nov 4, 2026
Automated translation bookkeeping — detected language: English.
visualbridge7188 commentedon Nov 5, 2026
Thanks @Ingwannu for confirming the bug and tracing the missing invalidation on HTTP 400.
Here are the answers to your questions:
1. Antigravity accounts & labels:
auth.json.o6310db):2026-10-28T12:06:01Z(accountLogLabel: "o6310db")ocx-9fbb9c906d42c117ccb6d2719a64a45eat 12:06:23Z):accountLogLabel: "o6310db", 400INVALID_ARGUMENT2026-10-28T12:07:36Z(accountLogLabel: "o6310db")ocx-d796b0061cb30ab673dac9954bd2499cat 12:07:42Z):accountLogLabel: "o6310db", 400INVALID_ARGUMENT2. Reproduction on 2.97.0:
2.97.0. Normal requests and tool-call turns withgemini-3.8-flashare currently running smoothly without 400 errors so far. I will continue observing.3. Diagnostics if it recurs:
antigravity-wire-shapediagnostic with only signature counts and placement (omitting values and tokens).Looking forward to the 400 invalidation patch!
fix(google): clear replayed thought signatures on a real HTTP 400 (Refs
Ingwannu commentedon Nov 7, 2026
Thanks for the answers. All three requests used the same account label, so this is not the cross-account replay-scope problem that #7842 fixed in 2.94.0.
#8150 fixes the part we confirmed.
handleSignatureRejection. The rejected signature stays in the session replay cache until the 1h TTL expires.fetchResponsewrapper reads a clone of the 400 body and clears that entry. The next turn signs with the bypass sentinel instead.It does not explain why upstream rejected a signature it had just issued. Your timeline has a 200 at 12:07:36 between the two 400s, and the diagnostic can tell two cases apart:
If it happens again, the redacted
antigravity-wire-shapediagnostic for the failing request id would show which case it was.One small mismatch: the times in your reply (2026-10-28 12:06:23Z / 12:07:42Z) don't line up with the table in the issue (20:12:53 / 20:14:22 local). Please match entries by request id when you post a diagnostic.
#8150 carries
Closes #8054. If this recurs on a build that includes it, please reopen with the diagnostic.fix(google): clear replayed thought signatures on a real HTTP 400 (#8054
Revert 14 PRs admin-merged on CI alone without required review (#8402)
fix(google): clear replayed thought signatures on a real HTTP 400 (#8054