Repository navigation
Conversation
…on check The deferred-file loop that lists which memory files were "delivered at session start; read or grep on request" at source=compact never called `_remember_may_inject` before adding a file to that list. Since the main injection loop already skips every non-identity file at source=compact before it ever reaches the guard call, that meant a git-tracked or symlinked memory file -- exactly the kind session start itself refuses to inject -- was still listed under a header falsely claiming it had been delivered, with its path printed right below, inviting a follow-up read of the refused (and possibly planted) content. The deferred loop now runs the same guard the main loop already applies; a refused file is listed under the existing "refused (not injected)" header instead, reusing the vocabulary the main loop already uses for the same refusal. Adds tests/test_compact_deferred_guard_777.py (red before, green after -- 2 failed/1 passed before the fix, 3 passed after), a changelog.d/777.fixed.md fragment, and a docs/windows-skip-triage.md row for the new blanket win32 skip the test file carries (same shape/reason as tests/test_injection_guard_754_755_756.py, which it borrows its fixtures from). Co-Authored-By: Claude Sonnet 5 <[email protected]>
…mpact Self-review finding (Explore reviewer and oss:auditor, same finding independently): the previous commit reused the main injection loop's "--- refused (not injected) ---" header verbatim for the new compact-mode deferred-loop refusal. Both loops can fire refusals in the same compact render (the main loop only reaches the guard for IDENTITY_FILE at compact; the new loop covers every other file), so the identical header let the two populations be merged or misattributed by a reader, or by anything parsing this output by header text rather than by sequence. Ranked non-blocking (cosmetic) by both reviewers; fixed directly since it is a one-line, same-subsystem, testable change to code this diff already owns. The deferred-loop refusal now prints under its own "--- refused, would have been listed as deferred (not injected) ---" header. Updated changelog.d/777.fixed.md to describe the actual header text; tests/test_compact_deferred_guard_777.py's own assertions were already header-agnostic (they check the deferred SECTION specifically, via _deferred_section()) so they needed no change -- 42/42 passed, including the full test_injection_guard_754_755_756.py and test_session_start_compact_recap_339.py suites, after this commit. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This was referenced Sep 26, 2026
Closed
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 #777
What
The compact-mode deferred-file loop in scripts/lib-memory-context.sh never called the injection guard
_remember_may_injectbefore listing a file as deferred. Because the main (non-compact) injection loop skips every non-identity file atsource=compactbefore it ever reaches the guard, the guard ran on zero non-identity files during compact -- so a git-tracked or symlinked memory file (exactly what the guard exists to refuse) was still listed under the deferred header, falsely claiming it had been delivered at session start, with its path printed as an invitation to read the refused content via a follow-up tool call.Fix
Call
_remember_may_injectinside the deferred loop as well, and list a refused file under its own header (refused, would have been listed as deferred (not injected)) instead of the deferred one.Tests
New file
tests/test_compact_deferred_guard_777.py, 3 cases: tracked file not listed as deferred, symlinked file not listed as deferred, untracked file still listed as deferred (positive control). Red before the fix: 2 failed, 1 passed (both negative cases failed, the positive control already passed). Green after: 3 passed. Adjacent suites (test_injection_guard_754_755_756.py,test_session_start_compact_recap_339.py) re-run alongside, 42 passed, 0 failed.Self-review
Two independent reviewers (Explore, oss:auditor) both found the same single finding: the new refusal block initially shared its header text with the main loop's own pre-existing refusal header, which could let a reader or downstream parser merge or misattribute the two populations when both blocks co-occur in one compact-mode render. Ranked low-severity/misreports, non-blocking, by both -- fixed directly in a follow-up commit by giving the deferred-loop's refusal a distinct header text.
Adjacent (not fixed here, out of scope)
A sibling instance of the same bug shape exists in the same function's rotated-slices block (prints file paths under a "rotated memory slices" header with no guard call at all), but it is not gated by compact mode and is a different code path -- out of #777's stated scope. Needs its own issue.
Full suite
The full
pytestsuite was deliberately not run locally (targeted plus adjacent suites only, per this repo's own developer guidance); CI's cross-platform matrix is the gate of record.[AI-generated]