Compare commits

..
3 Commits
Author SHA1 Message Date
BellmanandWatch 0492eb3aa5 release: v0.1.16 (#3411)
- Bump version 0.1.15 -> 0.1.16
- Add CHANGELOG entry for #3410 hook BrokenPipe fix

Co-authored-by: Watch <watch@local>
2026-11-27 20:46:25 +00:00
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
Bellmanandclawdbot 0210856f6b docs(changelog): correct v0.1.15 gateway docs attribution (#3409)
Co-authored-by: clawdbot <clawdbot@ultraworkers.dev>
2026-11-27 05:10:42 +00:00
5 changed files with 49 additions and 15 deletions

No files matched your search

+8 -1
View File
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.16] - 2026-11-27
### Fixed
- Hooks no longer fail with BrokenPipe when a hook exits without reading a stdin payload larger than the pipe buffer (#3410)
## [0.1.15] - 2026-11-27
### Added
@@ -13,7 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Documentation: document WorldRouter OpenAI-compatible gateway setup (#3399)
- Documentation: document WorldRouter OpenAI-compatible gateway setup (d53a0882)
- Documentation: document onomeo OpenAI-compatible gateway setup (#3399)
- Documentation: document Straitly OpenAI-compatible gateway setup (#3400)
- Documentation: document TeamoRouter OpenAI-compatible gateway setup (#3402)
- Documentation: document TrustedRouter OpenAI-compatible gateway setup (#3403)
+11 -11
View File
@@ -93,7 +93,7 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "api"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"criterion",
"reqwest",
@@ -478,7 +478,7 @@ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
[[package]]
name = "claw-analog"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"api",
"clap",
@@ -498,7 +498,7 @@ dependencies = [
[[package]]
name = "claw-rag-service"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"axum 0.8.9",
"blake3",
@@ -531,7 +531,7 @@ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
[[package]]
name = "commands"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"plugins",
"runtime",
@@ -540,7 +540,7 @@ dependencies = [
[[package]]
name = "compat-harness"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"commands",
"runtime",
@@ -1568,7 +1568,7 @@ dependencies = [
[[package]]
name = "mock-anthropic-service"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"api",
"serde_json",
@@ -1761,7 +1761,7 @@ dependencies = [
[[package]]
name = "plugins"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"serde",
"serde_json",
@@ -2136,7 +2136,7 @@ dependencies = [
[[package]]
name = "runtime"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"getrandom 0.2.17",
"glob",
@@ -2263,7 +2263,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "rusty-claude-cli"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"api",
"commands",
@@ -2624,7 +2624,7 @@ dependencies = [
[[package]]
name = "telemetry"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"serde",
"serde_json",
@@ -2904,7 +2904,7 @@ dependencies = [
[[package]]
name = "tools"
version = "0.1.15"
version = "0.1.16"
dependencies = [
"api",
"aspect-core",
+1 -1
View File
@@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"
[workspace.package]
version = "0.1.15"
version = "0.1.16"
edition = "2021"
license = "MIT"
publish = false
+1 -1
View File
@@ -82,7 +82,7 @@ async fn send_message_posts_json_and_parses_response() {
);
assert_eq!(
request.headers.get("user-agent").map(String::as_str),
Some("claude-code/0.1.15")
Some("claude-code/0.1.16")
);
assert_eq!(
request.headers.get("anthropic-beta").map(String::as_str),
+28 -1
View File
@@ -802,7 +802,16 @@ impl CommandWithStdin {
) -> std::io::Result<CommandExecution> {
let mut child = self.command.spawn()?;
if let Some(mut child_stdin) = child.stdin.take() {
child_stdin.write_all(stdin)?;
// A hook that exits without reading all of its stdin closes the pipe
// while the payload is still being written, which fails with
// `BrokenPipe`. That is not a hook failure: its exit status and
// output are still collected below. Same handling as the plugin hook
// runner in `plugins/src/hooks.rs`.
match child_stdin.write_all(stdin) {
Ok(()) => {}
Err(error) if error.kind() == std::io::ErrorKind::BrokenPipe => {}
Err(error) => return Err(error),
}
}
loop {
@@ -860,6 +869,24 @@ mod tests {
assert_eq!(result, HookRunResult::allow(vec!["pre ok".to_string()]));
}
#[test]
#[cfg(unix)]
fn hook_that_ignores_stdin_is_not_failed_by_a_payload_larger_than_the_pipe() {
// The hook never reads stdin and exits while the runner is still writing
// a payload that does not fit in the pipe buffer, so the write fails with
// `BrokenPipe`. The hook itself succeeded and must not be reported as failed.
let runner = HookRunner::new(RuntimeHookConfig::new(
vec![crate::test_hook("pre ok", "", 0, 0)],
Vec::new(),
Vec::new(),
));
let tool_input = serde_json::json!({ "content": "x".repeat(70_000) }).to_string();
let result = runner.run_pre_tool_use("write_file", &tool_input);
assert_eq!(result, HookRunResult::allow(vec!["pre ok".to_string()]));
}
#[test]
fn object_style_hook_matchers_filter_runtime_execution() {
let runner = HookRunner::new(RuntimeHookConfig::from_hook_commands(