Repository navigation
Notify about a background command only once its output file is complete - #445
Merged
Merged
Conversation
The command's output reaches its log file through an asynchronous write stream, and the completion notice went out as soon as the command ended. A model reading the file right after the notice could get it without its tail; on CI this failed the cap test (ilovepixelart#441, ilovepixelart#443) and the one-copy test. Settling now waits for the stream to close. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sproott
force-pushed
the
fix-bash-cap-test
branch
from
November 15, 2026 01:08
30a42b6 to
f88809d
Compare
With every write to the output file delayed by 150 ms, the notice for `echo finished` arrived while the file was still empty. The test fails with "expected '' to contain 'finished'" when the notice is sent before the stream has closed.
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.
A background command's output reaches its file through
fs.createWriteStream, and the completion notice was sent as soon as the command ended. A model reading the file right after the notice could find it empty or without its tail.On Windows CI this failed two tests in
tests/background-bash.test.ts:expected '' to contain 'finished'expected 1720 to be greater than 4096The command is now settled, and its notice sent, once the output stream has closed.
A new test delays every write to the output file by 150 ms and reads the file when the notice arrives. It fails without the change with
expected '' to contain 'finished'.npm run checkpasses (Biome, strict tsc, Vitest)