Repository navigation
Description
Part of #20261020-235600-stop-hook-fanout-latency-per-turn
Problem
The disk-hygiene Stop row "Checking for silent destructive-guard failures..."
(plugins/disk-hygiene/hooks/hooks.json:116-139) is the slowest Stop hook on a measured Windows host:
p50 580 ms, p95 2,072 ms over 104 Stops. It sets the Stop wall.
The launcher skip (exec-bash.mjs --skip-unless-marker guard-launch-monitor, from #6254 and #3516)
skips only when the session has no <session>.launched marker. One marker turns the monitor on for
every later Stop of the session, so it starts bash and Python each turn even when no guard launched
since the last check. Markers are common:
run-python-hook.sh --launch-markerwrites the marker whenever an engine-gate row launches
(run-python-hook.sh:120,287). Those rows areif-gated onBash(*hygiene.py*),
PowerShell(*hygiene.py*),PowerShell(*python*$*)andPowerShell(*& $*)(hooks.json:39,66,88,110).
Theifmatch is on command text, so any command naming the engine file, a read-only grep included,
launches the guard and marks the session (reproduced this pass: agrepnaming the file was refused
by the guard).- The marker is keyed by session id, which subagents and workflow agents share, so any agent marks
the whole session. - On the measuring host, 250 of about 382 top-level sessions since 2026-10-01 hold a
.launched
marker (marker files versus session transcripts in the same window), and the measured session held one.
Evidence
Verified this pass on origin/main (31eafaa): the Stop row, the four engine-gate rows and their if
filters, the marker write in run-python-hook.sh, and the monitor's contract
(skills/clean/scripts/guard_launch_monitor.py header: it emits only {"systemMessage": ...}, never
blocks). Timings from findings.py stop-hook-timing on the measured session. Which row marked that
session was not determined.
Proposed approach
Recommended: make the skip mean "no guard launch since the last monitor run". The launcher records a
launch count or a timestamp in the marker on each launch; the monitor records what it last processed
in its existing <session>.cursor; the node-side --skip-unless-marker check compares the two and
skips when nothing is new. Keep failing closed: unreadable or missing state runs the monitor.
Alternatives:
async: trueon the Stop row. The monitor is advisory and only emits a systemMessage, so it need
not hold the turn. Verify against the hooks docs that a background hook's systemMessage still reaches
the user before relying on it.- Narrow the PowerShell
iffilters. Rejected as the main fix: they exist to catch indirect engine
launches, and narrowing them weakens the guard.
Files: lib/exec-bash.mjs (canonical; regenerate copies with scripts/sync-shared-copies.sh),
plugins/disk-hygiene/hooks/run-python-hook.sh, plugins/disk-hygiene/skills/clean/scripts/guard_launch_monitor.py.
Acceptance criteria
- In a session whose marker exists but no guard launched since the last Stop, the Stop row starts
only node (job-object or process census shows no bash or Python). - A guard launch after the last Stop makes the next Stop run the monitor, and a seeded
hook_non_blocking_errorfor the guard is still reported. - Missing or unreadable marker or cursor state runs the monitor (test).
- Re-measured p95 for this row on Windows drops below the node-only rows' p95 (about 1,000 ms on the
measuring host) with host load stated.
Constraints and gotchas
- This row is a safety detector for a destructive-command guard. Any change must degrade toward
running, never toward silence (the monitor's own doctrine). exec-bash.mjsis shared by many plugins; the new behavior must stay behind the
--skip-unless-markerflag.- Bump disk-hygiene's version and CHANGELOG; shared-copy changes bump each plugin whose copy changes.
Context
Source: local handoff item 20261020-235600-stop-hook-fanout-latency-per-turn.md. Prior: #6254, #3516,
#4416, #2577 (harness-ops detector that overlaps this one by design).
Activity
github-actions commentedon Oct 21, 2026
Proposed work class: work-class: scoped
Basis: automated intake triage; the lanes App applied this class.
Size: Medium
Complexity: High
Uncertainty: Known
Flags: none
Blocked by: none
Link: #8771 (comment)
The decision settles the open questions: the marker token format, the write order, the new
.seenfile, the fail-toward-running cases, and moving the Windows p95 criterion to #9158. Nothing is left to ask. The remaining work is one change to the launcher, the monitor and the sharedexec-bash.mjs, with tests and version bumps.Automated triage, applied by the lanes App.
kyle-sexton commentedon Oct 21, 2026
Issue Triage: this issue's 01:36Z lane run skipped (
issue-dimensions: not-assessed): Size, Complexity and Uncertainty were unset. Fields now set: Medium / High / Knowable. agent-ready is removed until: a Known call settles the marker and cursor state format, and the Windows census and p95 criteria are split into a needs-human child. It is re-added at that point, which starts a new run.github-actions commentedon Oct 26, 2026
The triage sweep dispatched intake triage for this issue (attempt 1 of 2).
1 remaining item
melodic-automation-lanes commentedon Oct 29, 2026
The work-resolve-issue lane did not start this issue: it needs a person to make it clearer first.
Why, in the run's own words:
What the run says it did not do:
The newest comment from a listed maintainer, #8771 (comment), does not start with
**Decision recorded.**, so the lane did not count it as an answer. If it answers the question, post the answer again in a new comment whose first line is:Run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40831842391
To retry, answer the question in a comment whose first line is
**Decision recorded.**, then removeneeds-humanand addagent-readyagain.kyle-sexton commentedon Oct 30, 2026
Decision recorded. Decided on the facts, under the body's constraint: "Any change must degrade toward running, never toward silence". These answer the four points in the lane's pushback.
$RANDOM, all bash builtins) into<session>.launched. A count and a whole-second timestamp can each miss a launch that runs concurrently with a Stop (lane analysis).<session>.seen, then truncates.launched, then writes the token. If the open fails,.seenis already gone, and a missing.seenruns the monitor. If the write fails after the truncate,.launchedis empty, and an empty.launchedruns the monitor (item 4). If both the.seenremoval and the.launchedopen fail, the launcher passes that fact to the guard it execs (for example, an environment variable naming the marker it could not write), and the guard adds asystemMessagethat names the marker, in the same output that carries its own decision. Its decision and exit status do not change. A stderr line alone would not do: at exit 0 it is discarded (docs/contracts/liveness-assertion/README.md, "a stderr line discarded on exit 0"). This keeps the body's constraint: "Any change must degrade toward running, never toward silence". The existing first-launch residual (run-python-hook.sh:182-187) is unchanged.<session>.seenfile holding the token it last processed. The existing.cursorformat stays unchanged, so its parse inguard_launch_monitor.pyis untouched. The Stop skips only when.seenexists, is readable, and equals the token in.launched. The monitor does not record a token whose epoch part is less than 60 seconds old, the engine-gate rows' hook timeout (hooks.json:51,78,100,122). A launch still in flight during a Stop, such as one from a background agent that shares the session id, then runs the monitor again on the next Stop and is not marked seen before its error can reach the transcript..launchedis empty, unreadable or malformed, or when.seenis missing or unreadable. A session with no.launchedkeeps the existing perf(autonomy, disk-hygiene): decide how Stop rows skip bash when idle #6254 skip. Today's empty markers run the monitor until the next launch writes a token.hook_non_blocking_errorfor the guard is still reported. (body, unchanged).launchedthat is empty, unreadable or malformed, or a missing or unreadable.seen, runs the monitor, and a launch whose token write fails leaves state that runs the monitor (test). (body, amended: "missing marker" keeps the perf(autonomy, disk-hygiene): decide how Stop rows skip bash when idle #6254 skip, per item 4, and the write order in item 2 is tested).seenremoval and.launchedopen both fail makes the guard emit asystemMessagenaming the marker, with the guard's decision and exit status unchanged (test). (body constraint "never toward silence", unchanged; covers the later-launch case item 2 introduces)melodic-automation-lanes commentedon Oct 30, 2026
The work-resolve-issue run that
agent-readystarted ended over 3 hours ago with no report and no pull request. work-unblock removed and addedagent-readyback to start a fresh run on main's workflow files. If this run ends the same way, it re-fires the issue again, waiting longer each time.