Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Antigravity 502s fail the turn with the real error #33596

Mergedjuliusmarmingemerged 12 commits intomain fromrefs/pull/33596/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Problem

When Antigravity's backend returns a 502, agy acp records an error step in its session log and then often leaves session/prompt open with no further output. T3 Code waited out the 15-minute inactivity watchdog and showed the generic "Antigravity sent nothing for 15 minutes…" failure, ignoring the 502 already in the log. Separately, the session-log parser expected a gRPC token after Status: and did not match the harness's 502 form (Error 502, Message: Bad Gateway: Failed to connect to backend API, Status: 502 Bad Gateway, Details: []), so a 502 became a generic, non-retryable "Antigravity stopped this turn because of an error."

Reproduced on main (ff7aa5ace3) with the regression tests below: the parser returns the generic failure for the 502 payload, and a silent prompt retired by the watchdog ends with the generic message even when the outcome check has a recorded failure.

Change

  • AntigravityTurnOutcome.ts: API_ERROR also accepts an HTTP status line after Status: , so a 502 becomes a retryable provider_error carrying the API message. A message now stops at the next , Status: or the next error header, which keeps the match linear.
  • adapter.ts: when the inactivity watchdog retires a silent prompt, it runs the flavor's existing outcome check (marked retired) and fails the turn with the failure the check reports. With nothing recorded, or if the check dies, it falls back to the generic message as before. The timeout and the rest of retirement (runtime restart, tool terminalization) are unchanged.
  • A retired check runs up to the timeout after the agent logged the error, and the session log has no step timestamps, so for a retired prompt Antigravity reports no reset time for a relative quotaResetDelay/retryDelay instead of one shifted late by the timeout. An absolute quotaResetTimeStamp is still reported.

Scope and approval

Fixes pingdotgg/t3code#33583

Verification

  • vp test run src/provider/acp/AntigravityTurnOutcome.test.ts src/orchestration-v2/Adapters/AcpAdapterV2.test.ts (apps/server):
    • On the test-only commit (main + tests), both original regression tests fail: "fails only turns whose own steps end in an upstream error" receives "Antigravity stopped this turn because of an error.", and "fails a silent prompt with the failure its outcome check recorded" receives the generic "sent nothing for 15 minutes" failure. Runtime transcript: transcript-33583.md
    • "keeps only an absolute reset time for a prompt the watchdog retired" fails before the reset-time fix (a retryDelay:42s yields a resetAt anchored to the check time) and passes after. The watchdog test's stub reports its failure only for a retired check, so dropping that flag at the call site fails it.
    • At head both files pass (105 tests).
  • vp run check:changed at the merge with main (695e6ecd1f): format, lint, knip, typecheck (14 packages) and tests (3 files, 107 tests) pass.
  • API_ERROR stays linear on malformed input: about 0.1 ms on 3,000-token inputs (repeated headers, unterminated message, invalid status), against 7–56 ms for the old pattern.
  • Three independent review rounds on the full diff. The only code finding (a relative reset estimate anchored to the late check) is fixed above; the retired quota states it changes are captured below.

Evidence

ACP stub harness; no live Antigravity backend. A stub agy acp accepts session/prompt, writes an error step to the managed session log right after dispatch, then stays silent. Every row ran the real 15-minute watchdog on both sides, each from its own checkout on a fresh database (T3CODE_DEV_SEED=0), seeded by the same RPC driver. Web, 1440×900 CSS, dark, DPR 2, no emulation, 100% font scale (stills: headless Chromium 148, browser clock frozen after retirement; recordings: Chrome 156). Before is main bbdc7dc; after is 570bc59 (W1) and 695e6ec (W2a/W2b); nothing between them touches the server paths these rows exercise.

RowBeforeAfterDiff0 (×255)DiffT (>16)
W1 gateway 502beforeafterdiff0diffT
W2a quota, absolute resetbeforeafterdiff0diffT
W2b quota, relative delay onlybeforeafterdiff0diffT

Every row: before ends in the generic "Antigravity sent nothing for 15 minutes…" failure at retirement. After: W1 shows "Bad Gateway: Failed to connect to backend API" (provider_error, code 502 Bad Gateway, retryable); W2a shows the usage-limit warning with "Resets 5:05 AM" and Resume/Snooze at reset; W2b shows the usage-limit warning with "Reset time unavailable; retry manually" and no reset controls.

AI-assisted; verified with the tests and tools listed above.

    1. Pushed951bfe8

    2. Evidence

      Controlled ACP fixture; no live Antigravity backend. On fresh databases, dispatch identical requests whose session logs record a 502 or quota failure, leave the prompts unresolved, and wait for the unchanged 15-minute watchdog. Real web client and server, Linux Chrome 158, 1440×900 CSS, DPR 2, dark theme.

      CaseBeforeAfter
      Commit074a0d3951bfe8
      Gateway 502Before: generic inactivity failureAfter: backend gateway message
      Absolute quota resetBefore: generic inactivity failureAfter: absolute reset preserved
      Relative quota delayBefore: generic inactivity failureAfter: reset time unavailable

      Full recordings preserve the real wait; retirement occurs near 15:00: before, after. Environment labels are redacted; exported at 5 fps.

      Head persists the gateway as provider_error, code 502 Bad Gateway, retryable:true. Absolute resetAt is 2026-11-24T05:05:00.000Z; the relative-only failure has no resetAt. Persisted runtime outcomes.

      ACP stub · RPC driver · Reproduction recipe · Recorded error steps · Media driver.

      Not shown:

      • Live agy retry exhaustion against a pre-header upstream 502 was not exercised; the supplied ACP stub produced the recorded outcomes.
      • The normal prompt-return path was not proved: auxiliary stub attempts remained running after replying and were stopped. The successful proof covers inactivity retirement.
    3. juliusmarminge added labelstakeover:ready

    4. juliusmarminge removed labelstakeover:in-progress

    5. juliusmarminge merged this1d4d9be

    6. juliusmarminge closed this

    7. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.