Skip to content

fix(fleet): quiet exit on broken pipe — SIGPIPE default + EPIPE-safe secrets output (#5569) - #6225

Merged
dezren39 merged 1 commit into
mainfrom
queue/10517-5569-epipe-fix
Nov 5, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/10517-5569-epipe-fix

Conversation

@dezren39

@dezren39 dezren39 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Fixes #5569 — fleet secrets list | head panicked with failed printing to stdout: Broken pipe when the downstream pipe closed early.

What changed

  • crates/fleet/src/main.rs — restore the default SIGPIPE disposition at startup (restore_default_sigpipe, unix only). The Rust runtime ignores SIGPIPE, so a println! in any domain panics on EPIPE. With the default disposition the process dies quietly by SIGPIPE, like a well-behaved Unix filter, whichever verb is printing. This is the shared-path fix: the audit found no shared print helper — queue, search, and secrets each print independently — so the shared entry point is where the class is fixed.
  • crates/fleet/src/secrets.rs — secrets list and secrets get now write through a locked stdout with writeln!, classifying the outcome via write_line: BrokenPipe → quiet EXIT_OK; any other write error stays loud (EXIT_UNRESOLVED + stderr). Only EPIPE gets the quiet path — genuine write errors are not masked.
  • Cargo.toml / Cargo.lock — libc as a unix-only direct dependency of the fleet bin (already in the lockfile as a transitive dep) for the disposition reset.

Tests (oracle: writer outcomes + the binary's pipe behaviour)

  • New unit tests in secrets.rs with a failing-writer oracle: BrokenPipe maps to the quiet outcome, other errors (StorageFull) stay loud, and a successful write is byte-exact. cargo test -p fleet --bin fleet: 13 passed, 0 failed (laptop).
  • Scripted repro on the built binary: fleet --help | head -1 × 30 — 0 panics (pre-fix this class panicked via println!; triage task 10082 reproduced the panic on secrets list itself, 1-in-10 racy).
  • cargo fmt --check clean. Local cargo clippy could not run to completion on the laptop due to a pre-existing stale-target toolchain skew (E0514 in untouched crates fleet-config/fleet-proxy-proto); CI's fresh clippy run is the check for that.

Audit note (acceptance: other list-shaped verbs)

Queue and search do not share the secrets print path (verified: independent println! sites in fleet-queue/fleet-search), so they did not share this exact defect path; the SIGPIPE disposition reset in main() covers their early-close behaviour when run through the fleet binary.

Queue task 10517 (lane code-c), follow-up to triage task 10082.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 5, 2026 13:14
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ad732bf8-0bd8-4c66-943b-5dc0046d2715
Commits

Reviewing files that changed from the base of the PR and between 04f7869 and a373670.

Files ignored due to path filters: 1

  • pkgs/fleet/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 3

  • pkgs/fleet/crates/fleet/Cargo.toml
  • pkgs/fleet/crates/fleet/src/main.rs
  • pkgs/fleet/crates/fleet/src/secrets.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T13:16:14.292078Z a373670 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 4d28b5e into main Nov 5, 2026
1 check passed
@dezren39
dezren39 deleted the queue/10517-5569-epipe-fix branch November 5, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet secrets list: broken-pipe panic when stdout closes early (e.g. piped to head)

1 participant