Repository navigation
Conversation
…nd staging_append warns before an append-only file grows forever --force used to acquire save.lock with a 0-second timeout before the argument parse that would have seen --force at all, so a forced flush that lost the race exited 0 having saved nothing -- indistinguishable from a genuine no-op, on exactly the save whose whole purpose is that there is no next chance (#369). A forced call now retries the same mutex, bounded (REMEMBER_FORCE_LOCK_TIMEOUT, default 30s), and exits 1 -- not 0 -- if the holder still has not released, which session-end-hook.sh's existing nonzero-exit check already surfaces via report_error(). staging_append's five append-only callers were each individually correct (a visible duplicate over an invisible erasure), but nothing noticed a staging file growing without bound under a persistent cause -- sustained lock contention, a full disk, or a stalled consolidation (#349). It now logs a one-time WARNING past thresholds.staging_warn_bytes, surfaced by the existing hook-errors.log tail in /remember:doctor. Nothing is capped or truncated. Closes #369 Closes #349 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
…ting change in README The README config gap noted in the previous commit's report is unblocked -- the coordinator confirmed lane fix/377 (README.md) has landed its own PR and released the file. Confirmed this worktree's README.md was still unmodified (matched origin/main) before touching it. Adds the thresholds.staging_warn_bytes row to the config table, matching the neighbouring rows' convention (default, units, what 0 does). Also updates the SessionEnd section's flush-failure paragraph: #369 made a lock-race loss on --force reportable through the same hook-errors.log channel that paragraph already documents for every other flush failure -- before this fix, that one case reported nothing at all, which is user-visible behaviour worth stating explicitly rather than leaving implied. Scoped to exactly these two spots -- the marketplace install paragraph and CLAUDE.md (lane 377's own territory) are untouched. tests/test_config_contract.py now passes in full (11/11); full suite: 1655 passed, 43 skipped, 0 failed. Closes #369 Closes #349 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
This was referenced Aug 28, 2026
This was referenced Aug 28, 2026
fdaviddpt
added a commit
that referenced
this pull request
Aug 28, 2026
…ss check (#390) (#391) PR #387 (closing #370) gave scripts/doctor.sh a second liveness check, for SessionEnd, alongside the existing PostToolUse one. README.md's Diagnostics section still described only the PostToolUse check, drafted before #387 landed and blocked at the time because #382 held README.md. Both PRs have since merged; verified the wording against the merged doctor.sh (three states, and "has ever fired" correctly describes the log-presence check rather than a transcript count) before applying it unchanged.
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.
#369 -- a forced flush that lost the lock race exited 0 having saved nothing
save-session.shacquiredsave.lockwith a hardcoded 0-second timeout before the argument parse that would have seen--force-- so--forcebypassed the cooldown and the min-human-message gate, but never the mutex. A forced call that lost the race exited 0, indistinguishable from a genuine "nothing new to flush" no-op, on exactly the save (session-end-hook.sh's SessionEnd flush) whose whole purpose is that there is no next chance.Fix: argument parsing moved ahead of lock acquisition (no side effects to reorder around). A plain call is unchanged -- timeout 0, exit 0 on contention, a legitimate skip. A forced call now retries the same mutex, bounded (
REMEMBER_FORCE_LOCK_TIMEOUT, default 30s) -- not a second writer, just a longer wait for the one lock that already exists. If the holder still has not released after that wait, the call now exits 1 instead of 0.session-end-hook.shalready checks that exit code and callsreport_error()on nonzero, so this makes an existing check see the real failure instead of a false all-clear.Closes #369
#349 -- an append-only staging file could grow for weeks with nothing noticing
staging_append()(scripts/lib-staging-lock.sh) is a bare>>with no size check, and five branches append a span and deliberately never roll it back on failure -- a visible duplicate over an invisible erasure, and that trade is correct and unchanged here. What nobody had costed: a persistent cause (sustained lock contention, a full disk, a stalled consolidation round) leaves the same kind of span landing there every round, forever, with nothing to notice.Fix:
staging_appendnow logs a one-time WARNING (report_error(), reaching the daily log andhook-errors.log) the first time a staging file's byte size crosses a newthresholds.staging_warn_bytes(default 2000000 bytes, documented inconfig.example.json). Nothing is capped or truncated -- the append itself is unchanged.hook-errors.logis already tailed by/remember:doctor's existing "Recent errors" section, confirmed by readingscripts/doctor.sh:497-506, so no diagnostic edit was needed or made.Closes #349
README.md -- documented, once the coordinator unblocked this lane
The gap noted above (thresholds.staging_warn_bytes undocumented in README.md, README.md held by lane fix/377) is now closed: the coordinator confirmed fix/377 landed its own PR and released the file, and commit 8bed68b (after this worktree's README.md was verified unmodified against origin/main) adds the config-table row and updates the SessionEnd flush-failure paragraph to note that a --force lock-race loss is now reportable through hook-errors.log -- which it was not before #369. Scoped to exactly those two spots; the marketplace-install paragraph and CLAUDE.md (lane 377's own territory) are untouched. tests/test_config_contract.py: 11/11 passing. Full suite: 1655 passed, 43 skipped, 0 failed.
Below-bar finding from self-review, not fixed
The auditor flagged that staging_append's own size measurement (
wc -c) silently collapses to 0 on any read failure (the same digit-only guard the rest of this file already uses for corrupt/unreadable values), so awc -cfailure while thecat >>append itself still succeeds would suppress the new growth warning without a trace -- the one failure mode this diagnostic was added to catch, appearing in the diagnostic itself. Judged below-bar and not fixed: the scenario needs write access without read access to the same file, which is not a configuration this plugin's own deployment model (writes as the invoking user's own uid) produces, and no reachable trigger for it exists in this diff's own callers.Test plan
tests/test_save_session_force_lock_race.py-- new, real two-process lock race (positive + negative control), red before the fix / green aftertests/test_staging_growth_warning_349.py-- new, drivesstaging_appenddirectly (positive + negative control), red before the fix / green after0 failed,1655 passed,43 skippedpython3 .oss/assemble_changelog.py --check-- both fragments pass