external: stream hook input too, closing the last EOF-wait path (#1398)

main

Commit

Karthik Rameshkumar2mo ago

Trail review correctly flagged that external.ParseHookEvent still used io.ReadAll(io.LimitReader(stdin, …)) for the piped case, so an external/ plugin agent that keeps the stdin pipe open after delivering its payload would still hang forever — the exact #1398 bug the rest of the PR fixes. The StdinLooksInteractive guard only covered the TTY/no-payload case.

The external "parse-hook" contract receives the host's hook payload, which is JSON (verified by the agent's own tests/fixtures), and forwards its raw bytes to the subprocess. So it can stream a single JSON value like every other agent. Add ReadHookInputRawLimited (ReadHookInputRaw with a byte ceiling) so external keeps its 10 MB bound without waiting for EOF, and forward the decoded raw bytes verbatim. No behavior change to the subprocess payload.

Adds regression tests: the bounded reader returns before stdin EOF, and rejects an over-limit payload instead of reading unbounded.

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

Checkpoints

Fix Windows Hooks and Cursor Installation Issues

Claude Code
View session
Checkpoint 1