Skip to content

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

Description

@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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agent-viewclaude agents TUI / --bg / FleetView / daemon bg sessionsbugSomething isn't workingplatform:macosIssue specifically occurs on macOS

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions