Session chain links break on force-kill; sidechain/subagent sessions clutter resume list
Problem
Two issues with the session resume list that are not covered by the sessions-index.json desync bugs (#22205, #22114):
---
1. Session chain links break permanently when parent is force-killed
Sessions are chained via parentUuid → leafUuid (written in the summary entry). When a parent session is force-killed before writing a summary, its leafUuid is never persisted, permanently breaking the chain for any child session that was resumed from it.
Data from a real project (322 sessions):
- 43 sessions have a
parentUuid(are continuations of a prior session) - Only 19 resolve to a parent session (44% success rate)
- 24 sessions are permanently orphaned — their
parentUuidpoints to aleafUuidthat was never written
Root cause: The summary entry (which contains leafUuid) is only written on clean exit. Force-kill (terminal closed, system freeze, kill -9) means no summary → no leafUuid → broken chain.
Suggested fixes:
- Write
summary/leafUuidon SIGINT/SIGTERM before exiting - Write intermediate summaries more frequently (already happens during long sessions, but not reliably at the end)
- When resolving chains, fall back to matching by
sessionIdifleafUuidlookup fails - Show orphaned sessions as standalone roots rather than hiding them
---
2. Sidechain/subagent sessions clutter the resume list
Plugin-spawned sessions (MCP observers, subagents, warmup sessions) have isSidechain: true and filenames prefixed with agent-, but they still appear in the resume list alongside real user sessions.
Data from same project:
- 192 of 322 sessions (59%) are sidechains (
isSidechain: true,agent-prefix) - 34 of those are just "Warmup" messages with no useful content
- These make it difficult to find actual work sessions in the list
Suggested fix:
- Filter sessions with
isSidechain: trueoragent-prefixed IDs from the default/resumelist - Optionally show them behind a flag like
--allor in a separate section
---
Environment
- Claude Code CLI (Opus 4.5)
- macOS Darwin 23.6.0
- 322 sessions in project directory (130 user, 192 sidechain)
- Plugins: claude-mem (spawns observer sidechains via hooks)
Related
- #22205 and #22114 cover the
sessions-index.jsondesync issue (sessions missing from index entirely). This issue is about chain integrity and list filtering, which are separate problems.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗