fix: make spawned subagents follow the parent session's model - #115
Merged
Conversation
The spawn_agent tool created subagent sessions via session.prompt without passing a model, so they fell back to the model baked into the agent config at plugin startup. Switching models with /models only affects the running session, so subagents kept using the stale model and errored out after a rate limit. Capture the active model from each chat.message and replay it onto child sessions (including nested spawns like executor -> implementer).
SergioGen
force-pushed
the
fix/subagent-model-follow
branch
from
August 23, 2026 05:36
9da58cd to
fb01e92
Compare
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
# Conflicts: # src/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Subagents spawned via the spawn_agent tool create sessions through session.prompt without passing a model, so they fall back to the model baked into the agent config at plugin startup. Switching models with /models only affects the running session, so subagents keep using the stale model - after a rate limit they error out even though the user switched models.
Fix
Changes
Verification
Summary by cubic
Spawned subagents now follow the parent session's active model instead of falling back to the model baked in at plugin startup, which caused rate-limit errors after switching with
/models.chat.message, replay it ontospawn_agentchild sessions, and propagate it so nested spawns keep following it.micode.jsonkeep it—their override wins over the parent session's live model.session.deleted.src/session-model.tsand unit tests for the session-model map helpers.Written for commit c0323ab. Summary will update on new commits.