fix(server): Antigravity resumes after its local harness fails #23654
main fromrefs/pull/23654/head·merged by juliusmarminge View on GitHubProblem#
An Antigravity thread can stop responding after the provider's local harness fails. The ACP parent process stays alive and answers the prompt with an empty end_turn, so T3 keeps the thread attached to a process that can no longer run the agent. The next message hangs or fails with Failed to rebuild agent for session (WebSocket close code 1000). I found this in five threads on T3 Code 0.1.2-nightly.20261022.3512 (Linux), with official ACP runtimes 1.3.0 and 1.4.1.
The failure only shows up in Antigravity's native log:
local_connection.py:579] harness stderr: Agent run failed: failed to handle call hook response: no pending hook for ID <hook-id>
Expected: the turn fails, and the next message continues the same saved session.
Change#
antigravityAuthSupport.ts: launch Antigravity with--alsologtostderr, so its native log reaches the transport. The stderr handler treats three terminal records as a transport failure:local_connection.py … harness stderr: Agent run failed:, andserver.py … Failed to rebuild agent for session/Agent connection lost for session. It matches the log header and source module, so assistant text that quotes these messages does not count.AcpSessionRuntime.ts: on a stderr failure, record the termination before failing the pending request, so the adapter learns the runtime is gone while the turn is still open. The adapter's existing restart path then resumes the saved native session in a new process on the next message.To do that,
onTerminationmoves intorecordTermination. This is shared by all ACP providers: the callback now runs once, for the first recorded termination, on the stdout, stderr andretireRuntime(cancel timeout, interrupted prompt) paths. On main it ran only when stdout closed, so after a stderr failure or a retire it arrived after the process was killed and the prompt had settled. It is no longer called during an intentional stop, whichrecordTerminationalready ignored.
Unchanged behavior:
- Nothing is retried or replayed automatically; recovery waits for the user's next message.
- Model, permission policy and saved history are kept.
- Only Antigravity passes
onStderr, so stderr detection does not apply to other ACP providers.
Scope and approval#
A focused fix for an obvious bug, under CONTRIBUTING's exception for small fixes: a dead native connection must fail the turn and let the existing resume path run, instead of leaving the thread on an unusable process. No setting, retry policy or new behavior. https://git.cafe/pingdotgg/t3code/issues/11670 and https://git.cafe/pingdotgg/t3code/issues/14619 report similar stuck Antigravity threads; I am not claiming either as approval.
The hook defect itself is in Google's runtime and is not fixed here. Updating to ACP 1.4.1 alone did not help.
Verification#
Regression tests, all in existing files:
antigravityAuthSupport.test.ts: the three terminal records, including one split across stderr chunks, fail the handler; ordinary task prose and non-terminal native warnings do not. With main's handler the three cases fail (3 failed, exit 1).AntigravityAdapterV2.test.ts, three subprocess cases with the ACP mock agent: an open prompt fails; a failure racingend_turnaccepts either terminal status; a notification handshake delivers failure after the completed turn. Each case verifies that turn 2 completes in a fresh process and the singlesession/resumerequest carries the saved session ID. No timing delay controls stream ordering.AntigravityDriver.test.ts: exact launch arguments, including--alsologtostderr.
Live check against the official 1.3.0 runtime, in an isolated profile (fresh HOME, no personal config) with no-op command hooks that run true. Over five turns the agent started sleep 45 as a background task, killed it with its task tool, then answered. Turns 1–3 completed. Turn 4 hit the native hook failure; T3 detected it and failed the turn. Turn 5, a tool-free follow-up, ran in a second process on the same saved session, and the expected reply was saved. The same steps without hooks did not reproduce the failure in four turns. The native trigger is intermittent; the subprocess tests are the repeatable check.
On this branch:
vp test runonantigravityAuthSupport.test.tsandAntigravityAdapterV2.test.ts: 38 passed.AcpAdapterV2.test.ts(shared ACP adapter): 59 passed.- Antigravity auth, installation, provider, driver, skills and ACP support tests: 102 passed (before the test-only follow-up commits).
vp run --filter t3 typecheckandvp run --filter @t3tools/provider-acp typecheck: pass (existing Effect suggestions only). Targetedvp lintandvp fmt: pass.
Not checked#
- macOS, Windows, mobile and the installed desktop app. No UI change, so no screenshots.
- Another Google account or machine.
- Detection depends on Antigravity's current log format; a format change would bring back the old behavior, not a new failure.
- If the failure record arrives after
end_turn, turn 1 shows as completed with no answer. The next message still recovers.
takeover verification (2026-10-30, 1ce3a80705)#
merged current github/main without rebasing and preserved both recovery and sign-in tests. the six-file diff remains 242 additions and 11 deletions.
blacksmith: vp run check:changed passed format, lint, both knip checks, graphql validation, 13 affected-package typechecks, and 48 adjacent tests. the focused antigravity auth, driver, adapter, and shared acp adapter suite passed 117 tests. two independent read-only reviews found no blockers.
the official antigravity runtime and real client recovery were not rerun on this vm. github ci approval and final check status are tracked separately.
model: gpt-6.1-sol; harness: codex.
- 1
- 2
Pushedf58e4dc
github-actions[bot](GitHub profile, opens in a new tab) removed labelsneeds-rebase
juliusmarminge added labelstakeover:ready
juliusmarminge removed labelstakeover:in-progress
juliusmarminge merged this94baff1
juliusmarminge closed this
juliusmarminge removed labelstakeover:ready
Sign in to join this conversation.
Evidence#
Evidence: real Linux web client, Chromium, 1280×800, light theme, fresh isolated databases, Antigravity 1.4.1, Gemini API-key authentication and Gemini 3.8 Flash.
Send the same four requests on both commits: background
sleep 45, kill it with the task tool, answer7x6; repeat for9x8and5+6; then ask for tool-freepineapple. Trust the no-op workspace hooks. The native failure occurred on request 1 on both sides. Base retained the broken runtime; head surfaced failures and recovered for the follow-up.For the completion case, a transparent transport held a genuine native failure record, verified
status: completedandactiveRunId: null, then released stderr. No native record or ACP response was synthesized. Both builds enabled stderr emission for this supplementary experiment. Head retired PID 114731 and loaded saved session6222d3f9-4858-4c78-978d-70b0c1110172in PID 117292. Base retained its broken process and returned Internal error. Ordering, app-state and session transcript.The shared ACP runtime was also exercised with real OpenCode 1.19.6 and GPT-6 Luna on head: process termination during an open prompt produced an error, followed by successful recovery through
session/load. Recording, transport transcript.Seed script, Antigravity transport, OpenCode transport, full procedure, primary runtime transcript.
All media was visually inspected. Final stills were pixel-identical across captures more than 500 ms apart. Titles were fixed. Environment names were masked in recordings; timing and chat content were preserved. The primary head recording has an empty side surface open; final stills use matching collapsed panels. Servers were stopped and worktrees and scratch files removed.
Not shown: