[BUG] Backgrounding a session creates a new session ID without the conversation transcript, despite docs saying history is preserved

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 2 comments · opened Jul 30, 2026

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?

Interupting a tool use session and then sending it to the background, then resuming the session gives no conversation history. New self-referential session ID with a title-only stub; the full conversation stays behind under A with nothing linking the job to it.

Converting an interactive session to a background job (the & / /background flow, job state.json "template": "bg") creates the job under a new session ID and does not carry the conversation transcript. The /background command reference states "Conversation Preserved: The full conversation history is retained in the background session" — observed behavior contradicts this. Opening the job later shows an empty chat, which presents as data loss (the original transcript is actually intact under the old session ID, but nothing points to it).

What Should Happen?

Either the background job continues session A (same ID, same transcript — matching the docs), or resumeSessionId points at A so the job loads A's history.

Error Messages/Logs

Steps to Reproduce

  1. Interactive session A runs for hours in ~/.claude/projects/<proj>/A.jsonl (~1 MB).
  2. User interrupts a tool call, then sends the session to the background.
  3. A job is created with a fresh ID B; its state.json has "sessionId": B, "resumeSessionId": B (self-referential - it never points at A), "template": "bg", and "intent" set to the interrupt marker text from A's tail.
  4. The conversion does carry over: the ai-title/agent-name (written into a ~300-byte B.jsonl), the permission mode, and the entire ~/.claude/file-history/A/ directory (hardlinked into file-history/B/ — same inodes, link count 2).
  5. It does not carry the transcript. B.jsonl stays a 300-byte stub containing only the ai-title/agent-name lines.
  6. When the user later opens job B, the stub is orphaned (renamed B.orphaned-<epoch-ms>-<rand>.jsonl) and a fresh empty transcript starts. The chat renders empty.

Claude Model

Other

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.220 (Claude Code)

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

Possibily related to #79757 , #58725

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗