Repository navigation
Merged
Conversation
… never had a chance to service (#392) Two defects in doctor.sh's SessionEnd arm (#370), both found by the release audit measured against v0.22.0 on identical fixtures: 1. A quiet transcript predating this project's own .remember store was counted as proof SessionEnd never fired, when the hook was never even registered for that session. This both false-positived a healthy PostToolUse-working install and displaced the correct, actionable fresh-install remediation ("PostToolUse has never fired; restart Claude Code") behind a less useful SessionEnd message. 2. An unreadable transcript mtime was counted into the transcript total and `continue`d past the staleness question, so the WARN made a claim about files whose quietness was never established. REMEMBER_DIR's own mtime -- set once, the first time any hook bootstraps it for this project, and never touched by doctor.sh itself (a read-only report) -- is the earliest "remember became active here" signal available without new marker infrastructure. A transcript now only counts as evidence once it is at least that recent; an unreadable one is excluded and named separately rather than folded into either bucket. The genuine failure -- a session that ended after the store existed, with no session-end-*.log to show for it -- still FAILs and still outranks the generic "capture is working" verdict. Both fixtures from the issue's table are in the suite now, each paired with its must-fire control (the same transcript shape with the store correctly backdated ahead of it). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…aseline, not REMEMBER_DIR's own (#392) Self-review (Explore reviewer) caught a defect in the previous commit before it was pushed anywhere: REMEMBER_DIR's own mtime is not a stable "install time" signal. save-session.sh writes now.md via a mktemp created directly inside REMEMBER_DIR followed by mv over the existing file, and both operations update the directory's own mtime -- not just now.md's. On any project with ongoing captures this reads as "time since the last save", not "time since install", reopening almost the exact false-negative window the previous commit exists to close: verified locally that a genuinely 2-day-old store with one ordinary save 5 minutes prior read as installed 5 minutes ago. $REMEMBER_DIR/.gitignore is the fix: bootstrap-dirs.sh writes it exactly once, gated on it not already existing, and grepping the codebase turns up no other writer. Its mtime survives ordinary hook activity in a way nothing else under REMEMBER_DIR does. In external storage mode that file is never written at all ("no gitignore to write"), so the SessionEnd arm can currently only WARN there, never FAIL -- documented as a known gap rather than silently accepted. Adds a regression test (test_ongoing_saves_do_not_mask_a_genuine_failure) that reproduces the churn scenario directly and confirmed, against a scratch copy of doctor.sh with the REMEMBER_DIR-mtime baseline restored, that it fails exactly as expected -- pinning the defect the review caught rather than only the fix. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…etes it under migration (#392) Second review round (oss:auditor, re-spawned after a classifier flagged the first pass as referring to findings without stating them) found the previous commit's own comment overstated: "nothing else in this codebase writes to it" is false. hooks.d/after_save/50-git-backup.sh deletes exactly $REMEMBER_DIR/.gitignore as a one-time cleanup of the legacy bootstrap artifact, reachable whenever a legacy (in-project) store is later migrated to external mode with git backup enabled -- at which point git-backup's own "legacy mode never runs" guard no longer applies. bootstrap-dirs.sh's write is gated on the store being inside the project, so once external the file is never recreated. Functionally this does not make the fix worse than already documented: the fallback when the baseline is unavailable was already "no transcript can be attributed to after install" -> safe WARN, never a false FAIL, which is exactly what happens here too. What was wrong was the CLAIM that the marker survives forever -- it doesn't, in this one reachable shape -- and that claim was public in doctor.sh's own comment, README.md, and the changelog fragment. All three are corrected to describe the actual, narrower invariant and to name the gap explicitly rather than imply it cannot happen. The underlying capability gap (SessionEnd's genuine-failure detection is unavailable, not just for external-from-the-start stores but also for legacy-then-migrated-and-backed-up ones) is not fixed here: the fix belongs either in hooks.d/after_save/50-git-backup.sh (stop deleting the marker) or in a new marker doctor.sh could read that survives that cleanup, and hooks.d/after_save/50-git-backup.sh is outside this arm's own file and this lane. Filed for the maintainer rather than patched into an unrelated hook mid-lane. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
doctor.sh's
SessionEndliveness check (#370) FAILed on a healthy install that merely had prior Claude Code history in the project -- a quiet transcript predating the plugin's own store was read as proofSessionEndnever fired, when the hook was never even registered for that session. That FAIL also displaced the correct, actionable fresh-install remediation ("PostToolUse has never fired; restart Claude Code") behind a less usefulSessionEndmessage. A second, independent defect: an unreadable transcript mtime was counted into the transcript total andcontinued past the staleness question, so the WARN made a claim about files whose quietness was never established.A transcript now only counts as evidence once it is at least as recent as
$REMEMBER_DIR/.gitignore's own mtime -- written exactly once bybootstrap-dirs.sh, gated on it not already existing, and never rewritten by ordinary hook activity. Both fixtures from the issue's own before/after table are in the suite, each paired with a must-fire control. The genuine failure -- a session that ended after the store existed, with nosession-end-*.logto show for it -- stillFAILs and still outranks the generic "capture is working" verdict.Self-review found two more defects, both fixed in this PR
REMEMBER_DIR's own mtime as the install baseline. That's wrong --save-session.shwritesnow.mdviamktempdirectly insideREMEMBER_DIRfollowed bymv, and both operations bump the directory's own mtime, not justnow.md's. On any actively-captured project the baseline would have read as "time since last save", silently turning genuineSessionEndfailures back into the exact false positive this PR exists to close. Fixed by switching to$REMEMBER_DIR/.gitignore's mtime instead, with a new regression test (test_ongoing_saves_do_not_mask_a_genuine_failure) that reproduces the churn directly and is confirmed to fail against the old baseline..gitignoremarker is also not permanently stable --hooks.d/after_save/50-git-backup.shdeletes that exact file as a one-time cleanup of the legacy bootstrap artifact, reachable when a legacy (in-project) store is migrated to external mode with git backup enabled. Functionally this doesn't make the fix worse than already documented (the safe fallback when the baseline is unavailable was already WARN, never a false FAIL), but the comment/README/changelog claim that "nothing else writes to it" was wrong and is now corrected in all three places. See Known follow-up below -- not fixed in this PR, since the fix belongs in a file outside this issue's own footprint.Known follow-up (not fixed here, filed for the maintainer)
hooks.d/after_save/50-git-backup.shdeletes$REMEMBER_DIR/.gitignoreunder legacy-to-external migration with git backup enabled, which permanently disablesSessionEnd'sFAILpath for that store (WARN forever, never crashing, never false-FAILing, but never catching a real failure either). Fixing it needs either changing50-git-backup.shto stop deleting the marker (or recreate a substitute) or givingdoctor.sha baseline that survives that cleanup -- both design decisions, both outsidescripts/doctor.shand this issue's declared lane. No existing sibling issue found. Below-bar note: this is a real, reachable gap, not filed as a blocking finding against this PR -- it does not regress anything this PR touches, it only means the WARN-only limitation this PR already documents for external-mode-from-the-start stores also applies, via a different path, to migrated-and-backed-up ones.Test plan
pytest tests/test_doctor_session_end_370.py-- 11 passed (red/green shown separately in the commit history and the agent report)pytest-- 1703 passed, 43 skipped, run twice (once per fix commit) on macOS/darwin, Python 3.13.15python3 .oss/assemble_changelog.py --check-- okCloses #392