Repository navigation
Merged
Conversation
…ap as disabled, and names Python before an oversized store (#357, #359, #360) Three independent misreports in the #348 store-size check, found by the release audit of v0.20.0..HEAD: - #357: TODAY was the machine clock's date, not config.timezone's -- the pipeline reaches "today" through REMEMBER_TZ -> pipeline/_tz.py, which is what _eligible_staging excludes today by. A configured timezone ahead of the machine's could make doctor exclude the file the pipeline counts and count the file the pipeline excludes at once, inventing the "cannot heal itself" alarm on a healthy store. - #359: the oversized-store VERDICT arm was checked above the no-usable-Python arm, so a broken interpreter on an already-large store read as "staging files are over the prompt cap on their own" instead of pointing at the Tools section -- the ladder's own rule is specific causes before the general one, and a broken Python is the more specific of the two. - #360: consolidate_max_bytes: 0 parsed as a literal 0-byte cap, where pipeline/shell.py documents and implements 0 as the cap being disabled. Every non-empty store then failed the check. Each keeps its own test file (test_doctor_timezone_357.py, test_doctor_verdict_ordering_359.py, test_doctor_cap_disabled_360.py), paired must-fire/must-not-fire cases in the same fixture, and its own changelog fragment. test_doctor_oversized_store_348.py's own "today" test switched from asking the live clock to a fixed PATH-shimmed date, so it can no longer pass through a timezone regression by coincidence. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
…ured TZ, not mere presence Self-review (Explore) on c074aad found that _shim_date checked `[ -n "$TZ" ]` rather than the value, so a test environment that already exports TZ ambiently (some CI base images do) would make the "excluded" test pass against unpatched doctor.sh too -- unpatched doctor.sh never sets TZ itself, but an inherited ambient TZ would still reach the shim subprocess and satisfy a presence-only check. Verified: reverting scripts/doctor.sh to its pre-fix content, both tests now correctly fail with TZ unset AND with TZ=UTC set ambiently; with the fix in place, both pass in both conditions. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
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.
Three independent misreports in scripts/doctor.sh's #348 store-size check, all found by the release audit of v0.20.0..HEAD before tagging 0.21.0.
#357 -- TODAY asked the machine clock, not config.timezone. The pipeline reaches "today" through config.timezone -> REMEMBER_TZ (scripts/log.sh:366) -> pipeline/_tz.py's today_str(), which is what _eligible_staging (pipeline/shell.py:393) excludes today by. doctor.sh deliberately does not source log.sh, and REMEMBER_TZ appeared nowhere in it -- TODAY was always the bare machine clock's date. With a configured timezone ahead of the machine's own, that diverges in BOTH directions at once: doctor excludes the file the pipeline counts and counts the file the pipeline excludes. When the wrongly-counted file is the larger of the two, staging can cross the cap on a store the pipeline is about to rotate happily -- the "cannot heal itself" alarm on a store that is fine. Fixed by reading .timezone the same grep-then-use way _CONSOLIDATE_MAX_BYTES is already read, and doing TZ="$_doctor_tz" date ... when set. Closes #357.
#359 -- the oversized-store verdict arm outranked the no-usable-Python arm. scripts/doctor.sh's VERDICT ladder states its own rule: specific causes are named before the general one. The #348 arm (_STORE_NEEDS_A_HUMAN, staging over the cap) is an EFFECT of consolidation not running; a broken Python interpreter is one CAUSE. It was checked first, so a user whose Python broke on an already-large store (the Microsoft Store python3 alias this repo documents) got told to look at oversized files instead of the Tools section that explains it. Reordered so no-usable-Python is checked first; the oversized-store arm still sits above "capture is working", preserving #348's own rationale that a store problem must not be masked by an otherwise-healthy-looking capture status. Closes #359.
#360 -- consolidate_max_bytes: 0 read as a literal 0-byte cap. pipeline/shell.py documents and implements 0 as the cap being DISABLED ("0" disables it, enforced by
if max_prompt_bytes > 0). doctor.sh's digits-only config parser accepted 0 like any other number, so every non-empty store failed the check and reached the loudest verdict arm the diagnostic can produce, even though the pipeline itself was consolidating that store on every round. Fixed: a disabled cap is now detected and rendered as an explicit "OK ... disabled" line instead of being compared against. Closes #360.Method
Each issue keeps its own test file (test_doctor_timezone_357.py, test_doctor_verdict_ordering_359.py, test_doctor_cap_disabled_360.py) with paired must-fire/must-not-fire cases in the same fixture, red confirmed against the pre-fix script and green against the fix. test_doctor_oversized_store_348.py's own "today" test switched from asking the live system clock to a fixed PATH-shimmed date, per #357's own note that a test sharing the code-under-test's clock cannot detect a divergence between the two.
A cross-cutting guard (tests/test_prompt_hook_spawns.py) requires any test file that shims
dateon PATH to name REMEMBER_NO_PRINTF_T even when not strictly needed (doctor.sh callsdatedirectly, not through lib-clock.sh's printf builtin) -- satisfied with an explanatory comment in both files that shimdate.Self-review (Explore, read-only) found one real issue: the #357 timezone shim distinguished fixed/unfixed doctor.sh by checking mere PRESENCE of $TZ rather than its exact configured value, which would false-green in an environment that already exports TZ ambiently. Fixed in a follow-up commit and verified directly against a reverted copy of doctor.sh, with and without an ambient TZ=UTC. Second review (oss:auditor) reported no findings across silent-absence, guard-execution, untrusted-input and cross-platform classes.
Full suite: 1658 passed, 43 skipped (Windows/pwsh/flock gaps, pre-existing and unrelated). Doctor-only slice: 34 passed.
Docs
README.md (this repo's only docs_targets entry) does not document doctor.sh's exact output wording for any of these three checks, so nothing there was stale; read and confirmed still true. Held by another lane (#377) this tick regardless, so not touched.
Closes #357
Closes #359
Closes #360
Co-Authored-By: Claude Opus 5 (1M context) [email protected]