SIGN IN SIGN UP

fix(hook): resolve Claude transcript by session id (#1415)

* fix(hook): resolve Claude transcript by session id

* fix(hook): keep annotate-last fallbacks for fresh and mid-write sessions

- cwd scan: skip session records whose transcript does not exist yet, so a
  freshly opened session in the same directory no longer shadows the active
  one; an ambiguous transcript still stops the scan.
- /clear detection: ignore unrelated unreadable or invalid sessions/*.json
  instead of treating the whole registry as unknown; a record that names the
  session still counts as registering it.
- ancestor metadata: retry a failed read once, then fall back to the cwd scan
  instead of blocking.
- annotate-last: print a specific stderr line when metadata is unreadable or
  the identified session has no transcript.
- Replace the index.ts source-text test with behavior tests.

* fix(hook): keep own transcript when sibling metadata stays unparsable

Retry a sessions/*.json that fails to parse once during /clear detection.
If it is still unparsable, treat registration as unknown and keep the
session's own transcript, so a sibling caught mid-rewrite can never be
mistaken for a /clear leftover. Records that parse but lack fields still
match on sessionId. Reword the blocked-metadata stderr line.

---------

Co-authored-by: Michael Ramos <mdramos8@gmail.com>
R
rNoz committed
33e12ad71c793a2e56fc1c5c263dd98b08b419b6
Parent: 618172c
Committed by GitHub <noreply@github.com> on 9/23/2026, 7:51:29 PM