Skip to content

No dispatched hook has a timeout, so one that hangs stalls the agent indefinitely and logs nothing #286

Closed

Description

@fdaviddpt

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 TERM and KILL for 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:doctor should 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_prompt and after_session_start different from after_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

  1. added a commit that references this issue on Aug 1, 2026
    6d19ff7
  2. added 3 commits that reference this issue on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions