Skip to content

fix: spawn tool now respects target agent's model config#1356

Closed
treepudding wants to merge 1 commit intosipeed:mainfrom
treepudding:fix/spawn-model-resolver
Closed

fix: spawn tool now respects target agent's model config#1356
treepudding wants to merge 1 commit intosipeed:mainfrom
treepudding:fix/spawn-model-resolver

Conversation

@treepudding
Copy link
Copy Markdown

Summary

Fixes #1322

Previously, when spawn tool was called with agent_id parameter, the subagent would use the caller agent's model instead of the target agent's configured model.

Changes

  • Add modelResolver field to SubagentManager
  • Add SetModelResolver() method to inject model resolution function
  • In runTask(), use target agent's model when agent_id is specified
  • Add test case for model resolver functionality

Test Plan

  • All existing tests pass (go test ./pkg/tools/... ./pkg/agent/...)
  • New TestSubagentManager_ModelResolver test passes
  • Build succeeds (go build ./...)

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 11, 2026

CLA assistant check
All committers have signed the CLA.

@sipeed-bot sipeed-bot bot added type: bug Something isn't working domain: tool domain: agent go Pull requests that update go code labels Mar 11, 2026
Fixes sipeed#1322

Previously, when spawn tool was called with agent_id parameter, the
subagent would use the caller agent's model instead of the target
agent's configured model.

Changes:
- Add modelResolver field to SubagentManager
- Add SetModelResolver() method to inject model resolution function
- In runTask(), use target agent's model when agent_id is specified
- Add test case for model resolver functionality

Test Plan:
- All existing tests pass
- New TestSubagentManager_ModelResolver test passes
@treepudding treepudding force-pushed the fix/spawn-model-resolver branch from a21f7a9 to cdbd09b Compare March 11, 2026 09:47
@putueddy
Copy link
Copy Markdown
Contributor

Cherry-picked cleanly. The fix ensures subagents spawned with agent_id use the target agent's configured model instead of inheriting the caller's. All tests pass including the new TestSubagentManager_ModelResolver. Tested on Pi 4, ARM64, v0.2.1.

@treepudding
Copy link
Copy Markdown
Author

@alexhoshina Hi,this PR is waiting for CI approval. Could you please approve the workflow run? Thanks!

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

Labels

domain: agent domain: tool go Pull requests that update go code type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] spawn ignores target agent model and always uses caller model

3 participants