Repository navigation
Description
Found by the #487/#488 lane while diagnosing PR #499's Windows CI failure, after its first diagnosis (a test fixture handing bash a native backslash path) was fixed and the symptom survived. Filed by the maintainer. Pre-existing -- the affected sweep shipped long before #487.
This repo already knows
scripts/session-start-hook.sh:1156-1161 declines to use find for exactly this reason, in its own words:
# out to `find -mmin`: `find` is the one command on this path
# with a real PATH-shadowing risk on Windows Git Bash
# (System32's find.exe can resolve ahead of MinGW's find on
# some setups and silently answers a different question), so it
# would degrade "prune" into a silent always-keep with nothing
# surfaced.
That comment describes the defect this issue reports, at a different call site, written by whoever chose stat over find there.
The call site that did not get the memo
scripts/save-session.sh:1053:
find "${REMEMBER_DIR}/logs/autonomous" -name "*.log" -empty -delete 2>/dev/nullBare find, stderr discarded, exit code unchecked. C:\Windows\System32\find.exe takes none of -name, -mtime or -delete, has no delete capability at all, and would fail on those arguments -- into /dev/null, with nothing read. The sweep then silently does nothing, which is precisely the "silent always-keep with nothing surfaced" the sibling comment predicts.
PR #499 adds a second, age-keyed find beside it and inherits the same exposure.
The evidence that raised it
PR #499 converted two test files off the blanket win32 skip (#497) so they run under real Git Bash. On the Windows legs, with the fixture bug fixed and the hook demonstrably running -- its own fresh session-end-<HHMMSS>-<PID>.log appears in the listing -- a planted 8-day-old log still survives, and so does a 2-day-old one against a 1-day retention window:
[WindowsPath('.../session-end-000000-11111.log'), WindowsPath('.../session-end-224306-1497.log')]
Alternatives the lane ruled out before landing here:
- Log retention for logs/autonomous/ lives inside save-session.sh's RUN_NDC block, so features.ndc_compression=false disables housekeeping that has nothing to do with compression #498's
RUN_NDCgate --RUN_NDCdefaults true and is false only onfeatures.ndc_compression=false(not set here) or an in-cooldown NDC marker (none on a fresh store). - mtime precision -- 8-day and 2-day files against 7-day and 1-day cutoffs; the margin is not the issue.
- Backslash paths from
_remember_normalize_win_path(scripts/resolve-paths.sh:202), which deliberately reconstructsREMEMBER_DIRas a native Windows path onmsys/cygwin. Read, not run; MSYS-linked binaries generally accept backslash paths, so this is not the leading explanation -- but it compounds badly with a shadowedfind, and both would have to be settled together.
Grade
Reasoned, not observed. Neither the lane nor I has a Windows machine; nobody has watched which find on that runner. It is the most specific mechanism consistent with the symptom, it matches a hazard this repository documented itself, and it is stated as reasoning rather than measurement.
The cheap way to settle it is one line on the Windows leg: type -a find and find --version from inside the hook's own bash, printed rather than swallowed. If it is MinGW's find, this issue is wrong and the real cause is still open.
What a fix has to do regardless of the cause
The sweep discards stderr and ignores the exit code, so any failure -- shadowed binary, bad path, permissions -- reads exactly like a sweep that found nothing to delete. That is true on every platform and it is what let this go unnoticed until a test was allowed to run on Windows. Whatever resolves the PATH question, the sweep should say when it fails.
Ranked
misreports. Housekeeping reports success by silence while doing nothing, and logs/autonomous/ grows unbounded on the affected platform -- compounding #487, which is the same directory growing unbounded everywhere else.
Platform
Windows, Git Bash. The save-session.sh:1053 call and the session-start-hook.sh:1156 comment are observed in the tree at 53bd09b (macOS/arm64, Darwin 24.3.0); the PATH-resolution mechanism is reasoned.
Activity
fdaviddpt commentedon Sep 1, 2026
The v0.25.0 release audit (round 2) was asked to challenge this issue's mechanism and did. Recording it here in full, including the half I think misses, because a confident wrong explanation is worse than an open question.
Where the challenge lands
Two of its three points stand:
1. The decisive experiment is the empty logs, not the seeded one. If
findwere shadowed bySystem32\find.exe, the sweep would be a total no-op, and abandoned empty logs would accumulate on that runner too. If empty logs are still being reclaimed on the Windows leg,findworks and this issue is wrong. That is one directory listing and it settles the question -- better than thetype -a findprobe I suggested, because it tests the behaviour rather than the resolution.2. The observation was taken on PR #499's tree, not on the delta. Correct, and worth stating: the filenames carry a
-<PID>suffix that neitherv0.24.0norHEADproduces -- both spell itsession-end-$(_remember_date +%H%M%S).log. The suffix is #499's own fix.Where I think it misses
Its third point is that a seeded log surviving the sweep is exactly what #486 designed, reproduced on macOS where no
System32\find.exeexists.That reproduction is of the
-emptysweep, and the failing test does not target it.tests/test_autonomous_log_retention_487.pyplants an 8-day-old non-empty log and expects PR #499's new age-keyedfind -mtimesweep to reclaim it -- a sweep that deletes by age regardless of emptiness, and one that exists only on #499's branch. So "the seeded file is non-empty by construction" does not explain the failure: the test asserts against a sweep for which emptiness is not the predicate.The evidence-from-#499's-tree point above is the reason why, and it cuts the other way: the new sweep is only there.
And the same test passes on macOS in that same tree -- the lane's local run was 1947 passed. So the divergence is genuinely platform-specific, which is what put
findunder suspicion.Where that leaves it
The PATH-shadowing mechanism is still reasoned, not observed, and now contested on one of its supports. The empty-log listing above is the cheap discriminator and should be run before anyone works this.
What is not contested, and is worth fixing whatever the cause:
save-session.sh:1053discards stderr and ignores the exit code, so a shadowed binary, a bad path and a genuinely empty directory are indistinguishable to every reader.session-start-hook.sh:1156-1161declines to usefindat a sibling call site for exactly this reason. See also #503, which is the same shape at a third site insession-end-hook.sh.None of this held the v0.25.0 tag -- the audit ranked it
misreports-shaped either way, non-blocking, and the affected sweep is not in the released delta.fix: PR #499 Windows CI red -- portable retention sweep, unchecked wr…
fix: normalize backslash-separated REMEMBER_DIR before the retention …
fix: Windows CI red on PR #499 -- portable retention sweep, NDC/reten…