FE-899: Subagent integration#239
Conversation
PR SummaryMedium Risk Overview The new Reviewed by Cursor Bugbot for commit 7655623. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 03f3ee9. Configure here.
There was a problem hiding this comment.
Pull request overview
Introduces the first Brunch “subagents” implementation as a default-off Pi extension: bundled markdown agent definitions + config, a sealed in-process SDK child-session runner, and an opt-in subagent tool wired through createBrunchPiExtensions when runtime deps are provided.
Changes:
- Adds
.pi/extensions/subagentswith agent/config loaders, sealed child-session execution (runSubagent), registrar (registerBrunchSubagents), and a comprehensive test suite. - Adds an app-layer composition root (
loadBrunchSubagents) to assemble sealed deps withoutsrc/appimports from.pi/. - Extends
createBrunchPiExtensionsto optionally register/advertise thesubagenttool via the existing opt-in tool channel; updates build assets copying.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/pi-subagents.ts | App composition root that loads bundled subagent definitions/config and returns sealed deps. |
| src/app/pi-extensions.ts | Adds optional subagent opt-in wiring: allowed-tool opt-in union + conditional registrar registration/export. |
| src/.pi/extensions/subagents/subagents.test.ts | Tests for parsing/loading/config, model resolution, tool planning, semaphore, registrar behavior, and sealed child-session E2E via faux provider. |
| src/.pi/extensions/subagents/session.ts | Implements sealed SDK child-session runner (resolveSubagentModel, planSubagentTools, runSubagent). |
| src/.pi/extensions/subagents/README.md | Topology/hand-off documentation for the subagents extension and wiring guidance. |
| src/.pi/extensions/subagents/index.ts | Registers the subagent tool, fan-out execution with bounded concurrency, and formats results. |
| src/.pi/extensions/subagents/config.ts | TypeBox-validated loader/parser for bundled subagent config.json. |
| src/.pi/extensions/subagents/agents/scout.md | Bundled read-only “scout” agent definition. |
| src/.pi/extensions/subagents/agents/researcher.md | Bundled “researcher” agent definition (web tools). |
| src/.pi/extensions/subagents/agents/proposer.md | Bundled tool-less “proposer” agent definition. |
| src/.pi/extensions/subagents/agents.ts | Markdown frontmatter + body parser and directory loader for bundled agent definitions. |
| src/.pi/extensions/README.md | Updates extensions index to reflect the now-real subagents extension. |
| package.json | Extends build:pi-assets to ship subagent markdown agents + config into dist. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const separator = line.indexOf(':'); | ||
| if (separator === -1) { | ||
| throw new Error(`malformed frontmatter line (expected "key: value"): ${rawLine}`); | ||
| } | ||
| const key = line.slice(0, separator).trim(); | ||
| fields[key] = line.slice(separator + 1).trim(); | ||
| } |
| > **Status (handoff doc):** mechanism **built + verified**, but **not yet wired | ||
| > into startup** — the `subagent` tool is present-but-dead in every build until a | ||
| > launch path passes `subagents` to `createBrunchPiExtensions(...)`. This README | ||
| > is intentionally fatter than the sibling topology READMEs because the feature |
| async execute(_toolCallId, params: Params, signal, _onUpdate, ctx) { | ||
| const requested = | ||
| params.tasks ?? (params.agent && params.task ? [{ agent: params.agent, task: params.task }] : []); | ||
| if (requested.length === 0) { | ||
| return { | ||
| content: [ | ||
| { | ||
| type: 'text' as const, | ||
| text: 'subagent requires either { agent, task } or { tasks: [{ agent, task }, ...] }.', | ||
| }, | ||
| ], | ||
| details: { results: [] }, | ||
| }; | ||
| } |
03f3ee9 to
7655623
Compare
30ccdf9 to
1f0392b
Compare
Merge activity
|


Summary
subagentregistration backed by sealed in-process SDK child sessions.Verification
npm run verify