chore(repo): tolerate stdin EPIPE races - #6546
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🤖 AI Review
Codex reported no findings. Of Claude’s six findings, one error-propagation concern and one test-coverage gap are confirmed; four speculative correctness/maintainability concerns are refuted by the subprocess protocols, downstream validation, and actual implementation differences.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟡 MINOR | apps/cli/tests/helpers/cli.ts:397 |
error-handling |
claude | Throwing inside the stdin error-event listener surfaces non-EPIPE failures as uncaught exceptions instead of associating them with the spawned command. |
| ⚪ NIT | apps/cli/tests/helpers/cli.ts:396 |
test-coverage |
claude | No deterministic regression test directly exercises the newly tolerated EPIPE behavior. |
Refuted findings (kept for transparency, not posted as review comments)
packages/config/scripts/semantic-release-path-filter.ts:110(error-handling): Swallowing EPIPE could allow a partial hash list to be treated as complete, silently dropping release commits.
Refuted:git diff-tree --stdinreads hashes until EOF and cannot successfully exit early with an arbitrary partial list. An EPIPE caused by git rejecting the invocation produces a nonzero exit, which lines 119-122 surface; an exit of zero means git completed its stdin protocol.packages/config/scripts/build.ts:74(error-handling): A swallowed EPIPE followed by a zero formatter exit could silently write an empty or truncated generated schema.
Refuted: The fixed oxfmt process must successfully consume and format stdin to exit zero. More importantly, the same build subsequently requires both schema files as JSON at lines 237-240, so empty or malformed output fails the build rather than silently shipping. Trusted package documentation also states that dist is gitignored and rebuilt, contrary to the claim that this corrupts a committed artifact.apps/cli/tests/helpers/cli.ts:398(error-handling): The helper should also swallow ECONNRESET, ERR_STREAM_DESTROYED, ERR_STREAM_WRITE_AFTER_END, and similar codes for the same fast-exit race.
Refuted: For a child-process stdin pipe whose reader exits during this immediate write, Node reports EPIPE. ERR_STREAM_WRITE_AFTER_END is impossible in this single-write-before-end control flow, ERR_STREAM_DESTROYED applies to later writes to an already destroyed stream, and ECONNRESET describes a different transport failure. Swallowing those codes would hide distinct errors.packages/config/scripts/build.ts:77(maintainability): The same five-line EPIPE guard is duplicated three times without explanatory comments.
Refuted: The implementations are not identical: the config scripts catch rejected Bun FileSink operations and narrow unknown errors withinstanceof Error, whereas the CLI helper handles Node EventEmitter stream errors. Only two short predicates are duplicated within the same package, and the trusted conventions do not require extracting such a two-use predicate.
Stats
Claude findings: 6 · Codex findings: 0 · Confirmed: 2 · Refuted: 4 · Uncertain: 0
Models: claude-opus-5 + gpt-5.6-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
Coly010
approved these changes
Sep 9, 2026
7ttp
force-pushed
the
7ttp/child-stdin-epipe-races
branch
from
September 9, 2026 13:45
ce8b69c to
dc94c53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
fixes a flake where a fast exiting child races the parent's
stdin write and rejects with EPIPE instead of the descriptive exit-code error
ref:
& many more runs.....