Skip to content

google-antigravity: generic 400 invalid argument on first replay of freshly captured thoughtSignature (no sentinel-only retry) #8054

Closed

Description

@visualbridge7188

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

  1. Run a turn on google-antigravity/gemini-3.8-flash that replays a just-captured thoughtSignature for the first time (history + one new tool-call round) → 400.
  2. Surrounding requests that replay already-once-replayed signatures return 200. Switching the same history to zai/glm-5.3-flash returns 200 immediately.
  3. Restore the client-side input arrays from ~/.opencodex/responses-state.json and re-post them to the local proxy with the same model and effort ~1h later → both previously failing inputs return 200.
  4. 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 the THOUGHT_SIGNATURE_BYPASS sentinel 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

Suggested fix

  1. On upstream 400 invalid_request / payload-rejected for the google family, retry once with all replay-injected thoughtSignature values stripped (sentinel-only path) before surfacing the error.
  2. 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

  1. added
    bug
    provider
    tools
    on Oct 31, 2026
  2. Ingwannu commented on Nov 4, 2026

    @Ingwannu
    Owner

    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 400 INVALID_ARGUMENT is normalized in fetchGoogleWithRetry (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's fetchResponse wrapper 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-rejected is intentionally treated as futile to resend, and a generic INVALID_ARGUMENT does not tell us the signature was the cause.

    To narrow down why the signature was rejected in the first place:

    1. Do you have more than one Antigravity account configured? If so, which account label does usage.jsonl show 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.
    2. Can you still reproduce on 2.97.0?
    3. If it recurs, the redacted antigravity-wire-shape provider 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.

  3. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  4. visualbridge7188 commented on Nov 5, 2026

    @visualbridge7188
    ContributorAuthor

    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:

    • I do have 2 Antigravity accounts configured in auth.json.
    • However, all three requests ran under the exact same account label (o6310db):
      • Preceding 200 capturing signatures: 2026-10-28T12:06:01Z (accountLogLabel: "o6310db")
      • Failing request 1 (ocx-9fbb9c906d42c117ccb6d2719a64a45e at 12:06:23Z): accountLogLabel: "o6310db", 400 INVALID_ARGUMENT
      • Preceding 200 retry: 2026-10-28T12:07:36Z (accountLogLabel: "o6310db")
      • Failing request 2 (ocx-d796b0061cb30ab673dac9954bd2499c at 12:07:42Z): accountLogLabel: "o6310db", 400 INVALID_ARGUMENT
    • So this was not cross-account session pollution; it was within a single account session.

    2. Reproduction on 2.97.0:

    • I updated to 2.97.0. Normal requests and tool-call turns with gemini-3.8-flash are currently running smoothly without 400 errors so far. I will continue observing.

    3. Diagnostics if it recurs:

    • Noted! If a 400 signature rejection happens again, I will provide the redacted antigravity-wire-shape diagnostic with only signature counts and placement (omitting values and tokens).

    Looking forward to the 400 invalidation patch!

  5. Ingwannu commented on Nov 7, 2026

    @Ingwannu
    Owner

    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.

    • Today a real HTTP 400 never reaches handleSignatureRejection. The rejected signature stays in the session replay cache until the 1h TTL expires.
    • With fix(google): clear replayed thought signatures on a real HTTP 400 (#8054) #8150, the adapter's fetchResponse wrapper reads a clone of the 400 body and clears that entry. The next turn signs with the bypass sentinel instead.
    • The rejected request itself is still not resent.

    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 that 200 replayed the same call ids, a bad cached entry alone cannot explain the second 400.
    • If it captured new signatures, the first-replay failure happened twice.

    If it happens again, the redacted antigravity-wire-shape diagnostic 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugprovidertools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions