Skip to content

sessions: resume fails for sessions whose transcript was cleaned up — detect and mark as expired #135

Description

@grimmerk

Symptom

Some older sessions in the Sessions list fail to resume: CodeV launches claude --resume <uuid> but the session "no longer exists" (observed by the user during PR #132 testing, 2026-07-13).

Root cause (hypothesis, high confidence)

Claude Code prunes old transcripts (cleanupPeriodDays), but history.jsonl entries live longer — so the list (built from history.jsonl) can contain sessions whose transcript file is already gone. Measured on the reference machine: history.jsonl reaches further back than the oldest surviving transcript (~3 months). Such sessions render normally but cannot be resumed, and enrichment (title/branch/PR) silently finds nothing for them.

Proposed fix: detect + mark as expired

Detection is nearly free: the mtime-keyed enrichment cache (#134, PR #132) already stats every listed transcript — a missing file currently just continues. Record it instead:

  • Main: enrichment returns an additional expired: string[] (sessionIds whose transcript is missing) or a per-session flag.
  • Renderer: show a small gray expired badge; on click/Enter show a toast/hint ("transcript was cleaned up by Claude Code — can't resume") instead of launching a terminal that errors out. Keep the row searchable (first/last prompts still come from history.jsonl).
  • Optional extras: tooltip mentioning cleanupPeriodDays (users can raise it in Claude Code settings to retain more); minor-fold could also demote expired sessions.

Future tie-in

The Batch-2 FTS index (docs/session-finding-plan.md §5.2) persists transcript text, so expired sessions become readable (via the preview pane) even though they stay non-resumable — the plan already reserves an "expired" state for exactly this.

Cross-refs: PR #132, #134 (the stat pass this piggybacks on), plan §5.1/§5.2.

🤖 On behalf of @grimmerk — generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions