Repository navigation
Description
Split out of #280 deliberately. The agent that fixed #280 folded in the doctor-visibility half (the ownership/world-writable skips now reach hook-errors.log) because it shared nine lines with the stdout fix, and left this one out with a reason worth preserving: it is a design, not a repair.
The gap
dispatch() runs hooks.d/<event>/ listeners sequentially, in the foreground. Nothing bounds how long one may take. A listener that blocks — a network call with no timeout, a read on a pipe nobody writes to, a lock wait — stalls the agent for as long as it blocks, and logs nothing, because nothing has failed.
That is this project's house defect in its most literal form. The three-state contract (0.12.0 CHANGELOG, _push_and_report in hooks.d/after_save/50-git-backup.sh) says a check that cannot answer must say so. A hook that never returns never reaches the point where it could say anything, so the absence of a log line reads as "nothing happened" when what happened is that everything stopped.
Why the obvious fix is not obvious
Two costs, both real, and they are why this is filed rather than patched:
1. Killing a listener mid-flight can leave state behind. The plugin ships its own git-backup hook. A SIGTERM between git add and git commit, or during a push, can leave a .git/index.lock in the very store this plugin exists to protect — and the next session's backup then fails on a lock whose owner is gone. So "add a timeout" is not free: it converts an indefinite stall into a possible corrupt-looking repository state, which is trading a loud failure for a quiet one unless the cleanup path is designed at the same time.
2. Picking the number is its own judgment. A backup hook doing a real git push over a slow network legitimately takes tens of seconds. A budget tight enough to catch a hang is loose enough to be useless, or tight enough to kill honest work — the trade claude-supertool#702/#658 spent two issues on. Any number chosen here needs the same treatment: measured against what the shipped hooks actually take, with headroom stated, not guessed.
What a fix probably has to decide
- Per-hook budget, or a budget for the whole dispatch? One slow-but-honest listener should not spend the allowance of the five after it.
- What is the kill signal, and is there a grace period between
TERMandKILLfor a hook that traps and cleans up? - Does a timed-out hook produce a finding (it ran and failed) or a decline (it could not answer)? Per the three-state contract these are different, and the answer determines whether
/remember:doctorshould show it as a fault or as unknown. - Does anything need to unwind the git-backup hook's partial state, or is that the hook's own responsibility once it is told it is being stopped?
- Are
after_user_promptandafter_session_startdifferent fromafter_save? The first two sit in front of a human waiting to type; the last runs after the fact. The same number may not suit both.
Not established
Whether this has ever actually bitten anyone. No report, no observed stall — it was found by reading dispatch() while fixing something else. That is worth saying plainly: this is a structural gap, not an incident, and it should be ranked accordingly against anything with a user behind it.
Related: #280 (where it was found; its stdout fix and the doctor-visibility fix both shipped in #284), claude-supertool#702/#658 (the same budget-sizing argument, worked through in another repo), claude-supertool#722 (the CI-level version: no timeout-minutes anywhere, so a hang ran to a six-hour default).
Activity
fix(dispatch): bound how long a hooks.d listener may run, and say whe…
test(#898): give fake plugin roots the install manifest resolve-paths…
fix(#898): release tree scrub + 5 new guards (typed-heredoc shipped a…
fix(#900): compile hooks.json-registered hooks self-contained at buil…