8000 fix(minimal): exit quietly when version output hits a closed pipe by gominimal-aw-bot[bot] · Pull Request #1894 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal): exit quietly when version output hits a closed pipe - #1894

Merged
norrietaylor merged 2 commits into
mainfrom
inbox-patch/fix/version-broken-pipe-quiet-exit-5804b29a2b881b08
Oct 4, 2026
Merged

norrietaylor merged 2 commits into
mainfrom
inbox-patch/fix/version-broken-pipe-quiet-exit-5804b29a2b881b08

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABUywAcw

min version | head -1 panicked with failed printing to stdout: Broken pipe (exit 101). Rust ignores SIGPIPE, so println! panics on EPIPE: cmd_version prints the client line, then waits on the GetVersion RPC, then prints the server/stdlib lines — by which time head has exited.

Fix: route cmd_version output through an injected writer (writeln! with ?), so a closed reader surfaces as an io::Error; classify BrokenPipe in run() and exit quietly with 141 (128 + SIGPIPE) instead of printing an error. (informed by ADR-0001)

Verification

  • cargo fmt --all --check — passed
  • cargo build --workspace --locked — passed
  • cargo clippy -p minimal --no-deps --locked -- -D warnings — passed
  • cargo test -p minimal --locked --test cli — 43 passed
  • cargo test -p minimal --locked --bin min broken_pipe — passed
  • cargo run --bin min --locked -- version 2>/dev/null | head -1 — prints client line, exit 0

Note: full-workspace cargo clippy --workspace --locked -- -D warnings fails on pre-existing code in crates/args/src/lib.rs (lint needless_borrows_for_generic_args, new in stable 1.99.0; repo pins 1.97.0), and cargo test --workspace --locked has one pre-existing failure in tests::legacy_network_spellings_parse_with_hint (stderr capture returns empty). Neither file is touched by this change.

Summary by CodeRabbit

  • Bug Fixes
    • Version information is now written through the command’s output stream, and output write errors are handled correctly.
    • Piping command output to a destination that closes early now exits quietly with the expected status instead of displaying an error. Other errors continue to be reported.

min version | head -1 panicked with a broken-pipe error (exit 101)
because cmd_version wrote to stdout via println!, which panics on
EPIPE since Rust ignores SIGPIPE by default.

Route cmd_version's output through an injected writer so a closed
reader surfaces as an io::Error, and classify BrokenPipe in run() to
exit quietly with 141 (128 + SIGPIPE) instead of printing an error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner October 3, 2026 15:37
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Oct 3, 2026
@coderabbitai
coderabbitai Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

  • Run on-demand review

This review includes 3 billable files and costs up to $0.75.

Or wait 55 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 8d43c7fe-cb1c-489f-a1f8-a979235718dd
📥 Commits

Reviewing files that changed from the base of the PR and between 64a3758 and 6545303.

📒 Files selected for processing (3)
  • crates/minimal/src/cmd/mod.rs
  • crates/minimal/src/main.rs
  • crates/minimal/tests/cli.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: acb64b32-a6a1-4f21-b5d9-4b0c3d8f4079
📥 Commits

Reviewing files that changed from the base of the PR and between 3bf6b09 and 64a3758.

📒 Files selected for processing (4)
  • crates/minimal/src/cmd/admin.rs
  • crates/minimal/src/cmd/mod.rs
  • crates/minimal/src/main.rs
  • crates/minimal/tests/cli.rs

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The version command now writes its output to a supplied writer. The CLI passes locked stdout and exits quietly with code 141 when an error chain contains a broken-pipe error.

Changes

CLI output handling

Layer / File(s) Summary
Version output writer
crates/minimal/src/cmd/admin.rs, crates/minimal/src/cmd/mod.rs, crates/minimal/tests/cli.rs
cmd_version writes the client, daemon, and stdlib version lines to a supplied writer and propagates write errors. Dispatch passes locked stdout. The CLI tests pass a writer to the command.
Broken-pipe exit handling
crates/minimal/src/main.rs
run exits with code 141 without printing an error when the error chain contains a broken-pipe error. A test checks wrapped broken-pipe errors and an unrelated error.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: 0chroma

Merge Risk: ⚪ Minimal · up to 64a37

Piped version output is intended to stop quietly when the reader closes the pipe. The supplied change context shows that write failures reach the quiet broken-pipe handler, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 4 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: quietly handling broken pipes during version output. It follows the repository’s Conventional Commit format.
Description check ✅ Passed The description explains the problem, the fix, and verification results. It uses “Verification” instead of the template’s “Testing” heading and omits the checklist, but it is otherwise substantially c…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the output stream,
Version lines hop along the beam.
If broken pipes stop the flow,
A quiet exit follows so.
Then I nibble greens below.

Comment @coderabbitai help to get the list of available commands.

@gominimal-aw-bot gominimal-aw-bot Bot added the agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch label Oct 3, 2026
@norrietaylor norrietaylor changed the title fix: Exit quietly when version output hits a closed pipe fix(minimal): exit quietly when version output hits a closed pipe Oct 3, 2026
Pass the unlocked stdout handle so the lock is not held across the
daemon handshake, exit quietly on a broken pipe only for `min version`,
and test that cmd_version surfaces a closed writer as a broken pipe.
@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry
minimal-foundry Bot commented Oct 4, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at 6545303cbdb8.

Nothing to do.

Clobber: none: git log on the four files shows only this PR's own two commits (the second scoping the quiet exit to version output), with no earlier fix reverted.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 4, 2026
8000 @norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 6545303: minimal-review approved at head, 0 open threads, all lanes green.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 4, 2026
Merged via the queue into main with commit 96d860d Oct 4, 2026
35 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/fix/version-broken-pipe-quiet-exit-5804b29a2b881b08 branch October 4, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0