Skip to content

feat(cli): parallel subagents#10893

Open
uinstinct wants to merge 16 commits intocontinuedev:mainfrom
uinstinct:cli-parallel-subagents
Open

feat(cli): parallel subagents#10893
uinstinct wants to merge 16 commits intocontinuedev:mainfrom
uinstinct:cli-parallel-subagents

Conversation

@uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Feb 27, 2026

Description

add parallel subagents

requires #10830 to merged first

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Continue Tasks: ❌ 7 failed — View all


Summary by cubic

Enables parallel subagent execution in the CLI with isolated per-run context and live streaming output. Adds a parallel task runner and built-in Navigator and Generalist subagents, and shows each subagent’s output live (including parallel runs).

  • New Features

    • SubAgentService scopes system messages and tool permissions per execution, streams per-subagent events, and blocks nested subagent calls.
    • SubagentParallel tool runs multiple subagents concurrently and returns aggregated results.
    • Built-in subagents: Navigator and Generalist; auto-added when using Anthropic with direct API keys.
    • SubAgentOutput TUI renders live, separate output for each subagent, including parallel runs; tool results remain separate.
  • Refactors

    • Replaced executor with SubAgentService, registered in the service container; unified config with built-in subagents and per-subagent LLM APIs; refined subagent tool description.
    • Removed the subagent beta flag and CLI option; tools are enabled by default. When ChatHistoryService is disabled, tool results/status are written to local chat history.

Written for commit 698e237. Summary will update on new commits.

@uinstinct uinstinct force-pushed the cli-parallel-subagents branch from 142bc50 to c65c213 Compare March 2, 2026 13:19
@uinstinct uinstinct marked this pull request as ready for review March 2, 2026 16:01
@uinstinct uinstinct requested a review from a team as a code owner March 2, 2026 16:01
@uinstinct uinstinct requested review from sestinj and removed request for a team March 2, 2026 16:01
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Mar 2, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

4 issues found across 20 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="extensions/cli/src/services/SubAgentService.ts">

<violation number="1" location="extensions/cli/src/services/SubAgentService.ts:127">
P2: Parallel subagent executions race on the global chatHistorySvc.isReady override, so completion order can restore a stale override and leave chat history disabled or re-enable it while another subagent still runs.</violation>
</file>

<file name="extensions/cli/src/tools/subagent.test.ts">

<violation number="1" location="extensions/cli/src/tools/subagent.test.ts:5">
P2: The updated import now points to `getAgents.js`, but the test still mocks `get-agents.js`, so Vitest won’t apply the mock and the test will call real implementations. Update the mock path to match the import specifier.</violation>
</file>

<file name="extensions/cli/src/ui/components/SubAgentOutput.tsx">

<violation number="1" location="extensions/cli/src/ui/components/SubAgentOutput.tsx:57">
P2: `contentLines` grows without bound even though only the last 15 lines are rendered, which can lead to unnecessary memory usage and O(n) updates for long-running or chatty subagents.</violation>
</file>

<file name="extensions/cli/src/ui/ToolResultSummary.tsx">

<violation number="1" location="extensions/cli/src/ui/ToolResultSummary.tsx:119">
P2: Removed Subagent-specific summary handling while Subagent outputs still include `<task_metadata>` tags. The generic summary now surfaces raw metadata (or only line/char counts) and loses the prior “Subagent executing…” state for metadata-only updates, regressing the user-facing CLI summary.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

: undefined;

if (chatHistorySvc && originalIsReady) {
chatHistorySvc.isReady = () => false;
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 2, 2026

Choose a reason for hiding this comment

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

P2: Parallel subagent executions race on the global chatHistorySvc.isReady override, so completion order can restore a stale override and leave chat history disabled or re-enable it while another subagent still runs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/services/SubAgentService.ts, line 127:

<comment>Parallel subagent executions race on the global chatHistorySvc.isReady override, so completion order can restore a stale override and leave chat history disabled or re-enable it while another subagent still runs.</comment>

<file context>
@@ -0,0 +1,277 @@
+          : undefined;
+
+      if (chatHistorySvc && originalIsReady) {
+        chatHistorySvc.isReady = () => false;
+      }
+
</file context>
Fix with Cubic

import { executeSubAgent } from "../subagent/executor.js";
import { getAgentNames, getSubagent } from "../subagent/get-agents.js";
import { subAgentService } from "../services/SubAgentService.js";
import { getAgentNames, getSubagent } from "../subagent/getAgents.js";
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 2, 2026

Choose a reason for hiding this comment

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

P2: The updated import now points to getAgents.js, but the test still mocks get-agents.js, so Vitest won’t apply the mock and the test will call real implementations. Update the mock path to match the import specifier.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/tools/subagent.test.ts, line 5:

<comment>The updated import now points to `getAgents.js`, but the test still mocks `get-agents.js`, so Vitest won’t apply the mock and the test will call real implementations. Update the mock path to match the import specifier.</comment>

<file context>
@@ -1,14 +1,17 @@
-import { executeSubAgent } from "../subagent/executor.js";
-import { getAgentNames, getSubagent } from "../subagent/get-agents.js";
+import { subAgentService } from "../services/SubAgentService.js";
+import { getAgentNames, getSubagent } from "../subagent/getAgents.js";
 
 import { subagentTool } from "./subagent.js";
</file context>
Fix with Cubic

...prev,
[data.executionId]: {
...agent,
contentLines: updatedLines,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 2, 2026

Choose a reason for hiding this comment

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

P2: contentLines grows without bound even though only the last 15 lines are rendered, which can lead to unnecessary memory usage and O(n) updates for long-running or chatty subagents.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/ui/components/SubAgentOutput.tsx, line 57:

<comment>`contentLines` grows without bound even though only the last 15 lines are rendered, which can lead to unnecessary memory usage and O(n) updates for long-running or chatty subagents.</comment>

<file context>
@@ -0,0 +1,132 @@
+          ...prev,
+          [data.executionId]: {
+            ...agent,
+            contentLines: updatedLines,
+          },
+        };
</file context>
Fix with Cubic

}

// Handle all other cases with text summary
const getSummary = () => {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 2, 2026

Choose a reason for hiding this comment

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

P2: Removed Subagent-specific summary handling while Subagent outputs still include <task_metadata> tags. The generic summary now surfaces raw metadata (or only line/char counts) and loses the prior “Subagent executing…” state for metadata-only updates, regressing the user-facing CLI summary.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/ui/ToolResultSummary.tsx, line 119:

<comment>Removed Subagent-specific summary handling while Subagent outputs still include `<task_metadata>` tags. The generic summary now surfaces raw metadata (or only line/char counts) and loses the prior “Subagent executing…” state for metadata-only updates, regressing the user-facing CLI summary.</comment>

<file context>
@@ -115,57 +115,6 @@ const ToolResultSummary: React.FC<ToolResultSummaryProps> = ({
-  }
-
   // Handle all other cases with text summary
   const getSummary = () => {
     // Check if this is a user cancellation first
</file context>
Fix with Cubic

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

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant