Skip to content

fix(read): ignore broken pipe for partial output - #2590

Open
YOMXXX wants to merge 1 commit into
rtk-ai:developfrom
YOMXXX:fix/issue-2468-read-broken-pipe
Open

YOMXXX wants to merge 1 commit into
rtk-ai:developfrom
YOMXXX:fix/issue-2468-read-broken-pipe

Conversation

@YOMXXX

@YOMXXX YOMXXX commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • handle BrokenPipe while writing rtk read output instead of panicking
  • skip gain tracking when downstream consumers stop reading before the full read output is delivered
  • add a regression test for rtk read <file> | head -c ... with an isolated tracking DB

Issue

Addresses #2468 for the rtk read broken-pipe/partial-output path.

Verification

  • cargo +1.93.0 test --all -- --skip small_grep_not_worse_than_plain before changes: passed
  • cargo +1.93.0 test --test read_broken_pipe_test -- --nocapture before fix: failed with failed printing to stdout: Broken pipe
  • cargo +1.93.0 test --test read_broken_pipe_test -- --nocapture: passed
  • cargo +1.93.0 test read::tests -- --nocapture: passed
  • cargo +1.93.0 fmt --check: passed
  • git diff --check: passed
  • cargo +1.93.0 clippy --all-targets: passed
  • cargo +1.93.0 test --all -- --skip small_grep_not_worse_than_plain: passed

kylehgc added a commit to kylehgc/rtk that referenced this pull request Jul 23, 2026
- Conflict list: drop rtk-ai#2579/rtk-ai#2590/rtk-ai#2615 (already flagged 07-17), add
  rtk-ai#2401/rtk-ai#2453 and the chunk-7 conflict cluster; note top-pick rtk-ai#2401 is
  a hand-port (issue #54).
- Next-wave: restore recovered candidate rtk-ai#2256 (gh prompt-injection
  scan) dropped in distillation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

@KuSh

KuSh commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

#1048 (merged 2026-05-29) resets SIGPIPE to its default in main, so on Linux and macOS rtk read <file> | head -c 10 already exits cleanly without recording a gain row. What develop still lacks from this branch is the BrokenPipe-tolerant write around the two print! calls in src/cmds/system/read.rs, which still matters on platforms without SIGPIPE such as Windows, together with tests/read_broken_pipe_test.rs. Could you rebase onto current develop and narrow the PR to that part? read.rs has since been restructured around head and tail windows, so expect conflicts, but the two print sites you wrap are still there. The window paths in the same file still turn a closed pipe into a "Failed to write line window" error on Windows; your helper could cover them here, or they can go to a separate narrow PR. Thanks for the fix.

@rtk-release-bot rtk-release-bot Bot removed the stale label Oct 5, 2026
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.

2 participants