Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep Antigravity child tool calls out of the parent's reply #46915

Openjuliusmarmingewants to merge 3 commits intomain fromrefs/pull/46915/headopened View on GitHub

juliusmarmingecommented

When a native Antigravity background subagent ran, agy forwarded the child's tool calls onto the parent session. T3 treated them as the parent's own tools, so they appeared as cards in the parent's timeline and split the parent's streaming reply in two, often mid-word, and the split was saved in history. The Antigravity adapter now drops these forwarded calls (tool call IDs prefixed <childConversationId>:) before they reach the parent's timeline. The child's work still appears in the subagent's own thread.

Fixes pingdotgg/t3code#46894

Reproduction on main

Commit b4fd7ba418 (origin/main). Web dev server started with T3CODE_DEV_SEED=0 and GOOGLE_GEMINI_BASE_URL pointed at the hub, on a fresh database. Added an Antigravity instance through Settings → Providers → Add provider, with sign-in method "Gemini API key" and a placeholder key. It showed agy v1.5.21, authenticated, 8 models. Added a scratch git project with 12 plain-text note files and opened a thread on Gemini 4 Neon (Low, Full access).

Turn 1 asked the parent to call invoke_subagent with TypeName="research" in the background. The child was told to read each note and run wc -w on it. The parent replied "launched" and a "Note Files Researcher" subagent appeared in Lineage. While the child was still working, I sent a follow-up asking for a five-paragraph lighthouse essay with bold headings and no tool calls.

What I saw: the parent's streamed reply was cut in the middle of a word. It read "...vital trade routes still demanded reliable navigational aids. Mon", then a child card "wc -w /tmp/.../note03.txt", then a new message starting "astic orders and coastal guilds...". More child "Running wc" cards kept landing in the parent timeline after the essay. Child cards had also appeared under the first turn ("Ran 2 commands").

The split is stored, not just drawn. In orchestration_v2_projection_turn_items for the parent's run, ordinal 1000009 is assistant_message "**The Ancient Pharos...", 1000010 is command_execution, and 1000011 is assistant_message "astic orders...". All three carry the parent's run ID and have no subagent link. The leaked item's native ID is <rootSession 53e71586…>:tool:<childConversation 7d0d0257…>:call_9495233002226623095. That ID is built as ${context.nativeThreadId}:tool:${toolCallId} (packages/provider-acp/src/server/adapter.ts ~5875), on the root-session path. This answers the question the reporter left open: agy sends the child's tool update on the root session, already prefixed <childConversationId>: in its toolCallId, and T3 treats it as one of the parent's own tool calls.

Failing test pushed as factory/repro-46894 (1527ba4371), in apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts. On main it fails with the reply split into ["Medieval Beacons\nMon", "astic orders kept braziers lit. ..."]. The test expects one reply and no child-prefixed tool item on the parent.

Related: open contributor PR #46160 (vitalikish, unmerged) targets this exact behaviour. #45156 point 3 describes the same leak mechanism inside a /swarm bundle. Neither is fixed on main.

Evidence

Being captured: before and after in the real app. This section is filled in before the pull request can merge.

Tests

  • vp test run src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts -t "forwarded child tool calls" (before the fix): failed, reproducing the split reply
  • vp test run src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts src/provider/acp/AntigravityProtocol.test.ts: 106/106 passed
  • vp test run src/provider/acp/AntigravityProtocol.test.ts (with the new predicate test): 54/54 passed
  • vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and tests (3 files, 109) all pass

Not in this change

  • Not reproduced live against agy through the hub; the failing adapter test from factory/repro-46894 stood in for the live reproduction.
  • #45156 (/swarm bundle) may need other changes beyond this leak; only the forwarded child tool-call leak is addressed here.
  • Existing parent histories that already stored split replies and child cards are not repaired.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

    1. tanstack-source added labelsbug

    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      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.5 KiB92.5 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 decoded78.3 KiB78.3 KiB0 B (0.0%)200.2 KiB✅
      Codexlong turn finished, work pagerows75750 (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 decoded79.2 KiB79.2 KiB0 B (0.0%)200.2 KiB✅
      Claudelong turn finished, work pagerows75750 (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: fc6ba3d · PR result: e2d5997 · 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.

    3. @@ -1057,3 +1058,14 @@
      10571058 expect(foreignCall.data.rawInput).toEqual({ message: "Hello", toolSummary: "Send greeting" });
      10581059 });
      10591060 });
      1061+
      1062+describe("Antigravity forwarded child tool calls", () => {
      1063+ const root = "11111111-2222-4333-8444-555555555555";
      1064+ const child = "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee";
      1065+ const toolCall = (toolCallId: string): EffectAcpSchema.SessionNotification => ({
      1066+ sessionId: root,
      1067+ update: { sessionUpdate: "tool_call", toolCallId, title: "wc -w", kind: "execute" },
      1068+ });
      1069+
      1070+ it("recognizes only calls named by another conversation", () => {
      1071+ expect(isAntigravityForwardedChildToolUpdate(toolCall(`${child}:call_1`))).toBe(true);
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      acp/AntigravityProtocol.test.ts:1071

      This repeats the forwarded-child case already exercised by the adapter regression test. Could you remove this assertion and keep that case at the adapter layer, where it also verifies the reply stays intact?

      No longer relevant as of e2d59974e0a5982bcdd99f7d5da5aa180a28ced5

    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The Antigravity protocol now detects forwarded child tool updates. The adapter filters these updates from parent-session processing after read repair. Tests cover detection and verify that child tool calls do not split a streaming parent reply or create parent timeline items.

      Changes: Forwarded child tool update filtering

      Layer / File(s)Summary
      Detect forwarded child tool updates
      apps/server/src/provider/acp/AntigravityProtocol.ts, apps/server/src/provider/acp/AntigravityProtocol.test.ts
      A new helper identifies tool-call updates whose UUID-shaped conversation prefix differs from the notification session ID. Tests cover matching and rejected prefixes.
      Filter updates in the adapter
      apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts, apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts
      The adapter applies read repair before filtering forwarded child tool updates. The regression test checks that child tool calls do not split the parent reply or create parent timeline items.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Possibly related issues

      • pingdotgg/t3code#31297: The PR filters child-prefixed tool calls from the parent timeline. It does not address the separate child-view lookup issue described in this issue.

      Suggested reviewers: eliblaubalto, matthewcosier

      Merge Risk: Minimal · up to e2d59

      The change keeps forwarded background-subagent tool calls out of the parent timeline so parent replies stream without interruption. The remaining uncertainty is that live agy behavior was not reproduced, but nothing indicates a concrete defect, and the change is low risk to merge.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the primary change: Antigravity child tool calls are kept out of the parent's reply. It matches the summarized adapter and protocol changes, which filter forwarded child tool updates f…
      Description checkPassedThe description follows the template's main sections. Problem explains the leak of child tool calls into the parent timeline and the split reply. Change describes the adapter filter on the child ID pr…
      Linked Issues checkPassed[#46894] The issue requires that the parent reply stream without splits, and that child tool activity appear only in the subagent's own activity. At head e2d5997, makeAntigravityAcpAdapterFlavor in …
      Out of Scope Changes checkPassedThe changed code at head ties to the forwarded child tool-call leak in #46894. The changes are: the new predicate isAntigravityForwardedChildToolUpdate in AntigravityProtocol.ts; its wiring in Antig…
      Full details: Title check

      Explanation

      The title names the primary change: Antigravity child tool calls are kept out of the parent's reply. It matches the summarized adapter and protocol changes, which filter forwarded child tool updates from the parent session. The title follows the conventional commit form and is specific enough for a teammate to scan.

      Full details: Description check

      Explanation

      The description follows the template's main sections. Problem explains the leak of child tool calls into the parent timeline and the split reply. Change describes the adapter filter on the child ID prefix. Scope links issue #46894. Verification lists focused test commands with results and states what was not checked. The Evidence section says it is still pending, which is a gap for a UI-visible bug. The 'Who did the work' attribution is included as the template requests. The description is mostly complete, so the check passes. Minor gap: the Evidence section is unfilled and the 'Scope' section does not explain why the fix needs no issue beyond the linked one.

      Full details: Linked Issues check

      Explanation

      [#46894] The issue requires that the parent reply stream without splits, and that child tool activity appear only in the subagent's own activity. At head e2d5997, makeAntigravityAcpAdapterFlavor in apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts wraps the session-update handler. It runs reads.repair(notification) first. It then returns early when isAntigravityForwardedChildToolUpdate(repaired) is true, so forwarded child tool updates never reach the parent projection. The same predicate also filters the read-repair completion path through projectUpdate. Read repair still sees child updates, so child file-read pairing is preserved. The predicate is imported from apps/server/src/provider/acp/AntigravityProtocol.ts. Its body was not re-read at this head in this review. The previous review read it at f120fdd, and the change summary describes the same tool_call and tool_call_update behavior. The new adapter regression test and predicate tests were not independently read; the PR reports them passing. Limits: the live agy reproduction was not performed. The whole-PR adapter diff could not be read through the diff operation, so the verdict relies on head file contents and the change summary.

      Full details: Out of Scope Changes check

      Explanation

      The changed code at head ties to the forwarded child tool-call leak in #46894. The changes are: the new predicate isAntigravityForwardedChildToolUpdate in AntigravityProtocol.ts; its wiring in AntigravityAdapterV2.ts on the projection path and the read-repair completion path; and the regression test in AntigravityAdapterV2.test.ts and predicate tests in AntigravityProtocol.test.ts. The PR description lists existing stored histories and the #45156 /swarm bundle as excluded. These are declared exclusions, not out-of-scope changes. The whole-PR diff could not be read through the diff operation, so this verdict relies on head file contents and the change summary.

      Finishing Touches

      Generate unit tests (beta)

      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between f120fdd36b1d25f5b47f0351b38b197cb9a432c3 and e2d59974e0a5982bcdd99f7d5da5aa180a28ced5.

      Files selected for processing: 1

      • apps/server/src/provider/acp/AntigravityProtocol.test.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at e2d5997

      Macroscope's review found this PR approvable — Antigravity child tool updates are filtered out of parent replies while read-repair processing remains intact. The change is limited to transcript projection, with no material execution or access-policy impact.

      Notes:

      • No code objects were reviewed. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    1. Pushede2d5997

    2. The automated pipeline stopped on this pull request and will not merge it:

      the capture step could not show the problem on the base commit, so there is nothing to prove fixed.

      Created the same scratch git project with 12 synthetic note files. Added Antigravity through Settings → Providers → Add provider, Gemini API key with a placeholder, then Connect; both reported authenticated and 8 models. On head, sent the background invoke_subagent research prompt, observed Note Files Researcher and 'launched', then sent the five-paragraph lighthouse essay prompt using Steer while the child was running. The child read note01.txt, but no wc command or essay followed; the parent displayed HTTP 503 auth_unavailable with upstream 404. On base, added the same project with the real CLI and started a thread with the identical first prompt and model; opened it in the web app. It failed with the same HTTP 503 before launching a child, so the follow-up condition could not be reached. Captures show the provider blocker, not proof of the reported bug or its absence.

      It stays open for a person to finish or close.

Sign in to join this conversation.