Antigravity silent 502s wait out the full 15m inactivity timer and fail to parse in AntigravityTurnOutcome #33583
When the upstream Antigravity backend hits a 502 timeout on a turn, agy acp retries after about 5 minutes, logs step_type = 17 (ERROR_MESSAGE) into antigravity-acp/conversations/<sessionId>.db and transcript.jsonl, and then often leaves session/prompt hanging forever without emitting anything over ACP stdio.
Right now packages/provider-acp/src/server/adapter.ts only runs checkPromptOutcome (watchAntigravityPromptOutcome in apps/server/src/provider/acp/AntigravityTurnOutcome.ts) after runtime.prompt resolves. When agy acp hangs after logging those 502 steps, T3 Code waits the full 15 minutes for promptInactivityTimeout and then shows the generic "Antigravity sent nothing for 15 minutes, so T3 Code stopped the turn and restarted the agent. Send a message to continue." message, even though conversations/<sessionId>.db already recorded the exact 502 failure 5 to 10 minutes earlier.
There is also a parsing bug in apps/server/src/provider/acp/AntigravityTurnOutcome.ts when it reads a 502 step_type = 17 payload. The Go harness formats 502s as:
Error 502, Message: Bad Gateway: Failed to connect to backend API, Status: 502 Bad Gateway, Details: [] ... The model is currently unreachable.
Because API_ERROR is /Error (\d{3}), Message: (.+?), Status: ([A-Z_]+)/s, it expects an uppercase gRPC status token after Status: and does not match Status: 502 Bad Gateway. As a result, apiError comes back null and turnFailure falls back to a non-retryable "Antigravity stopped this turn because of an error." instead of a retryable 502 failure with the real error message. Also worth checking substr(step_payload, 1, ?) in lastStepAfter, since SQLite's substr() on a BLOB column coerces to TEXT and can truncate at the first null byte in the protobuf header before reaching the error string at the end of the 6.8 KB payload.
If the inactivity watchdog (or a periodic check while a prompt has been silent for several minutes) runs checkPromptOutcome against conversations/<sessionId>.db and API_ERROR accepts HTTP status strings like 502 Bad Gateway (or reads the trailing The model is currently unreachable. string), T3 Code can surface or retry the 502 instead of making the user wait 15 minutes for a generic inactivity timeout.
Unpacked
agy_acp_server.par(1.4.5) to see whatagyis actually doing here, and it explains all of the weirdness.In
ccpa_connection/ccpa_client.py,urllib.request.urlopenuses a hardcoded300.0second timeout with TCP keepalive off. After a brief network drop or machine sleep, an agent that is idle or waiting on a local tool is fine because its next model call opens a fresh socket, while any agent with an openstreamGenerateContentrequest sits on a dead socket for 5 minutes before raisingTimeoutError/CCPAConnectionError, retries once in the Go harness for another 5 minutes, and gives up. When that error step lands,local_connection.pyonly raisesAntigravityConnectionErroron HTTP400,401, and403and just logs a warning on502, sosession/promptstays stuck unless a background command happens to finish later and wake the harness.It also explains why
Agent execution error: iterateResponseStream: invalid stream chunk: HTTP/1.0 502 Bad Gateway Server: BaseHTTP/0.6 Python/3.14.5 ... Content-Length: 20leaks into chat on normalend_turn. Inccpa_connection/proxy_server.py,streamGenerateContentsends200 OKandend_headers()before iteratingbody_iter, and whenfor line in resraisesTimeoutError/OSErrormid-stream,except (OSError, ValueError)still callsself._send_error(502, b"Internal Proxy Error")(Content-Length: 20) straight into the open SSE body. That misses_API_ERROR_REinagy'sapi_errors.pyand also missesAPI_ERRORinAntigravityTurnOutcome.ts, so T3 Code falls back to the generic non-retryable message instead of treating it as a retryable 502 /transport_error.Also, if it helps unblock testing on #33596 without waiting on a live upstream 502:
OAuthManager.endpoint_urlinoauth_manager.pychecksAGY_ACP_CCPA_BASE_URLbeforeresolved_endpoint_urleven on normal consumer accounts onceacp_token.jsonhas cached onboarding, so pointingAGY_ACP_CCPA_BASE_URLat a local127.0.0.1stub reproduces both the pre-header 502 hang and the mid-stream raw 502 chunk on demand.tanstack-source added labelsbug
Confirmed on Windows with T3 Code 0.1.9 and Antigravity
gemini-4-neon(4 Neon High). This interrupted an unattended overnight run. Across two failed turns in the same thread, the native Antigravity session log recorded502 Bad Gatewayabout five and ten minutes after the last tool activity. T3 showed only the generic inactivity error at exactly 15 minutes and required a new message. A manual continuation made progress and then hit the same failure again.The diagnostics in #33596 would make this easier to understand. For unattended runs, could T3 also offer an opt-in recovery that restarts the Antigravity session and sends one continuation in the same thread, with the same model, after a short backoff on a confirmed transient 502? Show the retry in the timeline and stop after a second failure or whenever the thread is waiting for user input. The continuation should pick up saved progress and avoid replaying actions already completed.
juliusmarminge closed this
Sign in to join this conversation.
Hit this several more times today during longer coding sessions and dug into #33596 alongside a bunch of
conversations/<sessionId>.dblogs. #33596 fixes the error message at the 15 minute mark, but there are still three real gaps worth catching before that lands.First,
agy acphas a very consistent pattern on 502s: the firststep_type = 17row lands after about 5 minutes, it does one silent retry with nothing over ACP stdio, the secondstep_type = 17row lands around 10 minutes, and after that second 502session/promptnever resolves. Only checkingconversations/<sessionId>.dbwhen the full 15 minute timer expires means the UI shows no retry state at minute 5 and still sits dead for another 5 minutes afteragyalready gave up at minute 10. PollingcheckPromptOutcomewhile a turn is silent (whenpromptInactivityPausedis false) letsAcpAdapterV2firereportProviderRetryon the first upstream error step and retire immediately once two consecutive upstream error steps pile up at the tail ofsteps. Just watch out when live-pollingstep_type = 17becauseagyalso usesstep_type = 17for pre-tool hook denials before continuing the turn, so live checks need to filter for actual API, quota, or stream errors.Second,
agylogs mid-stream proxy drops in a different format that still misses the updatedAPI_ERRORregex in #33596:agent executor error: iterateResponseStream: invalid stream chunk: HTTP/1.0 502 Bad Gateway. Without matching that, mid-stream 502s still fall back to the non-retryable generic message.Third, the
checkPromptOutcomecall insideretireInactivePromptshould have a short timeout (2 to 3 seconds) so a slow filesystem or SQLite lock cannot holdruntimeTransitionPermitand block Stop.