Skip to content

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

Open
t3dotgg wants to merge 1 commit into
t3code/audit-grok-build-gapsfrom
t3code/grok-subagent-roster
Open

feat(server): show Grok subagents in the Agents panel#6410
t3dotgg wants to merge 1 commit into
t3code/audit-grok-build-gapsfrom
t3code/grok-subagent-roster

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Aug 13, 2026

Copy link
Copy Markdown
Member

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 for commit f3070ff. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

Grok already emits _x.ai/session/update spawn and finish events. T3 dropped them, so children only showed up as a huge spawn_subagent tool row.

Map those events to task.started and task.completed, the same fold Claude and Codex use. Hide the spawn tool so the roster is the only surface.

Made with Grok 4.6.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

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

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 11.3 KiB 15.1 KiB
Codex Thread snapshot wire 5.5 KiB 7.3 KiB
Codex Live turn WebSocket wire 5.9 KiB 7.8 KiB
Codex Live turn WebSocket decoded 49.7 KiB 66.4 KiB
Codex Live turn messages 16 21
Claude Total thread wire 11.3 KiB 15.1 KiB
Claude Thread snapshot wire 5.5 KiB 7.3 KiB
Claude Live turn WebSocket wire 5.9 KiB 7.8 KiB
Claude Live turn WebSocket decoded 50.6 KiB 66.4 KiB
Claude Live 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Reviewed by Cursor Bugbot for commit f3070ff. Configure here.

...(toolUses !== undefined ? { toolUses } : {}),
...(durationMs !== undefined ? { durationMs } : {}),
}
: undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for commit f3070ff. Configure here.

@macroscopeapp

macroscopeapp Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant