fix: propagate MCP config and prompt settings to delegate subagents#543
fix: propagate MCP config and prompt settings to delegate subagents#543
Conversation
…e subagents The delegate tool was creating subagents without MCP tools and with the wrong system prompt due to three missing pieces in the configOptions chain: 1. enableMcp/mcpConfig/mcpConfigPath were never added to configOptions in ProbeAgent.initializeTools(), so delegateTool's closure always captured the defaults (false/null). Subagents never loaded MCP tools. 2. promptType defaulted to 'code-researcher' in delegate.js, but that prompt type never existed in prompts.js. It fell back to 'code-explorer' which is explicitly READ-ONLY, causing delegates to refuse action tools. 3. customPrompt and completionPrompt were never passed to delegates, so user-configured system prompts were lost in subagents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR Overview: Fix MCP Config and Prompt Settings Propagation to Delegate SubagentsSummaryThis PR fixes three critical bugs where the
All three issues were present from inception—not regressions. The MCP forwarding PR (#375) added plumbing in Files ChangedCore Implementation
Test Updates
Architecture & Impact AssessmentWhat This PR Accomplishes
Key Technical ChangesBefore: After: Affected System Components
Component Relationshipsgraph TD
A[ProbeAgent Parent] -->|initializeTools| B[configOptions]
B -->|includes MCP & prompt settings| C[delegateTool]
C -->|closure captures config| D[delegate function]
D -->|creates| E[ProbeAgent Subagent]
E -->|uses MCP config| F[MCPXmlBridge]
E -->|uses prompt settings| G[System Prompt]
style B fill:#90EE90
style E fill:#FFB6C1
Scope Discovery & Context ExpansionDirect Impact
Indirect Impact
Related Files (Not Changed)
Testing Coverage
Root Cause AnalysisThe bugs originated from incomplete implementation in PR #375:
References
Metadata
Powered by Visor from Probelabs Last updated: 2026-03-20T18:05:48.962Z | Triggered by: pr_opened | Commit: ce8b9a0 💡 TIP: You can chat with Visor using |
✅ Security Check PassedNo security issues found – changes LGTM. ✅ Security Check PassedNo security issues found – changes LGTM. \n\nArchitecture Issues (3)
✅ Performance Check PassedNo performance issues found – changes LGTM. Powered by Visor from Probelabs Last updated: 2026-03-20T18:00:55.075Z | Triggered by: pr_opened | Commit: ce8b9a0 💡 TIP: You can chat with Visor using |
Summary
Fixes three issues where the
delegatetool created subagents that were missing critical parent configuration:enableMcp,mcpConfig,mcpConfigPathwere never added toconfigOptionsinProbeAgent.initializeTools(), so thedelegateToolclosure always captured defaults (false/null). Subagents never loaded MCP tools likeworkable-api.delegate()defaulted topromptType: 'code-researcher', but that prompt type never existed inprompts.js. It fell back tocode-explorerwhich is explicitly READ-ONLY ("You must NEVER create, modify, delete, or write files"), causing delegates to refuse action tools.customPromptandcompletionPromptwere never passed to delegates, so user-configured system prompts were lost in subagents.All three issues were present from inception — not regressions. The MCP forwarding PR (#375) added plumbing in
delegate.jsandvercel.jsbut missed wiringconfigOptionsinProbeAgent.js.Changes
npm/src/agent/ProbeAgent.js: AddedenableMcp,mcpConfig,mcpConfigPath,promptType,customPrompt,completionPrompttoconfigOptionsininitializeTools()npm/src/tools/vercel.js: DestructurepromptType,customPrompt,completionPromptfrom options and forward todelegate()callnpm/src/delegate.js: AcceptcustomPrompt,completionPromptparams; changedpromptTypedefault from'code-researcher'toundefined(inherits parent's default); pass all three to ProbeAgent constructorTesting
probe-agent-delegate.test.js: MCP config propagation (4 tests), prompt type propagation (5 tests)delegate-config.test.js,delegate-integration.test.js,delegate-limits.test.jsfor new parameters🤖 Generated with Claude Code