Repository navigation
Conversation
…marizer module #1054: the nested summarizer call left a permanent, empty project folder behind in ~/.claude/projects/ on every single save -- the CLI's own auto-memory scaffolding a memory/ subfolder for the isolated per-call working directory, unrelated to this plugin's hooks. CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 is now set and restored around the spawn, same lifetime as the existing REMEMBER_NESTED_SUMMARIZER marker. #1055: renamed pipeline/haiku.py to pipeline/summarizer.py and the "haiku" log tag to "summarizer", since the configured model is not always Haiku -- a Sonnet or Codex setup's log said "haiku" on every save regardless of what actually ran. The daily log now also records which model ran each summary. The model/REMEMBER_MODEL setting and the legacy haiku.oauth_token config-key check are unaffected. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Both self-review spawns flagged present-tense comments across scripts/ and pipeline/ that still named pipeline/haiku.py as the live location of code that bfc210d renamed to pipeline/summarizer.py. Updated every live-fact reference the reviewers found (docs/configuration.md, pipeline/types.py, pipeline/spawn_guard.py, scripts/{doctor,log,resolve-paths,run-tests, save-session,user-prompt-hook}.sh); historical "moved from X to Y" comments in test docstrings and CHANGELOG.md entries are left untouched, since they correctly describe what was true at the time. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ritten The previous commit's mechanical substitution also hit a genuinely historical comment describing what the install-marker check used to test for before #898 round 5 replaced it with a plugin.json manifest check -- at that point in time the marker really was named pipeline/haiku.py, so rewriting it to pipeline/summarizer.py made a true historical statement false. Restored the original name there and said explicitly why. Co-Authored-By: Claude Sonnet 5 <[email protected]>
test_printed_lines_ascii_405 expected strings from haiku.py (now fails on every leg); run-tests.sh step 4 imported pipeline.haiku; a summarizer.py comment named the old path. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Nov 1, 2026
- #1052: doctor's dropped-summarizer-spans check now matches #1085's renamed [summarizer] tag (was validate|haiku only), confirmed [ndc] REJECTED is retried rather than dropped and left out of the count. - #1047: the post-cap stdin drain now runs detached, so a writer holding its end of stdin open past the cap can no longer hang the hook. - #1046: SessionStart's own roster marker moved out of capture-alive.d into its own tmp/session-started.d/, so the #200 capture-gap check can no longer read a chat-only session's own marker as proof PostToolUse ran; only the recovery guard accepts either folder. Added a one-time upgrade grace (tmp/roster-epoch) so a pre-existing unmarked session from before this landed is still rescued once, not silently abandoned. - Reworded the #1046 changelog fragment in plain language and corrected its claim that the #200 check is unaffected. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Nov 1, 2026
…tion, dropped summarizer spans (#1084) * Fix #1046, #1047, #1052: cross-store recovery, quadratic stdin extraction, dropped summarizer spans #1046: SessionStart recovery no longer force-saves another store's live session when several terminals pin different REMEMBER_DIRs at the same project directory. Recovery now declines to force-save a candidate with no marker under this store's own tmp/capture-alive.d roster -- gated at the recovery call site only, not inside _find_previous_transcript, so the #200 capture-gap check (which shares that function's result and depends on the same "no marker present" signal for a different purpose) stays unaffected. #1047: session-start-hook.sh's field extractor bounded the raw payload it matches against to 4096 bytes, eliminating the O(n^2) `${var#*pattern}` blowup a multi-megabyte stdin payload (e.g. a whole transcript piped in) triggered -- measured 16.8s before the fix on a 150KB payload with the target field at the end, same shape as the issue's own 21-hour hang. HOOK_STDIN's own full accumulation is untouched, so the before_session_start/ after_session_start listener-publish contract (#266) is unaffected. #1052 (ask 1 only): /remember:doctor now counts [validate]/[haiku] REJECTED lines across the daily logs present and WARNs -- a reject gate firing is a successful summarizer call that drops a span of real work, invisible to #870's own failure-marker counter since the call succeeded. Ask 2 (salvaging a header refusal with a usable body, or changing the prompt wording) is left for its own issue/PR. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Self-review follow-up: #1046/#1047 hardening after two-reviewer pass Explore and oss:auditor findings against 5a9998b, disposed as follows: - #1046 recovery guard checked only one of capture_was_seen()'s three evidence sources (the capture-alive.d marker), missing the legacy single-slot file kept specifically for the upgrade-transition false positive capture_was_seen() already documents. Fixed: a new _remember_recovery_prev_id_vouched() checks both applicable sources (the third is excluded by construction, since recovery only reaches this guard when PREV_WAS_SAVED is already "no"). - Same function also sanitizes the session id before using it as a path component, matching capture_was_seen()'s own id allowlist -- defense in depth; empirically the dotglob-off default already makes a `.`/`..` id unreachable through _find_previous_transcript's own glob, confirmed by trying to reproduce it end to end, so this is tested directly against the function rather than through a (non-reproducing) hook fixture. - #1046's functional narrowing of recovery (it can no longer rescue a session with literally no evidence anywhere, the original #200/#270 no-marker case) is real and was under-documented -- changelog.d/1046 now states it explicitly as the accepted trade-off the issue itself asked for, rather than leaving it to a test-file comment. - #1047's _stdin_json_string_into gained two self-review fixes: LC_ALL=C (the 4096 bound was character-counted under a UTF-8 locale, not byte-counted, loosening the margin against the quadratic match), and a fail-closed check when a value's opening quote survives the bound but its closing quote does not -- previously returned success with a corrupted truncated value instead of the documented "missed" result. Both reviewers' doctor.sh findings (unreadable-log-folds-into-zero, pre-existing across every sibling section in that file) are left as-is per their own non-blocking ranking. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Fix #1046/#1047/#1052 review round 2: 32KiB stdin cap, chat-only rescue, notice rewording, doctor.sh quote convention #1047: the HOOK_STDIN accumulation loop in session-start-hook.sh was still quadratic and unbounded (3.3 MB/2,500 lines measured at 68.8s on bash 3.2, 23.6s on bash 5.3) -- the earlier round only bounded _stdin_json_string_into's own matched input. Now caps accumulation at a 32 KiB ceiling DURING the read loop itself, matching the before_session_start/after_session_start listener- publish block's own existing cap so every payload at or under it still arrives byte-for-byte. Adopts the approach from external PR #1049 (CNSeniorious000/Muspi Merol); credited via Co-authored-by below. This supersedes #1049 (its 4KB/4KB split-join approach would silently truncate a legitimate 8-32KB payload before the listener-publish block ever saw it). New end-to-end test drives the real hook with a 1MB transcript-shaped payload. The capture-gap-check.sh copy of _stdin_json_string_into gets the same LC_ALL=C, 4096-byte bound and fail-closed check, keeping the two copies identical (pinned by test_entrypoint_sniff_bookkeeping_message_803.py's parity test). #1046: SessionStart now writes its own cheap "started under this store" capture-alive.d marker (plain redirect, no fork) so a chat-only session (no tool call, so post-tool-hook.sh's own marker never lands) is still rescuable by recovery on its next startup -- new data loss the roster guard itself introduced, not present before it. The pre-existing #200 "never captured" notice is reworded when recovery's own log already says a candidate may belong to a different store, rather than contradicting it with the flat "not captured" wording. tests/test_jq_fallback_arg_667.py's fixture now plants a roster marker for its PREV session, matching what a real previous session's own SessionStart would have written. test_roster_skip_1046.py's two direct subprocess calls use resolve_bash() rather than a bare "bash" literal; docs/windows-skip-triage.md gains rows for it and for test_doctor_dropped_summarizer_spans_1052.py. #1052: doctor.sh's new "Dropped summarizer spans" WARN no longer claims the dropped span itself is "kept, not lost" -- keep_rejected_text only saves the model's own refusal text, never the span, and save-session.sh is unchanged by this PR, so the span stays genuinely dropped. The escaped double-quote in that WARN's message now uses this file's own printf -v _dq octal-042 convention instead of a backslash escape. Note for the maintainer: #1052 should stay OPEN after this merges (change "Closes #1052" to "Refs #1052" in the PR body) -- save-session.sh's own position-advance-past-a-refused- span behavior is unchanged, so the issue is not fully closed by this round. Co-authored-by: CNSeniorious000 <[email protected]> * Self-review follow-up: #1047 round 3 -- byte-cap the top-level read loop under UTF-8 locales Explore + oss:auditor review of commit 32682fb both flagged the same gap independently: the new HOOK_STDIN read loop counts and slices by CHARACTER under any UTF-8 locale (the common CI default), the exact defect class _stdin_json_string_into's own comment already names -- but that function's `local LC_ALL=C` fix is unavailable here since this block is top-level script code, not a function. A multi-byte-heavy payload could therefore grow HOOK_STDIN up to ~4x past the documented 32 KiB byte ceiling before the loop's own character-count check tripped. The quadratic growth this whole round exists to bound stays bounded either way (it is a looser ceiling, not an unbounded one), but the ceiling itself was not the number the comments and changelog claimed. Fixed by saving/restoring LC_ALL explicitly around the loop (bash has no `local` outside a function, so a bare assignment would otherwise leak into this hook's own later user-facing output). New test (test_the_cap_is_a_byte_cap_not_a_character_cap_under_utf8) drives a payload built from a 4-byte UTF-8 character under an explicit UTF-8 locale and asserts the cap holds in bytes, not characters. Explore's other finding (the hooks.d/ publish FILE's own "holds it, complete" promise is now unreachable above the 32 KiB cap, not merely truncated-with-warning) is a real, unavoidable consequence of killing the quadratic join at the source -- there is no cost-free alternative without reintroducing the hang this round exists to fix. Left as a documented tradeoff (the updated comment block already states it honestly); noted for the maintainer in the handback rather than changed further here. oss:auditor's other finding (doctor.sh's grep -c folds "zero matches" and "grep itself failed" into the same WARN-does-not-fire outcome) is pre-existing across the whole file and was already identified and left as-is in this PR's own first review round (see PR #1084's own description: "doctor.sh's unreadable-log pattern folds to a zero count the same way every pre-existing section in that file already does -- pre-existing across the whole file, not introduced by this diff, ranked non-blocking by the auditor itself"). Not re-fixed here for the same reason. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Fix CI: #1040's read-site locator + Windows cp1252 UnicodeEncodeError in the new #1047 test tests/test_hook_stdin_chunked_read_1040.py's _read_site() located session-start-hook.sh's stdin block by the literal text `HOOK_STDIN=""` immediately followed by `if [ ! -t 0 ]; then` on the next line -- this round's 32KiB-cap rewrite (and the LC_ALL save/restore added for the byte-vs-character self-review fix) inserted code between those two lines, so the locator's text.index() raised before any assertion ran, failing 4 session-start parametrized cases on the "hook tests (compiled) / windows- latest" CI leg. Considered switching session-start-hook.sh onto the shared _remember_read_stdin_into (scripts/lib-stdin.sh) the other three hooks already use, per the review's own suggestion -- not done: that helper's own accumulation (both its chunked and line-loop-fallback paths) is equally unbounded, so moving session-start-hook.sh onto it without ALSO capping lib-stdin.sh itself would not fully close #1047 on bash < 4.1 (the exact case the issue's own worst numbers were measured against), and capping lib-stdin.sh is a larger change touching three other hooks -- out of scope for a CI-fix commit. Fixed the locator instead: it now starts at _REMEMBER_HOOK_STDIN_CAP=32768 (the real start of the block, needed because that constant is now referenced inside the loop) and ends at the stable `unset _hook_stdin_lc_all_was_set ...` line that closes the whole block, rather than the first `fi` reached -- the block now contains three `fi` lines of its own. The #1040 field-parity assertions this test exists for are unchanged; all previously-passing cases still pass, and the bug the locator failure was masking (whatever it would have caught) was never triggered in this run either way, since LINE_LOOP_MAX_PAYLOAD (16 KiB) already keeps every payload these session-start cases exercise well under the new 32 KiB cap. Did not confirm whether the SAME locator bug also fails on non-compiled, non-Windows legs (it should, being a pure text-match issue independent of platform or compilation) -- only the one CI leg named in the report was investigated; the fix is leg-independent, so it should resolve on every leg this affects, not only the one that was reported. tests/test_session_start_stdin_cap_1047.py's new UTF-8-byte-cap test fed a multi-byte payload through subprocess.run with text=True and no explicit encoding, which on Windows decodes/encodes via the platform's preferred codepage (cp1252) rather than UTF-8 -- raising UnicodeEncodeError on the `input=` argument before the subprocess even started, since cp1252 cannot represent the payload's own 4-byte UTF-8 character at all. Fixed by pinning encoding="utf-8" explicitly on that one subprocess.run call. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Fix CI on PR #1084: #1046 guard fixtures, prune-count assertion Three tests failed in CI against the #1046/#1047/#1052 branch, all in test fixtures/assertions that predate or were invalidated by round 2's new SessionStart roster marker -- not bugs in the guard itself. tests/test_recovery_transcript_leak_407.py's _startup_project fixture gives PREV five real tool_use lines in its transcript but never plants the capture-alive.d/PREV marker those tool calls would themselves have produced under post-tool-hook.sh (pre-existing since #206, unrelated to this PR). #1046's recovery guard reads that exact marker to tell "ran under this store" from "may belong to a different store sharing this project's transcript directory" -- so the fixture's omission is not a realistic "never captured" case, it is a hole the guard correctly declines on. Planted the marker in the fixture instead of weakening the guard; this also fixes test_detached_spawn_fd_hygiene_648.py's test_session_start_recovery_spawn, which imports the same fixture. tests/test_roster_skip_1046.py's own test_a_chat_only_previous_session_is_still_rescued already pins the marker staying in capture-alive.d (not moved elsewhere), so this is the fixture-side fix, not a guard change. tests/test_session_start_promo_spawn_budget_660.py's test_capture_seen_prune_is_gated_on_the_threshold asserted an under-threshold capture-alive.d directory is left with exactly its 2 seeded entries. Round 2 (already shipped on this branch) has session-start-hook.sh write its own cheap roster marker for every SessionStart's own session id into that same directory, unconditionally -- intentional, so a chat-only session still earns roster evidence. That legitimately adds one entry regardless of the prune threshold, so the assertion now checks the 2 seeded entries survive unpruned, plus exactly the new run's own SESSION marker. Reran the full targeted set plus test_roster_skip_1046, test_jq_fallback_arg_667, test_locale_ranges_695, test_capture_gap_notice, test_session_start_prev_session_270, test_previous_transcript_no_sort_691 and the release-tree/branch suites: 557 passed, 1 skipped (case-insensitive filesystem). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix #1047 round 4: Windows CI timeout from the read loop's own per-line cost CI self-review after pushing the #1046 guard-fixture fix: every Windows leg (3.9-3.12) failed test_session_start_stdin_cap_1047.py's test_a_1mb_transcript_sized_stdin_does_not_hang_the_real_hook with a subprocess.TimeoutExpired at the 30s budget -- consistently, across every Windows job including the compiled-hooks leg, while every Ubuntu/macOS leg stayed well under it. The #1047 round-3 fix correctly caps HOOK_STDIN's own growth at 32KiB during accumulation, closing the quadratic string-concat cost. But the `while IFS= read -r -t 1 _line` loop around it kept iterating once per line for the REST of an oversized payload even after the cap was hit, with nothing left to do once HOOK_STDIN is already capped. That is O(lines) of pure per-`read`-call overhead, not O(bytes) -- cheap enough on Linux/macOS bash to go unnoticed, but Windows runners (git-bash/MSYS syscall overhead per shell builtin call) paid enough per iteration that 2,500 lines alone pushed this test past its budget. Fixed by breaking out of the line loop the instant the cap is hit and draining whatever is left of stdin with a single bulk `cat <&0 >/dev/null`, copying bytes without ever growing a string or forking a process per line. HOOK_STDIN's own contract (byte-identical up to the 32KiB cap) is unchanged; only the work done AFTER the cap is reached is removed. tests/test_locale_ranges_695.py's hardcoded allowlist entry for scripts/session-start-hook.sh's CURRENT_SESSION_ID bracket range (line 380) updated to its new line (399) -- this diff inserts 15 lines above it. Verified locally (fast on this platform by construction -- the bug is Windows-specific) plus the full #1046/#1047 targeted set, the release- tree/branch byte-budget suites, and test_locale_ranges_695: 565 passed, 1 skipped (case-insensitive filesystem, pre-existing). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix final-review findings on #1046, #1047, #1052 - #1052: doctor's dropped-summarizer-spans check now matches #1085's renamed [summarizer] tag (was validate|haiku only), confirmed [ndc] REJECTED is retried rather than dropped and left out of the count. - #1047: the post-cap stdin drain now runs detached, so a writer holding its end of stdin open past the cap can no longer hang the hook. - #1046: SessionStart's own roster marker moved out of capture-alive.d into its own tmp/session-started.d/, so the #200 capture-gap check can no longer read a chat-only session's own marker as proof PostToolUse ran; only the recovery guard accepts either folder. Added a one-time upgrade grace (tmp/roster-epoch) so a pre-existing unmarked session from before this landed is still rescued once, not silently abandoned. - Reworded the #1046 changelog fragment in plain language and corrected its claim that the #200 check is unaffected. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix CI: widen windows-latest flake in the new stdin-drain test 3.16s observed on windows-latest against the 3.0s bound, from process spawn overhead alone -- the fix (backgrounded drain) was correctly in place. Widened to 5s, matching this file's other must-fire test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Harden the #1047 drain test margin; state the #1046 upgrade-grace trade-off The writer now holds stdin for 15 s against a 5 s bound, so a later widening for a slow runner cannot reach the hold and stop catching a blocking drain. The changelog now says plainly that the one-time grace can still save one other window's conversation into the wrong store per store, once, after the update. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: CNSeniorious000 <[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.
Closes #1054
Closes #1055
Both issues come from outside users.
#1054: an empty folder under
~/.claude/projects/on every saveThe summarizer runs a nested Claude Code call from its own scratch directory. Claude Code's auto-memory feature creates a
memory/folder for any directory it treats as a project, so every save left an empty project folder behind.Fix: the summarizer's environment sets
CLAUDE_CODE_DISABLE_AUTO_MEMORY=1, saved and restored next to the existingREMEMBER_NESTED_SUMMARIZERmarker. I confirmed this is a real Claude Code setting: the current build reads it, and a true value turns auto-memory off. Three new tests intests/test_nested_summarizer.pyfailed before the fix (2 of 3) and pass after.#1055: the summarizer was named after one model
pipeline/haiku.pyis nowpipeline/summarizer.py, and thehaikulog tag is nowsummarizer.summarizerlog line,MODEL=insave-session.sh).model/REMEMBER_MODELkeep working, and the doctor'scall-haikucheck is untouched because the shell subcommand keeps its name.Testing
All touched test files: 1079 passed, 2 skipped (live-API opt-in, unrelated). Full suite runs in CI.
🤖 Generated with Claude Code
[AI-generated]