[BUG] Agent View: reopening a stopped/completed background session respawns with a new session-id, prior conversation is lost (v2.1.195, macOS)

Open 💬 5 comments Opened Jun 28, 2026 by ozwxy

Environment

  • Claude Code: v2.1.195 (latest stable)
  • Platform: macOS (Darwin 27.0)
  • Launch: background agents via Agent View (claude agents / fleet roster)

Summary

When a background session that has been stopped or completed is reopened from Agent View, Claude Code spawns a new session-id and only injects the original launch intent/prompt. The prior conversation is not carried over, so the session appears empty and the initial prompt is re-sent — effectively restarting the task from scratch.

This happens at sub-compact context sizes (a few KB of transcript), so it is unrelated to auto-compaction.

Reproduction

  1. Launch a background agent (e.g. via claude --bg or the agents view). Let it accumulate a real conversation.
  2. Stop / let the turn complete so the job leaves the working state (stopped or done in ~/.claude/jobs/<id>/state.json).
  3. Reopen that session from Agent View.
  4. The reopened session has a different session-id from the original, shows only the first prompt, and the conversation history is gone.

Evidence

The original conversation is not actually deleted — it still exists at ~/.claude/projects/<project>/<original-session-id>.jsonl (large file). What gets created on reopen is a stub transcript under a new session-id containing only metadata (system, mode, ai-title, agent-name, agent-setting, permission-mode) with zero user/assistant message entries:

$ wc -l < .../<stub-id>.jsonl
8
$ # type breakdown: system / system / last-prompt / ai-title / agent-name / agent-setting / mode / permission-mode

Meanwhile the original (e.g. ~900 KB, dozens of messages) remains intact under the old id. ~/.claude/jobs/<id>/state.json records only linkScanPath pointing at the session's own transcript — there is no parentId / respawnOf field linking the stub back to the original conversation.

~/.claude/daemon/roster.json shows live workers correctly launched with launch.mode: "resume" and the right sessionId/transcriptPath, so attaching to a still-running background session works fine. The regression is specific to reopening a stopped/completed session.

Expected

Reopening a stopped/completed background session should resume the original transcript (same session-id, full history), not spawn an empty stub with a new id.

Workaround

claude --resume <original-session-id> restores the full conversation. Users must manually locate the original id from ~/.claude/projects/<project>/*.jsonl.

Related

  • #71729 (history silently lost on restart — Claude doesn't detect the gap; Windows/Desktop variant of the same symptom)
  • #65969 (auto-injected "Continue from where you left off" synthetic turn)
  • #27242 (data preserved but UI inaccessible)
  • changelog 2.1.193 / 2.1.195 partially address background-job data loss but this reopen path still regresses on 2.1.195

Happy to provide sanitized copies of the stub vs. original transcripts if useful.

View original on GitHub ↗

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