Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): show Grok subagents in the Agents panel #6410

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 1 commit intot3code/audit-grok-build-gaps fromt3code/grok-subagent-rosteropened View on GitHub

Grok already emits subagent spawn and finish on _x.ai/session/update. T3 ignored them, so a 13-child session only showed fat spawn_subagent tool rows.

Those events now become task.started and task.completed with role, model, duration, token count, and a truncated result. The Agents panel is the same fold Claude and Codex already use. The spawn_subagent tool row is dropped.

Stacked on #6383.

Made with Grok 4.6.


Note

Low Risk Adapter-only event mapping with unit/integration tests; no auth or persistence changes.

Overview Grok’s _x.ai/session/update subagent_spawned and subagent_finished notifications are now handled in the Grok ACP adapter and surfaced as task.started / task.completed runtime events (same path Claude and Codex use for the Agents panel).

Spawn payloads carry role, model, and description; finish payloads carry normalized status, truncated output summary, and optional usage (tokens, tool calls, duration). spawn_subagent tool-call rows are suppressed so the UI shows agent tasks instead of bulky tool entries.

Parsing and mapping live in XAiAcpExtension; the mock ACP agent gains T3_ACP_EMIT_XAI_SUBAGENT for integration tests.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f3070ffdfa4cd1557d1fb8031e9a678e5ea277a0. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Show Grok subagents as task events in the Agents panel

  • Adds emitGrokSubagentSessionUpdate in GrokAdapter.ts to convert xAI subagent_spawned/subagent_finished notifications into task.started and task.completed runtime events with taskId, role, model, usage, and summary.
  • Suppresses spawn_subagent tool call events from the normal tool-call stream by tracking their IDs in a new spawnSubagentToolIds set on the session context.
  • Adds schemas, parsers, and helper utilities (GROK_SUBAGENT_TASK_TYPE, grokSubagentCompletedStatus, grokSubagentResultSummary, isGrokSpawnSubagentToolTitle) in XAiAcpExtension.ts.
  • Extends the mock agent script with a T3_ACP_EMIT_XAI_SUBAGENT=1 flag to emit subagent lifecycle notifications for local testing.
Macroscope summarized f3070ff.
    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 450ad0ec-05f4-452b-9bab-97d380565f04

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—11.3 KiB—15.1 KiB✅
      CodexThread snapshot wire—5.5 KiB—7.3 KiB✅
      CodexLive turn WebSocket wire—5.9 KiB—7.8 KiB✅
      CodexLive turn WebSocket decoded—49.7 KiB—66.4 KiB✅
      CodexLive turn messages—16—21✅
      ClaudeTotal thread wire—11.3 KiB—15.1 KiB✅
      ClaudeThread snapshot wire—5.5 KiB—7.3 KiB✅
      ClaudeLive turn WebSocket wire—5.9 KiB—7.8 KiB✅
      ClaudeLive turn WebSocket decoded—50.6 KiB—66.4 KiB✅
      ClaudeLive turn messages—16—21✅

      Baseline: unavailable · PR result: f3070ff · 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: 94.6 KiB
      • Claude decoded thread snapshot: 95.4 KiB

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

    4. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f3070ffdfa4cd1557d1fb8031e9a678e5ea277a0. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -241,0 +300,21 @@
      300+ : undefined;
      301+ const toolUses =
      302+ typeof update.tool_calls === "number" &&
      303+ Number.isFinite(update.tool_calls) &&
      304+ update.tool_calls >= 0
      305+ ? Math.trunc(update.tool_calls)
      306+ : undefined;
      307+ const durationMs =
      308+ typeof update.duration_ms === "number" &&
      309+ Number.isFinite(update.duration_ms) &&
      310+ update.duration_ms >= 0
      311+ ? Math.trunc(update.duration_ms)
      312+ : undefined;
      313+ const typedUsage =
      314+ totalTokens !== undefined || toolUses !== undefined || durationMs !== undefined
      315+ ? {
      316+ totalTokens: totalTokens ?? 0,
      317+ ...(toolUses !== undefined ? { toolUses } : {}),
      318+ ...(durationMs !== undefined ? { durationMs } : {}),
      319+ }
      320+ : undefined;
      cursor[bot](GitHub profile, opens in a new tab)commented

      Zero tokens when usage partial

      Low Severity

      When subagent_finished includes duration_ms or tool_calls but omits tokens_used, typedUsage is still emitted with totalTokens forced to 0. The Agents panel can then show a misleading zero-token total even though token usage was simply absent.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f3070ffdfa4cd1557d1fb8031e9a678e5ea277a0. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. Approvability

      Verdict: Needs human review

      This PR introduces a new feature with ~200+ lines of new event handling logic for Grok subagents, emitting new task.started/task.completed events to the runtime. New capabilities with non-trivial runtime behavior changes warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    6. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

      This maps Grok subagent spawn and finish events into the Agents panel and adds a direct adapter fixture. #8412 is the retained Grok implementation and also covers standalone children, workflow and parent linkage, progress, deduplication, terminal-first updates, and typed usage.

      If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

Sign in to join this conversation.