Skip to content

named-gate child that exits early is misreported as EPIPE (flaky named-gate-diagnostics test) - #603

Open
Rahulstark2 wants to merge 1 commit into
AgentWorkforce:mainfrom
Rahulstark2:fix/named-gate-epipe
Open

Rahulstark2 wants to merge 1 commit into
AgentWorkforce:mainfrom
Rahulstark2:fix/named-gate-epipe

Conversation

@Rahulstark2

@Rahulstark2 Rahulstark2 commented Oct 3, 2026 •

Copy link
Copy Markdown

Summary

Closes #598

Fix word_count_bounds diagnostics incorrectly reporting EPIPE when the child process exits non-zero after closing stdin.

Problem

When wc exits before consuming all of its stdin, Node's spawnSync can set result.error to EPIPE even though the child process has a valid exit status.

Previously, result.error was checked first, so a child that exited with code 2 could incorrectly produce:

word_count_bounds: could not run wc -w: EPIPE

This masked the actual child exit status.

Changes

  • Check result.signal first to preserve signal diagnostics.
  • Check result.status before result.error.
  • Only use result.error when the child has no exit status (status === null).
  • Added a regression test where the stub wc exits with code 2 without reading stdin.
  • The test uses 100,000 bytes of input to trigger the EPIPE condition.

Verification

  • npx vitest run tests/named-gate-diagnostics.test.ts
    • 18/18 tests passed
  • npm run build passed
  • npm run typecheck passed
  • npm run typecheck:tests passed
  • Mutation verification confirmed that reverting the production fix causes the new regression test to fail with EPIPE.

Expected Behavior

With the fix, a child that exits with code 2 is reported as:

word_count_bounds: wc -w exited 2

instead of incorrectly reporting:

word_count_bounds: could not run wc -w: EPIPE

Note

Low Risk
Narrow change to error-message ordering for one named gate plus a test; no auth, data, or API surface impact.

Overview
Fixes word_count_bounds gate diagnostics so a wc -w child that exits with a real status is not mislabeled as could not run wc -w: EPIPE when Node also sets spawnSync’s error after stdin is closed early.

The lowered gate command now checks signal, then non-null exit status (including nonzero), and only falls back to result.error when status === null. A regression test stubs wc to exit 2 with large input to reproduce the flaky EPIPE case and expects exited 2 without EPIPE in stderr.

Reviewed by Cursor Bugbot for commit 48e94b2. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes word_count_bounds diagnostics misreporting EPIPE when a child process exits non-zero after closing stdin. The fix checks signal first, then the exit status, and only uses spawnSync's error when the child has no exit status.

  • A child exiting with code 2 is now reported as wc -w exited 2 instead of could not run wc -w: EPIPE.
  • Adds a regression test using a stub wc that exits 2 without reading 100,000 bytes of stdin.

Written for commit 48e94b2. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e797228-ac48-49be-ab93-9cabe1ca3dc9
  • Autopilot · 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

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

@Rahulstark2

Copy link
Copy Markdown
Author

@khaliqgant @willwashburn

@Rahulstark2

Copy link
Copy Markdown
Author

@khaliqgant Targeted named-gate-diagnostics tests pass locally (18/18).

The Linux artifact workflow is failing in the unrelated authored-parallel-agents.test.ts test due to missing /tmp/.../spans.jsonl. Could you please rerun the workflow once more?

@khaliqgant

Copy link
Copy Markdown
Member

@khaliqgant Targeted named-gate-diagnostics tests pass locally (18/18).

The Linux artifact workflow is failing in the unrelated authored-parallel-agents.test.ts test due to missing /tmp/.../spans.jsonl. Could you please rerun the workflow once more?

Checking this out in the next few days. Thanks for your contributions!

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.

named-gate child that exits early is misreported as EPIPE (flaky named-gate-diagnostics test)

2 participants