[BUG] --resume <id> --bg forks the session even without --fork-session

Status Open
Reported on v2.1.228
Maintainer reply ✓ Yes — claude[bot]
Activity 6 comments · opened Aug 12, 2026
💡 Likely answer: A maintainer (claude[bot], contributor) responded on this thread — see the highlighted reply below.

What happens. claude --resume <session-id> --bg starts a new session with a new id. The original stays asleep, untouched and unreachable.

What I expected. The original session to wake and keep its id. --help documents --fork-session as "When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)" — which states that reusing the original is the default and forking is opt-in. I did not pass --fork-session, so I did not expect a fork.

Why the distinction matters. A fork is not a slightly-different success. It splits ownership: the original holds the history and is what every other reference points at, while the fork is a second session that knows the same past and diverges from that moment on. If I wanted the original awake, I now have two sessions with a claim on the same work and no way to merge them.

The workflow this blocks. I run a fleet of long-lived sessions, each owning one piece of work, and they hand context to each other with cross-session messaging. A sleeping session cannot receive a message, so a handoff needs it woken first — and the only route available forks it, which is exactly the outcome I am trying to avoid. The practical result is that the sessions I most need to reach are the ones I cannot reach: the ones idle longest are both the most likely to be running on a stale picture and the only ones that require waking.

Reproduction.

1. Start a session, note its id, let it go to sleep.
2. claude --resume <id> --bg        # no --fork-session
3. `claude agents` shows a new session with a different id;
   the original is still listed as asleep.

What would fix it. Honour the documented default — --resume --bg without --fork-session reattaches to the existing id. If forking is deliberate for the background path specifically, then --fork-session's description is wrong and should say so.

Version. 2.1.228, macOS.

Related: #79830 (compact fork-resume retires the session id) and #76493 (resuming from the Agent View forks) report the same behaviour on other paths, which suggests it is systemic rather than specific to this invocation. #84058 requests agent-to-agent messaging with wake-on-delivery, which would make waking unnecessary — but that is a much larger request, and this is one behaviour that can be fixed on its own. #86082 is the other half of the same workflow problem: not being able to tell from the agent list which sessions are asleep in the first place.

View original on GitHub ↗

3 Comments

claude[bot] contributor · 1 month ago

Confirmed / reproduced on 2.1.235 (Linux): with an idle saved session <id> (not running anywhere), claude --resume <id> --bg "next prompt" — no --fork-session — prints backgrounded · 34096d1c and the work runs under a brand-new session id: claude agents --json --all lists the new id as a separate background row (carrying the original's name), a new transcript containing the copied history plus the new prompt is written, and the original transcript is left untouched. claude --help on the same build still describes --fork-session as "When resuming, create a new session ID instead of reusing the original", so the background path forks regardless of that flag, as described.

🤖 Generated with Claude Code

---
_Generated by Claude Code_

lilysttail · 1 month ago

Adding a new path where this same forced fork happens, with launch-command evidence — this one triggers without any user invocation at all.

Setup: Windows 11, CLI 2.1.227, a long-running local session driven by plugin:telegram@claude-plugins-official, with a user-created native scheduled task (self-paced wake) in that session. The session process is kept alive by a local watchdog (restarts it when unhealthy).

Observed: At 2026-08-20 06:36Z a scheduled-task self-wake did not continue the authoritative session. The daemon-generated launch command (captured before cleanup) was:

--session-id <new-id> --fork-session --resume <path>\<authoritative-id>.jsonl --channels plugin:telegram@claude-plugins-official

So on this path the fork is decided at launch-command generation time — --fork-session is injected by the daemon itself; no user ever passed it. Runner job metadata: selfWake=true, inFlight.kinds includes session_cron, roster launch mode=resume, fork=true, restoresTranscript=true.

Cost/impact detail worth adding to this issue: the forked session's first API call logged cache_miss_reason.type=previous_message_not_found, cacheRead=0, cacheCreate=766,613 tokens — i.e. every occurrence of this fork rebuilds the full context at the user's expense, on top of the identity split described above (our channel/observer still pointed at the original id while the task ran in the fork).

Consistent with your systemic reading (#79830, #76493): background-path resume forks by default, contrary to the documented opt-in. The scheduled-task self-wake path makes it worse because no human is present to notice the split.

marcindulak · 19 days ago

For your information: the label reproduced on this issue does not prevent it from becoming stale and eventually auto-closed. See https://github.com/anthropics/claude-code/issues/87647 for details, and consider upvoting that for visibility.

This means to avoid auto-closing, this issue needs to acquire at least 10 thumbs up, or get new comments every time before the 14 days stale bot interval expires.

Showing cached comments. Read the full discussion on GitHub ↗