fix(server): Antigravity 502s fail the turn with the real error #33596
main fromrefs/pull/33596/head·merged by juliusmarminge View on GitHubProblem#
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_ERRORalso accepts an HTTP status line afterStatus:, so a 502 becomes a retryableprovider_errorcarrying 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 (markedretired) 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/retryDelayinstead of one shifted late by the timeout. An absolutequotaResetTimeStampis 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:42syields aresetAtanchored to the check time) and passes after. The watchdog test's stub reports its failure only for aretiredcheck, so dropping that flag at the call site fails it. - At head both files pass (105 tests).
vp run check:changedat the merge with main (695e6ecd1f): format, lint, knip, typecheck (14 packages) and tests (3 files, 107 tests) pass.API_ERRORstays 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.
| Row | Before | After | Diff0 (×255) | DiffT (>16) |
|---|---|---|---|---|
| W1 gateway 502 | ![]() | ![]() | ![]() | ![]() |
| W2a quota, absolute reset | ![]() | ![]() | ![]() | ![]() |
| W2b quota, relative delay only | ![]() | ![]() | ![]() | ![]() |
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.
- Recordings (excerpts cut the labelled idle middle; raws keep the full wait; app startup frames trimmed): W1 before excerpt, after excerpt, before raw, after raw · W2a before excerpt, after excerpt, before raw, after raw · W2b before excerpt, after excerpt, before raw, after raw
- What else changed: W1, nothing outside the error body (x=408–1075, y=256–298), where the two-line generic message becomes the one-line gateway message. W2a/W2b, following from the failure class changing to
usage_limit: the sidebar status reads Limited instead of Failed (the project name truncates earlier), the red failure row becomes the amber usage-limit warning above the composer, and the composer's send button changes to the resume (play) icon. Sub-threshold anti-aliasing at the sidebar title edge. Volatile regions that differ between any two runs: the failure's wall-clock time, sidebar ages, recording timers, and (W1) the provider-update button. - Stub and drivers: agy, driver.js, still-driver.py (W1: still-driver-v2.py), frozen-clock.js, diff-driver.py (W1: diff-driver-v2.py), media-driver.py (W1: media-driver-v2.py), launch-recipe.sh. Reports: W1 evidence.md, W2 evidence-w2.md, fixture-matrix.md
- No client code changes. A live Antigravity 502 was not exercised: no backend is available here, and the fixtures use the harness's error text inside the existing error-step payload.
AI-assisted; verified with the tests and tools listed above.












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.
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: