Skip to content

fix(hooks): run the SessionStart setup check async with a 30 s timeout - #254

Open
vicoociv14 wants to merge 1 commit into
bradautomates:mainfrom
vicoociv14:fix/session-start-hook-async
Open

vicoociv14 wants to merge 1 commit into
bradautomates:mainfrom
vicoociv14:fix/session-start-hook-async

Conversation

@vicoociv14

@vicoociv14 vicoociv14 commented Oct 8, 2026 •

Copy link
Copy Markdown

Problem

The SessionStart hook runs check-setup.sh, which starts a Python interpreter and runs setup.py --check. On some Windows machines that takes longer than the hook's 5-second timeout. Endpoint protection that scans every new process is enough to cause it.

When that happens:

  • every session start waits the full 5 seconds;
  • the hook is then killed, so the advisory it exists to print ("setup needs attention") never shows up.

Measured on one Windows 11 machine with Git Bash: the hook hit its 5 s timeout on 48 of 48 recorded session starts (the transcript shows hook_cancelled with timedOut: true). Each start took 7–8 s before the kill.

Change

hooks/hooks.json:

  • "async": true: the check runs in the background, so a session no longer waits on it.
  • timeout raised from 5 to 30: a slow machine still finishes the check and gets its advisory, instead of being cut off.

The script, its output and its exit codes are unchanged. The hook is advisory only (the script always exits 0), so running it in the background loses nothing.

Testing

The JSON is validated and the script is unchanged. Hook behaviour follows Claude Code's documented async and timeout fields. I have no after-measurement on the affected machine yet, so the evidence for the change is the timeout data above.

check-setup.sh starts Python and runs setup.py --check; on some Windows machines (endpoint protection scanning each process) that exceeds the 5 s limit, so every session start waits 5 s and the advisory is killed before it prints. Async keeps start-up unblocked; 30 s lets slow machines finish the check.

Claude-Session: https://claude.ai/code/session_01SKjDx6TxCFiCBj3TkvwGrK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant