[mirror] feat: snapshot explore subagent tool entitlements#6
[mirror] feat: snapshot explore subagent tool entitlements#6yashwant86 wants to merge 15 commits intomm-base-24638from
Conversation
Revert the runtime parent-current MCP intersection for Explore chats. Block SendMessage MCP server ID updates on Explore children so the spawn-time snapshot stays immutable.
⚡ Risk Assessment —
|
| Files | Summary |
|---|---|
Explore Subagent MCP Snapshot Entitlementscoderd/x/chatd/chatd.gocoderd/x/chatd/subagent.gocoderd/x/chatd/subagent_catalog.go |
Implements immutable MCP tool snapshot for Explore subagents. Spawn-time snapshot persists on child chat; SendMessage ignores MCP updates for Explore chats. Root Explore chats strip external MCP tools at runtime; delegated children inherit parent's snapshot. External MCP tools now allowed in allowedExploreToolNames; workspace tools remain excluded. |
Provider Tool Filtering for Explore Chatscoderd/x/chatd/chatd.go |
Root Explore chats exclude all provider tools (web_search) at runtime. Delegated Explore children inherit web_search if model supports it; write-style provider tools blocked for all Explore chats. |
Test Infrastructure and Coveragecoderd/x/chatd/chatd_test.gocoderd/x/chatd/chatd_internal_test.gocoderd/x/chatd/subagent_internal_test.go |
Added comprehensive tests for Explore MCP snapshot persistence, root Explore runtime filtering, and SendMessage immutability. Added test helpers for model config with call options and MCP server config insertion. Updated allowedExploreToolNames test to verify external MCP tool inclusion and workspace tool exclusion. |
OpenAI Tool Serializationcoderd/x/chatd/chattest/openai.go |
Added optional Name field to OpenAITool struct for tools that serialize name at top level instead of nested in Function. |
Sequence Diagram
sequenceDiagram
participant User
participant SpawnAgent as spawn_agent Tool
participant ResolveSnapshot as resolveExploreToolSnapshot
participant CreateChild as createChildSubagentChat
participant RunChat as runChat
participant AllowedTools as allowedExploreToolNames
User->>SpawnAgent: Call with type=explore
SpawnAgent->>ResolveSnapshot: Get parent turn's MCP snapshot
ResolveSnapshot->>ResolveSnapshot: Filter by plan mode
ResolveSnapshot->>ResolveSnapshot: If parent is Explore, narrow to parent.MCPServerIDs
ResolveSnapshot-->>SpawnAgent: Return inheritedMCPServerIDs
SpawnAgent->>CreateChild: Pass inheritedMCPServerIDs in options
CreateChild->>CreateChild: Persist snapshot on child.MCPServerIDs
CreateChild-->>User: Child chat created
User->>RunChat: Process child chat turn
RunChat->>RunChat: If root Explore, strip external MCP configs
RunChat->>RunChat: If delegated Explore, use persisted snapshot
RunChat->>AllowedTools: Build allowed tool names
AllowedTools->>AllowedTools: Include external MCP tools (MCPToolIdentifier)
AllowedTools->>AllowedTools: Exclude workspace MCP tools
AllowedTools-->>RunChat: Return filtered tool names
RunChat-->>User: Chat response with filtered tools
Dig Deeper With Commands
/review <file-path> <function-optional>/chat <file-path> "<question>"/roast <file-path>
Runs only when explicitly triggered.
Mirror of upstream coder#24638 for benchmark. Do not merge.
Summary by MergeMonkey