Keep sub-agent spawns on the provider a live model switch picked - #474
Merged
Conversation
Provider, catalog, and settings were three snapshots seeded once at session start, each relying on every switch path to remember to refresh it. A mid-session model switch refreshed none of them, so workers spawned afterward kept running against the provider the operator had already switched away from, and tier settings written mid-session stayed invisible. All three now derive from the live config binding on each spawn, so no cache is left to go stale.
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.
Closes CL-5902.
Problem
Switching models mid-session updated the parent session but not the sub-agent wiring. The provider, model catalog, and settings a spawn reads were three snapshots taken once at session start, each relying on every switch path to remember to refresh it — and the model picker's switch handler refreshed none of them.
Observed live while driving a fleet: the parent moved to a healthy provider, workers kept spawning against the exhausted one, and the only recovery was restarting the session. The same staleness hid mid-session tier settings from workers, and a session that started with no settings could never see any.
Fix
Provider, catalog, and settings all derive from the live session config at spawn time, through a single owner. The mutable snapshots are gone, so there is no cache left for a future switch path to forget.
Verification
Note on scope
This branch is the remainder of the follow-up round after PRs #470–473 landed the same four issues from another session. Everything already on main was dropped; only this fix was unique.