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
The #373 delivery-record sweep can delete a live session's record, because a session's transcript does not exist yet when the hook runs #393
Found by the round-one release audit of v0.22.0..HEAD before tagging 0.23.0.
Symptom
With handoff_mode: "per_session", one session starting can delete another, still-live session's remember.delivered.<session_id> record. The live session's delivery counter then resets, and a handoff it has already been shown reads as a first delivery.
Location
scripts/session-start-hook.sh:1057-1067 -- the sweep added by #373. Its coupling is stated in its own comment at scripts/session-start-hook.sh:1030-1040: transcript absent under $SESSIONS_DIR implies the session is gone.
The same file states the opposite at scripts/session-start-hook.sh:100-108, load-bearing for #270:
at source=startup Claude Code creates that transcript AFTER this hook has run
Mechanism
Between a session writing its delivery record (scripts/session-start-hook.sh:1012) and Claude Code creating that session's transcript, a live session is indistinguishable from a dead one by the only signal the sweep consults. Any other session starting inside that window deletes the live session's record. The self-skip at scripts/session-start-hook.sh:1063 protects only the current invocation, not a concurrent one.
test_record_for_a_session_with_no_transcript_is_pruned proves the deletion fires on exactly this shape -- the test is correct, the coupling is what is too coarse.
The cost is bounded and is not data loss: the record is bookkeeping, and remember.<session_id>.md survives by design (#221). What is lost is the counter's accuracy, which is the whole point of #341's work in the same delta.
What would settle it
Whether the record's own mtime can arbitrate: a record younger than the startup window is not evidence of a dead session, whatever the transcript says. If that holds, the sweep gains a third state it currently lacks -- pruned, kept because the transcript exists, and kept because the record is too young to judge.
A test needs two sessions: one whose record is fresh and whose transcript does not exist yet (must not be pruned) paired against one whose record is old and whose transcript is gone (must be pruned).
Activity
fix: the #373 delivery-record sweep can no longer prune a live sessio…
fix: session-start-hook.sh no longer prunes a live delivery record on…