You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(restore): a backgrounded session is restored from its pre-fork transcript #518
Restoring the open sessions after a restart resumed a conversation's pre-backgrounding transcript instead of its continuation, so the session came back without its last four days.
Measured on Windows (v0.0.91), 09/10:
05/10 21:20 local: session 7615734f-… was backgrounded from its terminal ("Backgrounding after the current tool finishes…"). The conversation continued under a new id, e7abbcdc-…, whose transcript starts at 05/10 19:21:21Z and was last written 09/10 15:45:28Z.
After the app restart, restore launched claude --resume 7615734f-… --permission-mode auto --ide. That transcript ends 05/10 21:20. No process ran under e7abbcdc-… any more.
The resumed CLI printed "Remote Control not started here · another Claude Code on this machine (started 3d ago) already has Remote Control for this conversation", although that process no longer existed.
Impact: the restored tab looks like the live session but has lost days of context; acting on it duplicates a session that is supposed to be unique.
Likely cause (not verified in code): the working set keeps the id recorded at launch, and backgrounding moves the conversation to a new id that nothing re-keys (the same class #477 handles for /clear).
Expected: before resuming a saved entry, follow the conversation to its current id (continuation chain), and never resume an id that has a newer continuation; at worst, ask instead of resuming silently.
The CLI's signal. Backgrounding appends {"type":"continued-in","sessionId":<old>,"continuedInSessionId":<new>} to the old transcript (7615734f, line 42050, 2026-10-05T19:21:12Z, right after "Backgrounding after the current tool finishes…"). A second one points to c1329340 (2026-10-08T20:23Z), so one id can have several continuations. The new transcript carries no back-link (sessionKind:"bg", no forkedFrom). The live link is the CLI descriptor ~/.claude/sessions/<pid>.json, whose sessionId changes (measured after an in-CLI /resume: pid 9368 now reads e7abbcdc).
Why no re-key. The only re-key path is session-transitions.js detectSessionTransitions (~330-430): a new jsonl is re-keyed only when forkedFrom matches (:395), otherwise "NO MATCH" (:409). A bg continuation has no forkedFrom, and /resume creates no file, so session-forked is never sent and the tab stays keyed on the launch id. The PTY itself stayed alive for four days (OSC 9 from 7615734f in main.log), so persistWorkingSet (public/app.js:175-200) kept writing 7615734f, and the trigger watcher logged "Session not found: e7abbcdc" on 06, 08 and 09/10. guardResume only checks whether the saved id is live elsewhere, which it was not.
B (now, separate PR): at restore, follow the saved id's continued-in chain main-side; one continuation → resume it and fix the saved entry; several → ask, never resume silently; a live bg continuation → attach. Red-first.
Activity
devsuitup commentedon Oct 9, 2026
Diagnosis (read-only, code at origin/main):
{"type":"continued-in","sessionId":<old>,"continuedInSessionId":<new>}to the old transcript (7615734f, line 42050, 2026-10-05T19:21:12Z, right after "Backgrounding after the current tool finishes…"). A second one points to c1329340 (2026-10-08T20:23Z), so one id can have several continuations. The new transcript carries no back-link (sessionKind:"bg", noforkedFrom). The live link is the CLI descriptor~/.claude/sessions/<pid>.json, whosesessionIdchanges (measured after an in-CLI/resume: pid 9368 now reads e7abbcdc).session-transitions.js detectSessionTransitions(~330-430): a new jsonl is re-keyed only whenforkedFrommatches (:395), otherwise "NO MATCH" (:409). A bg continuation has noforkedFrom, and/resumecreates no file, sosession-forkedis never sent and the tab stays keyed on the launch id. The PTY itself stayed alive for four days (OSC 9 from 7615734f in main.log), sopersistWorkingSet(public/app.js:175-200) kept writing 7615734f, and the trigger watcher logged "Session not found: e7abbcdc" on 06, 08 and 09/10.guardResumeonly checks whether the saved id is live elsewhere, which it was not./clear((sessions): follow /clear to the new transcript instead of listing it apart #477), in-CLI/resume, and backgrounding: the PTY's conversation id changes while the PTY lives.Plan:
continued-inchain main-side; one continuation → resume it and fix the saved entry; several → ask, never resume silently; a live bg continuation → attach. Red-first.cli-session-state.js(already watched, 150 ms flush) for PTYs Switchboard spawned, reusing (sessions): follow /clear to the new transcript instead of listing it apart #477'sclearOwnerownership walk andrekeyedmap rather than a parallel path. Needs a measurement first: on Windows (pidDomain:"win32:anchor") the descriptor pid may not descend from the node-pty pid.test(restore): pin that restore follows a session's continued-in reco…
fix(restore): follow a session's continuation instead of resuming the…
devsuitup commentedon Oct 9, 2026
Part B is merged in #520: restore and manual open now follow
continued-in.Part A (live re-key from the CLI descriptor on
/resume//clear) waits for #477.Follow-ups from the last review, not blocking:
liveElsewhereCheckedignoresscheduledRuns.(restore): follow a session's continuation instead of resuming the pr…
(sidebar): test that a merged web-session row follows its live member