[BUG] Models frequently confused when switching between sessions in claude agents
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Regularly when working in several tabs, each tab running claude agents with --pwd in different project I notice Claude Code using a model set in one chat, in another, overriding previous choices. It 'confuses' the model you want for each chat.
For example:
agentssession A in~/repos/projA- I've got 5 chats going using a mix of Opus and Sonnetagentssession B in~/repos/projB- I've got 10 chats going using a mix of Opus and Sonnet
In a new, 6th chat in session A I /model opus and then later I switch to a Sonnet session in session B. That session is now using Opus (and definitely shouldn't be!)
This is affecting me a lot, for a long time I thought it was in my head but I've seen it more and more, it's a definite pattern. Could it be something about resuming an agent from background that loads an 'active' model that isn't reflective of the last model in use from the session history?
I've also noticed that /advisor settings sometimes travel between sessions, so an Opus advisor setting from my Sonnet session suddenly travels into my Fable session and I see an error about how Opus can't be an advisor to Fable.
What Should Happen?
The model being used should be religiously stored with and restored with the session. Model choices in one session shouldn't affect other sessions, including sessions being restored from the background e.g. after a reboot from claude agents.
Error Messages/Logs
Steps to Reproduce
This has been really hard to lock down. I'd try running two parallel claude agents sessions making sure to lock it down with --pwd to different project directories to get closest to my use case. And then setting models in various sessions, rebooting, restarting, restoring and making sure the models always stay as they should.
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.207
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗