[BUG] One claude CLI session backgrounds and/or gets confused with another session
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?
I have several long running claude code sessions, e.g.:
- coder
- reviewer
- tester
Each has a specific SKILL.md file and is used as that persona only.
One day I asked "coder" to run full context, i..e do the code, then create sub-agents with the tester and reviewer skills, to tackle a bug.
Later on, I attempt to start the standalone "reviewer" session, and it could not be found; i.e. claude -r reviewer $\rightarrow$ "No sessions match reviewer"
Upon investigating with the /resume command, I see two sessions named "coder". Attempting to start the one with the longer idle time gives me a "this is a background session" message, and to use claude attach or claude stop to use it.
I issue the claude stop, then resume the session, and lo and behold it is the "reviewer" session.
What Should Happen?
Sessions should not be arbitrarily renamed and backgrounded.
Error Messages/Logs
None
Steps to Reproduce
May be intermittent:
- Try creating several standalone sessions with a particular skill
- Then in a separate session have session tackle a large task with the same skills
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.282, possibly before as well
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
iTerm2
Additional Information
See also #97232 , unclear which issue comes first or whether they are related.