[BUG] /background mid-turn silently drops the in-flight turn in the forked bg 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?
When I call /background (or /bg) on a brand-new session while the first turn is still in flight, two things happen:
- The foreground
claudeprocess exits immediately. - The backgrounded session, when reattached via Agent View, shows the first user message but no processing is happening — the turn that was in flight is silently dropped. To make progress I have to re-send the message manually in the bg session.
The bg session is created successfully (it shows up in Agent View) — this is not "bg failed" — but the in-flight work it inherited is frozen.
What Should Happen?
Either:
- The in-flight turn that the foreground was processing should resume automatically in the bg session, or
/backgroundshould not be accepted while a turn is in flight (block with a hint to wait for the current turn to finish).
Right now there's no warning and the user only notices that the bg session is stuck after attaching to it.
Error Messages/Logs
No errors. The foreground exits cleanly with the usual "Session backgrounded" message.
Steps to Reproduce
- Launch
claudefresh (no-r, no-w). - Send your first message — Claude starts processing the turn.
- While the turn is still streaming, run
/background(no argument). claudeexits immediately. ✓ (expected — this is the documented "free the terminal" behavior)- Start
claudeagain and open Agent View (claude agents), or reattach to the bg session from anotherclaudeprocess. - Open the backgrounded session: your first user message is there, but nothing is happening — no spinner, no streaming, no tool calls. The session is idle at the first message.
- To get any output you must send a new message in the bg session.
Claude Model
Not relevant (reproduces regardless of model)
Is this a regression?
I don't know — I started noticing it on 2.1.150 but I haven't tested earlier versions for this specific case.
Last Working Version
Unknown
Claude Code Version
2.1.150
Platform
Anthropic API
Operating System
macOS (Darwin 25.5.0)
Terminal/Shell
zsh (macOS Terminal / iTerm2)
Additional Information
The user data isn't lost (the user message stays in the transcript) but the work — the assistant turn that was running — is silently dropped instead of being resumed in the bg session. The only way to recover is to re-type or re-send the message after attaching to the bg session.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗