fix(hooks): ship default timeouts so a hung hook cannot block the CLI - #1228
Open
rubenmarcus wants to merge 1 commit into
Open
rubenmarcus wants to merge 1 commit into
rubenmarcus wants to merge 1 commit into
Conversation
rubenmarcus
force-pushed
the
fix/hooks-default-timeouts
branch
2 times, most recently
from
September 30, 2026 12:36
afcc588 to
23f722e
Compare
rubenmarcus
force-pushed
the
fix/hooks-default-timeouts
branch
from
September 30, 2026 12:36
23f722e to
a8a3327
Compare
47yj6ryndm-jpg
approved these changes
Oct 1, 2026
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.
Fixes #1226.
The shipped
hooks/hooks.jsondeclared notimeouton any of its 14 command entries, so a hung hook script (the issue hit an infinite loop in a PreToolUse matcher) blocks the host CLI indefinitely with no permission prompt to escape. Patching a timeout into the plugin cache works until the nextctx upgraderestores the upstream file and drops it.This ships the timeouts in the file itself: 10s for the 9 PreToolUse matchers, which sit on the critical path of every tool call, and 30s for PostToolUse, PreCompact, UserPromptSubmit, SessionStart and Stop.
tests/hooks/shipped-hooks-timeout.test.tsguards it: every command entry in the shipped file must carry a numeric timeout and PreToolUse must stay at or under 10s. RED on the previous commit (all 14 entries failtypeof timeout === "number"), GREEN on this one, 16/16.Neighbors: the 6 failures in
tests/hooks/integration.test.ts(latency marker cleanup) and friends are pre-existing, reproduced identically on the base branch (6 failed | 85 passed on base, same 6 | 101 with this branch's 16 new tests passing).Prepared with AI assistance (GLM 5.3 via Oh My Pi) and reviewed before submission.