Files
claw-code/rust/crates/runtime
Jay Pokale 365fa14cf8 fix(runtime): tolerate BrokenPipe when writing the hook payload to stdin (#3410)
A hook that exits without reading all of its stdin closes the pipe while
CommandWithStdin::output_with_stdin is still writing the JSON payload.
The write fails with BrokenPipe, and the error was propagated, so the hook
was reported as "failed to start ...: Broken pipe (os error 32)" even
though it ran and exited normally. A failed PreToolUse hook then denies
the tool call, and a failed PostToolUse hook marks the tool result as an
error.

Any payload larger than the pipe buffer (64 KiB on Linux) triggers it for
a hook that does not read stdin. The payload carries tool_input twice, so
a write_file of about 40 KB is enough.

plugins/src/hooks.rs already tolerates BrokenPipe for the same reason
(ROADMAP #25). Apply the same handling to the runtime hook runner, and
add a regression test.
2026-11-27 20:34:02 +00:00
..