Skip to content

test(agent-tools): let the failing bash child flush its output - #589

Merged
1anZhang merged 1 commit into
mainfrom
test/ptc-bash-failing-exit-flush
Nov 4, 2026
Merged

1anZhang merged 1 commit into
mainfrom
test/ptc-bash-failing-exit-flush

Conversation

@1anZhang

@1anZhang 1anZhang commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • keeps the status line after the whole output of a failing command failed intermittently on Linux runners, in both Source verification and Node compatibility.
  • The child command called process.exit(3) right after 400 console.log calls. Node writes to POSIX pipes asynchronously and process.exit() does not wait for them, so queued stdout was dropped before the test could read it.
  • The child now sets process.exitCode = 3. It still exits non-zero and Node flushes stdout first. All assertions are unchanged.

Evidence

Reproduced in a Linux container (arm64, Node 22):

Run Result
The test under CPU load, process.exit(3) 10 of 12 runs failed, with 171 to 385 rows received
The test under CPU load, process.exitCode = 3 12 of 12 runs passed
Same command outside the test, process.exit(3) 70 of 80 runs truncated; the lost bytes match process.stdout.writableLength
Same command on macOS 0 of 40 truncated

This is a test-only change. The bash tool's output read-back was not the cause: it receives everything the child actually wrote.

Port status

packages/agent-tools is shared source. The same one-line test change needs to be ported upstream; it has not been ported yet.

Verification

  • pnpm verify passes on this commit on macOS (17 gates).
  • Linux x64 and Node 24 will be covered by this PR's CI; the reproduction above did not run on them.

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

process.exit() drops stdout still queued on a POSIX pipe, so the 400-row
assertion failed intermittently on Linux runners. Setting process.exitCode
keeps the non-zero exit and lets Node flush before exiting.
@1anZhang
1anZhang merged commit 9a36b05 into main Nov 4, 2026
13 checks passed
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.

1 participant