From 484804c00a648f4267f3de6c5d1c8285746b4d74 Mon Sep 17 00:00:00 2001 From: "K. Isom" Date: Mon, 28 Sep 2026 18:49:56 -0700 Subject: [PATCH] bxctl: chat_approvals' helper accepts a broken pipe on stdin json_prints_only_json_and_never_asks_brokerd failed once under load: the helper wrote the typed input to a `bxctl chat --json` that never reads stdin and had already exited, and unwrapped the broken pipe. A broken pipe on that write is now accepted; any other error still fails the test, and a test whose input must be read checks the output. Co-Authored-By: Claude Opus 5.5 (1M context) --- crates/bxctl/tests/chat_approvals.rs | 9 ++++++++- docs/plans/M5c2/README.md | 10 ++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/crates/bxctl/tests/chat_approvals.rs b/crates/bxctl/tests/chat_approvals.rs index 0690a66..1a52b56 100644 --- a/crates/bxctl/tests/chat_approvals.rs +++ b/crates/bxctl/tests/chat_approvals.rs @@ -398,8 +398,15 @@ fn chat(loopd: &Path, brokerd: &Path, extra: &[&str], typed: &str) -> std::proce .spawn() .unwrap(); { + // A `bxctl` that never reads stdin (with `--json`, or with no approval to answer) may + // exit before the write: a broken pipe then is not an error. Anything that must be read + // is checked by the test's own assertions on the output. let mut stdin = child.stdin.take().unwrap(); - stdin.write_all(typed.as_bytes()).unwrap(); + match stdin.write_all(typed.as_bytes()) { + Ok(()) => {} + Err(e) if e.kind() == std::io::ErrorKind::BrokenPipe => {} + Err(e) => panic!("writing to bxctl's stdin: {e}"), + } } child.wait_with_output().unwrap() } diff --git a/docs/plans/M5c2/README.md b/docs/plans/M5c2/README.md index a1c96c9..10d6c0c 100644 --- a/docs/plans/M5c2/README.md +++ b/docs/plans/M5c2/README.md @@ -104,13 +104,11 @@ The gate count is the passed total of `cargo test --workspace` plus one, for the | 05 | 1403 | 24, 24 | | 06 | 1414 | 22, 22 | -**Known flaky test** (T52): `bxctl`'s `chat_approvals` test +**A flaky test, fixed before the run:** `bxctl`'s `chat_approvals` test `json_prints_only_json_and_never_asks_brokerd` failed once in 5 loaded runs of the whole workspace -while task 06 was checked (and 0 in 60 runs of that file alone under load). It writes to the -standard input of a `bxctl chat --say` that does not read it and may already have exited, and -`write_all` fails with a broken pipe. No task of this plan touches `bxctl`'s chat. A session -that sees it fail once, then pass on a rerun and in the gate, names it in its row's Notes and -goes on. +while task 06 was checked: its helper wrote to the standard input of a `bxctl chat` that does not +read it and may already have exited, and unwrapped the broken pipe. The helper now accepts a +broken pipe on that write (master, after task 06); 0 failures in 100 loaded runs. ## Before hand-over