-
Notifications
You must be signed in to change notification settings - Fork 2.3k
refactor: subagents as platform extension (enables subagents in code mode) #6160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
/goose trying to make |
|
Summary: This PR refactors the subagent tool from a special case in ✅ Highlights
🟢 Suggestions
Overall: This is well-architected. The move to a platform extension is the right call for consistency and enabling code_execution integration. The implementation follows project patterns and has good defensive checks. Approve once you're happy with the working_dir behavior. Review generated by goose |
|
/goose |
|
Summary: This PR refactors the subagent tool from a special case in 🟢 Suggestions
✅ Highlights
Review generated by goose |
| } | ||
|
|
||
| #[async_trait] | ||
| impl McpClientTrait for SubagentClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a thought (not feedback on this PR)
We could probably benefit from an extension construct that isn't necessarily an MCP extension. We're making good use of the platform extension construct, but having them "pretend" to be MCP servers results in us needing some odd code like this.
| let mut result = client | ||
| .lock() | ||
| .await | ||
| .call_tool_deferred(&tool_name, arguments, cancellation_token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of a new function, how about changing this so that McpClientTrait::call_tool always returns a notification stream, with the default impl calling .subscribe()?
I'm also seeing that all of the platform extensions just return a dummy channel for subscribe, but ToolCallResult has an Option for the notifcations stream, so it would make more sense to have the trait fn itself return an Option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good idea, but I don't necessarily want to do it in this PR.
…t renamed to DeferredToolCall
|
/goose |
PR #6160: refactor: subagents as platform extension (enables subagents in code mode)Summary: This PR successfully refactors the subagent tool from special-case handling in ✅ Highlights
🟢 Suggestions
Review generated by goose |
|
I think I need to make goose reviewer even more critical |
Moves the subagent tool from being a special case in
Agent::dispatch_tool_callto a proper platform extension, following the same pattern as todo, skills, chatrecall, and code_execution extensions.Motivation
code_execution- this change enables subagent delegation from JavaScript codeChanges
SubagentClientimplementingMcpClientTraitcall_tool_deferredtrait method allowing extensions to return deferred futures (with sensible default for sync tools)PlatformExtensionContextextended withworking_dirandsub_recipesTaskConfigsimplified (session/working_dir now obtained from context)sub_recipeschanged fromMutextoArc<RwLock>for shared read access"path"to"module_path"inhandle_read_modulefixes a pre-existing bug where the code looked for"path"but the schema definedmodule_path.