Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Antigravity threads keep going after a background command finishes #38864

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/38864/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Antigravity threads looked like they stopped at random. Two bugs caused it:

  1. The agent woke up and T3 Code was not listening. agy ends its prompt while a backgrounded command still runs. When the command finishes, agy starts a reply by itself with no prompt open: it streams output, runs tools, and asks for permissions. T3 Code had no active turn, so it dropped the output and failed the permission request with ACP agent requested input without an active turn. The thread stayed idle until the next user message.
  2. html_render pages never showed. agy 1.5.8+ titles T3 tool calls Run mcp_t3-code_<tool>. T3 Code did not recognize the title, so the call became a plain row with no page.

Fixes #36105. Related: #30082, #16442.

Fix

  • The built-in Antigravity adapter now uses the post-settle continuation that Hermes already uses. Output that arrives after the prompt ends starts a continuation run, and a permission request waits for that run.
  • agy ends each reply with usage_update and never sends a prompt response for a reply it started itself. The continuation run now waits for that marker (2 minute limit) instead of the 3 s debounce. In live captures the model was silent for 3.2 to 6.7 s before its first token, which split one reply across several runs.
  • T3 tool titles with the Run / Running prefix are recognized again.
  • The registry agy path gets the same behavior.

No change for other providers: the new behavior is behind flavor flags that only Antigravity and registry agy set.

Proof

Real agy 1.5.11 through vp run dev. The prompt starts a 20 s background command and ends its turn. Run 1 completed at 02:52:13. Run 2 started by itself at 02:52:27 when the command finished, ran a second command (its permission request was answered inside the run), rendered the page after an 8 s model silence, and completed at 02:52:43.

Antigravity thread continues by itself and renders the html_render page

Before the fix, the native agy log of the affected thread shows the wake-up dying on T3 Code's answer:

17:40:58  (background task finished, agy starts a reply)
17:41:11  session/request_permission RPC failed: JSON-RPC error: ACP request handler failed for method 'session/request_permission' (code -32603)
17:41:11  Tool confirmation ... step 14 (approved=false)

Tests:

  • AntigravityAdapterV2.test.ts "continues in one run when a finished background command wakes the agent" replays the captured frames. It fails on main with the same requested input without an active turn error.
  • AcpRegistryAdapterV2.test.ts covers a reply that ends before the continuation starts, and a run woken by a permission request alone.
  • vp run check:changed passes. vp test run src/orchestration-v2/Adapters: 12 files, 1139 tests pass.

Credit

This PR takes over work from three open PRs and keeps their commits or credit:

  • #36138 by @Codder13: the tool title fix (commit kept).
  • #37485 by @drstrangerujn: continuation and detached permission requests for registry agy (commit kept).
  • #30083 by @vedmalex: post-settle continuation for the built-in adapter.
  • #35073 by @juliusmarminge: turns with a launched subagent batch still settle.

Not in this PR: #38834 and #37489 fix the same stop by re-prompting agy or polling its native database. The captures show agy already replies by itself, and its database shows no in-flight step while the model thinks, so this PR listens instead.

Known limits: the first run still ends when agy ends its prompt, so the thread shows idle while the background command runs. Stop does not end a command that agy left running (#35073 covers that).

Reviewed with sol-loop: 3 passes with GPT-6.2 Sol. Sol verdict: approved

Created with Claude Fable 5.2 in Claude Code, running in T3 Code. Diagnosis started with Claude Opus 5.5.

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. tanstack-source added labelsbug

    3. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded21.5 KiB21.5 KiB0 B (0.0%)24.4 KiB✅
      CodexLive turn messages110 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
      ClaudeLive turn messages110 (0.0%)8✅

      Other scenarios

      All 64 scenario measurements match main.

      All 64 scenario measurements
      ProviderScenarioMetricMain baselineThis PRImpactPR ceiling
      Codexshort turn resumeWebSocket decoded10.5 KiB10.5 KiB0 B (0.0%)12.7 KiB✅
      Codexshort turn resumeWebSocket messages220 (0.0%)2✅
      Codexlong turn running, cold openHTTP decoded281.7 KiB281.7 KiB0 B (0.0%)302.7 KiB✅
      Codexlong turn running, cold openrows75750 (0.0%)75✅
      Codexlong turn running, history pageHTTP decoded92.4 KiB92.4 KiB0 B (0.0%)107.4 KiB✅
      Codexlong turn running, history pagerows75750 (0.0%)75✅
      Codexlong turn finished, cold openHTTP decoded381.5 KiB381.5 KiB0 B (0.0%)410.2 KiB✅
      Codexlong turn finished, cold openrows1511510 (0.0%)151✅
      Codexlong turn finished, socket cold openWebSocket decoded381.6 KiB381.6 KiB0 B (0.0%)410.2 KiB✅
      Codexlong turn finished, socket cold openWebSocket messages220 (0.0%)2✅
      Codexlong turn finished, socket cold openrows1511510 (0.0%)151✅
      Codexlong turn finished, work pageHTTP decoded186.2 KiB186.2 KiB0 B (0.0%)200.2 KiB✅
      Codexlong turn finished, work pagerows1501500 (0.0%)150✅
      Codexidle thread resumeWebSocket decoded65 B65 B0 B (0.0%)200 B✅
      Codexidle thread resumeWebSocket messages110 (0.0%)1✅
      Codexfleet shell snapshotHTTP decoded42.4 KiB42.4 KiB0 B (0.0%)53.7 KiB✅
      Codexfleet shell snapshotrows27270 (0.0%)27✅
      Codexfleet shell subscribeWebSocket decoded65 B65 B0 B (0.0%)200 B✅
      Codexfleet shell subscribeWebSocket messages110 (0.0%)1✅
      Codexfleet shell resume checkHTTP decoded18 B18 B0 B (0.0%)100 B✅
      Codexfleet shell resume checkrows0000✅
      Codexstale shell reloadHTTP decoded42.4 KiB42.4 KiB0 B (0.0%)53.7 KiB✅
      Codexstale shell reloadrows27270 (0.0%)27✅
      Codexstale shell resumeWebSocket decoded140 B140 B0 B (0.0%)400 B✅
      Codexstale shell resumeWebSocket messages220 (0.0%)2✅
      Codexstale todo list cold openHTTP decoded72.4 KiB72.4 KiB0 B (0.0%)83.0 KiB✅
      Codexstale todo list cold openrows75750 (0.0%)75✅
      Codexstale todo list cold opennodes220 (0.0%)4✅
      Codexstale todo list cold opensubagents220 (0.0%)4✅
      Codexstale todo list cold openplans110 (0.0%)2✅
      Codexstale todo list cold openproviderTurns110 (0.0%)2✅
      Codexstale todo list cold opencheckpoints110 (0.0%)2✅
      Claudeshort turn resumeWebSocket decoded10.6 KiB10.6 KiB0 B (0.0%)12.7 KiB✅
      Claudeshort turn resumeWebSocket messages220 (0.0%)2✅
      Claudelong turn running, cold openHTTP decoded283.3 KiB283.3 KiB0 B (0.0%)302.7 KiB✅
      Claudelong turn running, cold openrows75750 (0.0%)75✅
      Claudelong turn running, history pageHTTP decoded93.4 KiB93.4 KiB0 B (0.0%)107.4 KiB✅
      Claudelong turn running, history pagerows75750 (0.0%)75✅
      Claudelong turn finished, cold openHTTP decoded384.2 KiB384.2 KiB0 B (0.0%)410.2 KiB✅
      Claudelong turn finished, cold openrows1511510 (0.0%)151✅
      Claudelong turn finished, socket cold openWebSocket decoded384.3 KiB384.3 KiB0 B (0.0%)410.2 KiB✅
      Claudelong turn finished, socket cold openWebSocket messages220 (0.0%)2✅
      Claudelong turn finished, socket cold openrows1511510 (0.0%)151✅
      Claudelong turn finished, work pageHTTP decoded188.1 KiB188.1 KiB0 B (0.0%)200.2 KiB✅
      Claudelong turn finished, work pagerows1501500 (0.0%)150✅
      Claudeidle thread resumeWebSocket decoded66 B66 B0 B (0.0%)200 B✅
      Claudeidle thread resumeWebSocket messages110 (0.0%)1✅
      Claudefleet shell snapshotHTTP decoded43.0 KiB43.0 KiB0 B (0.0%)53.7 KiB✅
      Claudefleet shell snapshotrows27270 (0.0%)27✅
      Claudefleet shell subscribeWebSocket decoded66 B66 B0 B (0.0%)200 B✅
      Claudefleet shell subscribeWebSocket messages110 (0.0%)1✅
      Claudefleet shell resume checkHTTP decoded18 B18 B0 B (0.0%)100 B✅
      Claudefleet shell resume checkrows0000✅
      Claudestale shell reloadHTTP decoded43.0 KiB43.0 KiB0 B (0.0%)53.7 KiB✅
      Claudestale shell reloadrows27270 (0.0%)27✅
      Claudestale shell resumeWebSocket decoded140 B140 B0 B (0.0%)400 B✅
      Claudestale shell resumeWebSocket messages220 (0.0%)2✅
      Claudestale todo list cold openHTTP decoded73.4 KiB73.4 KiB0 B (0.0%)83.0 KiB✅
      Claudestale todo list cold openrows75750 (0.0%)75✅
      Claudestale todo list cold opennodes220 (0.0%)4✅
      Claudestale todo list cold opensubagents220 (0.0%)4✅
      Claudestale todo list cold openplans110 (0.0%)2✅
      Claudestale todo list cold openproviderTurns110 (0.0%)2✅
      Claudestale todo list cold opencheckpoints110 (0.0%)2✅

      Baseline: 8729bdd · PR result: c707ae2 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Sign in to join this conversation.