Skip to content

claude-code: add timeout to session-start hook#1237

Open
MuskanPaliwal wants to merge 3 commits into
entireio:mainfrom
MuskanPaliwal:fix-claude-hook-launch-timeout
Open

claude-code: add timeout to session-start hook#1237
MuskanPaliwal wants to merge 3 commits into
entireio:mainfrom
MuskanPaliwal:fix-claude-hook-launch-timeout

Conversation

@MuskanPaliwal
Copy link
Copy Markdown

@MuskanPaliwal MuskanPaliwal commented May 20, 2026

refs #1065

adds Claude Code native hook timeout to the production SessionStart hook. This makes Claude Code fail open if launching entire hooks claude-code session-start stalls before the entire process reaches Go code.

the reported hang is not specific to hook stdin parsing or the session-start handler: entire --version can also hang in the affected environment, and the sample shows the process stuck in _dyld_start. That means Cobra, hook parsing, logging, and any internal Go timeout have not started yet.

code changes

  • adds optional timeout support to Claude Code hook entries.
  • installs production Claude Code SessionStart hooks with timeout: 5.
  • backfills timeout: 5 onto existing Entire-owned production SessionStart hooks when hooks are reinstalled.
  • leaves local-dev hook installs unchanged.

why this approach

because the failure can happen before Go main() starts, the timeout needs to live outside the child entire process. Claude Code per-hook timeout is the right boundary: it can cancel the stalled hook launch and continue startup instead of waiting indefinitely.

this keeps the mitigation small and avoids adding a separate shell watchdog or changing the hook command shape.

test plan

  • go test ./cmd/entire/cli/agent/claudecode
  • go test ./cmd/entire/cli/agent/...
  • mise run lint

release notes

  • breaking changes: None.
  • version impact: patch-level bug fix.
  • rollout notes: fresh installs get the timeout immediately; existing users get it when Claude Code hooks are reinstalled or refreshed.
Screenshot 2026-05-20 at 7 07 56 PM

@MuskanPaliwal MuskanPaliwal marked this pull request as ready for review May 20, 2026 14:32
@MuskanPaliwal MuskanPaliwal requested a review from a team as a code owner May 20, 2026 14:32
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant