Skip to content

chore(repo): tolerate stdin EPIPE races - #6546

Merged
7ttp merged 3 commits into
developfrom
7ttp/child-stdin-epipe-races
Sep 9, 2026
Merged

chore(repo): tolerate stdin EPIPE races#6546
7ttp merged 3 commits into
developfrom
7ttp/child-stdin-epipe-races

Conversation

@7ttp

@7ttp 7ttp commented Sep 9, 2026

Copy link
Copy Markdown
Member

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:

@7ttp 7ttp self-assigned this Sep 9, 2026
@7ttp
7ttp requested a review from a team as a code owner September 9, 2026 13:13

@github-actions github-actions 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.

🤖 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 --stdin reads 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 with instanceof 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.

Comment thread apps/cli/tests/helpers/cli.ts
Comment thread apps/cli/tests/helpers/cli.ts
@7ttp
7ttp force-pushed the 7ttp/child-stdin-epipe-races branch from ce8b69c to dc94c53 Compare September 9, 2026 13:45
@7ttp
7ttp enabled auto-merge September 9, 2026 14:52
@7ttp
7ttp added this pull request to the merge queue Sep 9, 2026
Merged via the queue into develop with commit 7e1fd15 Sep 9, 2026
22 checks passed
@7ttp
7ttp deleted the 7ttp/child-stdin-epipe-races branch September 9, 2026 15:03
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