Repository navigation
Fix hook timeout units: seconds, not milliseconds (#98) - #102
Merged
Merged
Conversation
…arma's own mislabeled field Claude Code's hook `timeout` field is in seconds, not milliseconds. SETUP.md and captain-hook's docs told users to install "timeout": 5000 (intended as 5s), which actually installs an 83-minute cancellation window. Fixes all 144 example values across SETUP.md, api/SETUP.md, api/scripts/SETUP.md, captain-hook/README.md, captain-hook/docs/hooks/*, and docs/about/hooks-guide.md, plus the prose claiming milliseconds. Also fixes a real bug this caused in karma's own /hooks browser: HookRegistration.timeout_ms stored the raw (seconds) value from settings.json with no conversion, then displayed it suffixed "ms" — silently reinforcing the same unit confusion. Renamed to timeout_seconds end-to-end (model, api-types.ts, hooks page display). Fixes #98 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gv24uWUqNLigGcTtnGEHQv
…ook sweep The bulk seconds-conversion in the previous commit incorrectly divided the Bash tool's own tool_input.timeout example (120000ms = 120s) as if it were a hook-registration timeout. That field is genuinely milliseconds -- a different, adjacent concept from the hook config's timeout (seconds). Restores 120000. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gv24uWUqNLigGcTtnGEHQv
JayantDevkar
approved these changes
Sep 18, 2026
JayantDevkar
left a comment
Owner
There was a problem hiding this comment.
Verified against the Claude Code hooks reference: timeout is seconds, so the old docs really did install 83-minute windows. Approving.
What I checked:
- All 136 changed doc values are an exact ÷1000 (5000→5, 2000→2, 15000→15, …) — no stray edits.
- The Bash
tool_input.timeout: 120000example is correctly left in ms (good catch in the second commit). timeout_ms→timeout_secondsis renamed end-to-end (model, parser,api-types.ts, hooks page). The remainingtimeout_msrefs arebackground_shells, which is genuinely ms — untouched, correct.- No installer/script in the repo writes hook timeouts, so docs were the only source of bad values.
Non-blocking follow-ups:
docs/feature/hooks-page/ui-design.md(not in this diff) still showstimeout: 5000ms/15000ms/30000msin the mockups at lines 223, 231, 240, 284.- Users who already pasted the old config still have 5000s timeouts. A one-line note in SETUP.md (or a check on the /hooks page flagging timeouts > 600) would help them find it.
the-non-expert
added a commit
that referenced
this pull request
Sep 19, 2026
…n, no orphan menu Review feedback on #101, plus the rebase onto main (#99/#100/#102). - Memoize the transcript scan on (path, st_mtime_ns, st_size). The single- session GET is polled ~1s per open tab and, when RC has never been used, found no bridge_status line anywhere — so every uncached hit re-read and decoded the whole multi-MB chain. A JSONL transcript is append-only, so an unchanged transcript is now scanned exactly once. - Verify a tmux pane still owns the recorded pid before enabling the toggle. pid_is_live_claude accepts node/bun/deno, so a recycled pid in a recycled pane could have enabled RC on a *different* Claude session. The pane's pane_pid must now be that pid or an ancestor of it; unverifiable => refused. - Require Origin on the toggle, not just "trusted if present". For a keystroke-injecting endpoint, no-Origin isn't worth the benefit of the doubt: this closes DNS-rebinding and the no-Origin-same-origin-POST corner. - Drop the "Esc-dismisses" claim in read_remote_control_state — nothing here sends Esc. A stale "off" (session launched with --remote-control, no bridge_status line) meant the ON click opened the *disconnect* menu and left it open in an unfocused terminal, where the user's next Enter picks an item. Unconfirmed ON now raises the terminal like the OFF path and says so. ConversationHeader: #100's ResumeSessionButton supersedes this branch's live-session hide (it focuses the terminal when live, which is useful), so the rebase keeps #100's version outright and drops the copy-resume block. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
7 of 12 tasks
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
Claude Code's hook
timeoutfield is in seconds, not milliseconds.SETUP.mdand captain-hook's docs told users to install"timeout": 5000(intended as 5s), which actually installs an 83-minute cancellation window instead. This was live on real systems, not just theoretical — verified on two machines where karma-installed hooks carried the exact5000/15000values straight from the docs.SETUP.md,api/SETUP.md,api/scripts/SETUP.md,captain-hook/README.md,captain-hook/docs/hooks/*, anddocs/about/hooks-guide.md./hooksbrowser page:HookRegistration.timeout_msstored the raw (seconds) value fromsettings.jsonwith no conversion, then displayed it suffixedms— silently reinforcing the same mistake for anyone using karma to audit their own hooks. Renamed totimeout_secondsend-to-end (Pydantic model,api-types.ts, hooks page template).Test plan
pytest -k hookpasses (no dedicatedhook.pytest file exists; ran shell-cron tests to confirm the unrelatedtimeout_msfield onbackground_shellwas untouched)HookRegistrationwithtimeout_secondsand confirmedrouters/hooks.pystill imports cleanly5000/15000-style ms-mistake values or straytimeout_msreferences tied to hooksFixes #98
🤖 Generated with Claude Code
https://claude.ai/code/session_01Gv24uWUqNLigGcTtnGEHQv