Backgrounding an interactive session mints a new, unlinked session id; if the handoff worker is killed before its first durable write, the agents-view tile resumes "fresh" and the original transcript is unreachable

Status Open
Maintainer reply None cached
Activity 1 comment · opened Jul 27, 2026

Preflight Checklist

  • [x] I have searched existing issues. Closest matches are the "blank-resume family": #76931 (reopen reuses same id, intact transcript never loaded — CLOSED completed), #75929 (worktree cold-reopen blank), #78135 (transcripts unresolvable at start). This report is a distinct variant: the background handoff mints a new, unlinked session id, so the failure occurs even though the reopen path is irrelevant.
  • [x] This is a single bug report.
  • [x] I am using the latest version of Claude Code.

What's Wrong?

Summary

When an interactive session is moved to the background, the daemon spawns the background worker under a freshly minted session id rather than resuming the originating interactive session. The job's sessionId and resumeSessionId are both set to this new id (self-referential); nothing in the job state records the source transcript's id.

If that handoff worker is stopped/killed before it writes its first durable response, no transcript is ever created for the new id. Reopening the tile from the agents view then shows:

Press enter again to restart this session fresh — it has no saved transcript (stopped before its first response)

The full originating conversation is intact on disk under the original id the whole time, but it is unreachable from the agents view because the job points only at the empty new id. This is a linkage/dispatch bug, not data lossclaude --resume <original-id> recovers everything.

This differs from #76931: there, the bg worker reuses the transcript's own id (so the fix is in the reopen probe). Here the id is new and never linked, so the source conversation is orphaned from the job regardless of the reopen path.

Environment

  • Claude Code v2.1.212 (daemon backend)
  • macOS · Darwin 25.5.0
  • No worktree involved; transcript never relocated.

Steps to Reproduce

  1. Start an interactive session and do substantial work (many turns).
  2. Rename it, then move it to the background from the session.
  3. Stop the background agent before it produces its first response.
  4. Quit and relaunch the agents view; select the tile to continue.
  5. Observe the "no saved transcript / restart fresh" message.

Observed Timeline (daemon.log, v2.1.212)

[2026-07-27T13:40:25.526Z]  interactive session 4e42f81e-30d3-4b09-a0cc-f961598f4e53 — last event (foreground ends)
[2026-07-27T13:40:29.330Z]  job f05df966 created (background handoff)
[2026-07-27T13:40:30.228Z]  [bg] bg spawned f05df966 (slash)       <- new id, NOT --resume 4e42f81e...
[2026-07-27T13:40:34.627Z]  [bg] bg settled f05df966 (killed)      <- killed before first response
[2026-07-27T14:02:19.510Z]  [bg] bg claimed-spare f05df966 (fleet) <- reopen -> blank/"no saved transcript"

4e42f81e-30d3-4b09-a0cc-f961598f4e53 never appears anywhere in daemon.log — the bg subsystem was never told about it.

Disk Evidence

  • projects/<proj>/4e42f81e-30d3-4b09-a0cc-f961598f4e53.jsonl — 1.6 MB, 348 lines, full ~2h conversation (11:29:22Z → 13:40:25Z). Intact.
  • projects/<proj>/f05df966-90c1-47e3-aa93-65cc079dd1d3.jsonldoes not exist (worker died before first write).
  • jobs/f05df966/state.jsonsessionId == resumeSessionId == f05df966-90c1-47e3-aa93-65cc079dd1d3 (the transcript-less id); name and queued intent preserved; no field references 4e42f81e-30d3-4b09-a0cc-f961598f4e53.

Expected

Backgrounding an interactive session should record the originating session's id as the job's resume target, so the tile resumes the real conversation — and a handoff worker that dies before writing should never leave the job pointing at a transcript-less id.

Suggested Fix (building on the #76931 thread)

  1. Root cause: the background handoff should set the job's resumeSessionId to the originating interactive session's id, not a new self-referential id.
  2. Fail-closed reopen (per the #76931 discussion): if transcript durability for the job's id is unresolved, never start mode: prompt under that id and never re-inject intent; resolve/adopt the true source transcript first.
  3. If a genuine fresh session is warranted, give it a new id so one id can't describe two dispatch histories.

Workaround

  • From a terminal: claude --resume 4e42f81e-30d3-4b09-a0cc-f961598f4e53 restores the full conversation.
  • Or edit jobs/f05df966/state.json, setting sessionId and resumeSessionId to 4e42f81e-30d3-4b09-a0cc-f961598f4e53 (a session that has a transcript); the agents-view tile then resumes correctly.

Related

#76931, #75929, #78135, #75590, #73361

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗