hooks: extend stdin-EOF fix to the readers that bypass the shared helper

main

Commit

Karthik Rameshkumar2mo ago

Self-review found the first commit only fixed agents that route through ReadAndParseHookInput. Four readers had their own io.ReadAll(stdin) and so kept the #1398 hang: copilot (readHookEnvelope), pi and external (ParseHookEvent), and the claude-code post-todo path (parseSubagentCheckpointHookInput).

Extract the guard + streaming decode into a shared primitive (ReadHookInputRaw) plus StdinLooksInteractive, and wire the bypassers to it:

  • ReadAndParseHookInput now builds on ReadHookInputRaw.
  • copilot uses ReadHookInputRaw (its parseHookEnvelope needs the raw bytes for key-name fallbacks).
  • pi uses ReadAndParseHookInput[piHookPayload].
  • claude-code post-todo uses ReadAndParseHookInput.
  • external forwards raw stdin bytes verbatim to its subprocess (may be empty/non-JSON), so it keeps io.ReadAll but adds the interactive-terminal guard; the piped-held-open case for external plugins is documented as a residual.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: 01KXDTPJM9G1NDPF654CY8NYCD

Checkpoints

Fix Windows Hooks and Cursor Installation Issues

Claude Code
View session
Checkpoint 1