feat(grok): show Grok subagents in the Agents panel #8412
Closedcharindithjaindu(GitHub profile, opens in a new tab)wants to merge 2 commits into
main fromrefs/pull/8412/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/server/src/provider/Layers/GrokAdapter.ts line 585OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -506,3 +566,20 @@506566 return ctx && turnId !== undefined ? signalTurnLiveness(ctx, turnId) : Effect.void;507567 };508568569+ const applyGrokSessionNotification = (570+ ctx: GrokSessionContext,571+ method: GrokSessionNotificationMethod,572+ params: unknown,573+ ) =>574+ Effect.gen(function* () {575+ const workflow = parseXAiWorkflowUpdated(params);576+ if (workflow) {577+ const applied = applyGrokWorkflowUpdate(ctx.workflowTrack, workflow);578+ ctx.workflowTrack = applied.state;579+ yield* emitGrokTaskSpecs({580+ ctx,581+ method,582+ payload: params,583+ specs: applied.events,584+ });585+ yield* signalSessionTurnLiveness(ctx.threadId, resolveNotificationTurnId(ctx));apps/server/src/provider/acp/GrokAcpSubagents.ts lines 529 to 542Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +517,21 @@517+ };518+}519+520+export function applyGrokSubagentUpdate(521+ state: GrokSubagentTrackState,522+ update: GrokSubagentUpdate,523+): { readonly state: GrokSubagentTrackState; readonly events: ReadonlyArray<GrokTaskEventSpec> } {524+ const seenSubagentIds = new Set(state.seenSubagentIds);525+ const completedSubagentIds = new Set(state.completedSubagentIds);526+ const usageByTaskId = new Map(state.usageByTaskId);527+ const events: Array<GrokTaskEventSpec> = [];528+ const title = subagentTitle(update);529+ const linkage = {530+ taskId: update.subagentId,531+ description: title,532+ title,533+ taskType: "subagent",534+ role: update.role ?? "general-purpose",535+ ...(update.model ? { model: update.model } : {}),536+ ...(update.childSessionId ? { agentPath: update.childSessionId } : {}),537+ timelineBypass: true,apps/server/src/provider/acp/GrokAcpSubagents.ts lines 325 to 335Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +314,21 @@314+ state === "completed" ||315+ state === "failed" ||316+ state === "error" ||317+ state === "cancelled"318+ );319+}320+321+export function grokWorkflowMemberTaskId(runId: string, agentId: string): string {322+ return `${runId}:wf:${agentId}`;323+}324+325+function memberFingerprint(agent: GrokWorkflowAgent, status: RuntimeTaskStatus): string {326+ return [327+ status,328+ agent.label,329+ agent.model ?? "",330+ agent.phase ?? "",331+ agent.tokensUsed,332+ agent.durationMs,333+ ].join("\u001f");334+}
- apps/server/src/provider/acp/GrokAcpSubagents.ts line 547Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +522,21 @@522+ update: GrokSubagentUpdate,523+): { readonly state: GrokSubagentTrackState; readonly events: ReadonlyArray<GrokTaskEventSpec> } {524+ const seenSubagentIds = new Set(state.seenSubagentIds);525+ const completedSubagentIds = new Set(state.completedSubagentIds);526+ const usageByTaskId = new Map(state.usageByTaskId);527+ const events: Array<GrokTaskEventSpec> = [];528+ const title = subagentTitle(update);529+ const linkage = {530+ taskId: update.subagentId,531+ description: title,532+ title,533+ taskType: "subagent",534+ role: update.role ?? "general-purpose",535+ ...(update.model ? { model: update.model } : {}),536+ ...(update.childSessionId ? { agentPath: update.childSessionId } : {}),537+ timelineBypass: true,538+ };539+540+ if (update.kind === "spawned" && !seenSubagentIds.has(update.subagentId)) {541+ seenSubagentIds.add(update.subagentId);542+ events.push({ type: "task.started", payload: linkage });
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
62d2ac96-5ae7-472e-9eaf-dba2d00349acYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Comment `@coderabbitai help` to get the list of available commands.