Skip to content

#486's own fix is an unchecked write: if the seed fails, doctor.sh reports the hook as never having fired #503

Closed

Description

@fdaviddpt

Found by the v0.25.0 release audit (round 2, dispatch token rel2-ab2ef9d5), class A, row misreports. Non-blocking; v0.25.0 ships with it.

Mechanism

scripts/session-end-hook.sh:290 (added by dd08174, in the v0.24.0..HEAD delta) is the whole of #486's fix:

printf '%s [session-end] flush started\n' "$(_remember_date +%H:%M:%S)" >> "$_END_LOG" 2>/dev/null

stderr discarded, exit code unread, no ||. The mkdir -p ... 2>/dev/null before it is unchecked the same way.

If that one-line write fails -- read-only store, full disk, or the mkdir having already failed -- the file is absent or empty, scripts/save-session.sh:1053's -empty -delete sweep reclaims it, and #483 is silently back in place.

Why it is misreports rather than a lost log

What the operator sees is not neutral. scripts/doctor.sh:455 treats the presence of session-end-*.log as proof the hook ran, and :532 prints:

FAIL SessionEnd has never fired for this project

So a failed one-line write is rendered to the operator as a dead hook. They go looking for a hook registration problem that does not exist.

The general form, swept

This is the shape worth checking across a delta: stderr discarded and exit code unread, so a failure and a no-op are indistinguishable. The auditor grepped the whole v0.24.0..HEAD delta for it -- 4 added lines carry 2>/dev/null, and only 2 lack a same-line ||. The other of those two, save-session.sh:428, is the correct shape: its exit code is read by the if, and the else arm logs a WARNING naming the command and the session. Line 290 is the only genuine instance in the delta.

What would settle it

Whether $REMEMBER_DIR/logs/autonomous is writable at that moment -- which nothing on this path asks or records. A failed seed should say so, in the same voice save-session.sh:428 already uses for its own fall-through.

Note this interacts with #487 and PR #499: the seed exists specifically to survive the sweep, so a fix here should be read together with whatever retention lands there.

Ranked

misreports. Non-blocking, carried forward from the v0.25.0 release audit.

Platform

Not platform-specific -- an unchecked redirect. Read in the tree at 53bd09b on macOS/arm64 (Darwin 24.3.0).

Activity

  1. added
    cohort-4
    on Sep 1, 2026
  2. self-assigned this
    on Sep 3, 2026
  3. added
    priority:low
    on Sep 3, 2026
  4. added 4 commits that reference this issue on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cohort-4priority:low

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions