Repository navigation
🤖 tests: wait for background exits instead of fixed sleeps before reading output - #5607
Merged
Merged
Conversation
…ding output Fixes #5606
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
Readiness record for head ed475c8:
Generated with |
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.
Summary
Five tests in
tests/ipc/runtime/backgroundBashDirect.test.tsstarted a short background command, slept a fixed 200 to 500 ms, then read its output once and expected all of it. On Windows CI the command can start writing later than that. The read then returned"", which is the #5606 failure. Each test now waits for the process to exit, using thewaitForProcessExithelper added in #5595 (bounded at 10 s), and then reads. This is a test-only change.Fixes #5606
Root cause
In run 37169294244 (
Test / Windows, merge group at f0ad3c6), "should retrieve output after tools are recreated (multi-message flow)" spawnedecho "MULTI_MSG_…"in the background, waited 200 ms, then read with a newbash_outputtool. It received"".Nothing lost the output. The read simply came before the slow Windows process start had written anything. Once the process exits, a newly created tool instance reads the full output. The fixed test shows this: it still reads through a recreated
bash_output. So no product fix is needed.The same pattern (a fixed sleep, then one read expecting complete output) was in four sibling tests: "should read output files via handle", "should capture stderr output when process exits with error" (which also expects the exit code), "should capture output when script fails mid-execution", and "should handle long-running script that outputs to both streams". I fixed them the same way.
Validation
Reproduced on Linux with a probe (not committed) that delays every background spawn by 0.5 s (
sleep 0.5;before the script), standing in for a slow Windows process start. On main, 4 tests fail, including the exact CI symptom:With this change and the same probe, all 11 tests pass.
Without the probe, the file passes (11 tests,
bun x jest, Bun 1.3.12).make static-checkpasses.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$53.84