Fix script output dropping last line without trailing newline#4995
Open
denik wants to merge 6 commits into
Open
Fix script output dropping last line without trailing newline#4995denik wants to merge 6 commits into
denik wants to merge 6 commits into
Conversation
denik
added a commit
that referenced
this pull request
Apr 16, 2026
denik
added a commit
that referenced
this pull request
Apr 22, 2026
a86395c to
f43f4d2
Compare
denik
added a commit
that referenced
this pull request
Apr 29, 2026
denik
added a commit
that referenced
this pull request
Apr 29, 2026
Drop the placeholder Bundles changelog line that was never replaced when the PR-linked entry was added, leaving a single entry referencing #4995. Also remove TestExecuteNoScript which only re-exercises the trivial getCommand early-return without adding coverage for the fix. Task: 007.md Task-review: /home/denis.bilenko/work/prompts-features/cli/random-bugfixes-4/006.SUMMARY.md Co-authored-by: Isaac
denik
added a commit
that referenced
this pull request
Apr 29, 2026
f43f4d2 to
7802668
Compare
shreyas-goenka
approved these changes
May 18, 2026
Collaborator
|
Commit: 966f67f |
bufio.Reader.ReadString returns both data and io.EOF when the stream ends without a delimiter. The old loop condition `for err == nil` caused the last line of output to be silently dropped when it lacked a trailing newline. This affected any bundle script (experimental.scripts hooks) whose output didn't end with `\n`. Restructure the loop to always process data before checking for errors, which is the idiomatic Go pattern for ReadString. Task: 001.md Co-authored-by: Isaac
This test demonstrates the bug where the last line of script output was dropped when it didn't end with a trailing newline. Running this test with -useversion 0.296.0 shows the bug: "line without newline" is missing from the output. Task: 002.md Co-authored-by: Isaac
Drop the placeholder Bundles changelog line that was never replaced when the PR-linked entry was added, leaving a single entry referencing #4995. Also remove TestExecuteNoScript which only re-exercises the trivial getCommand early-return without adding coverage for the fix. Task: 007.md Task-review: /home/denis.bilenko/work/prompts-features/cli/random-bugfixes-4/006.SUMMARY.md Co-authored-by: Isaac
When a test script is killed by the timeout, the test directory holds partial state: any "out.*" files reflect an incomplete recording and output.txt contains only the prefix that streamed before the kill. Previously `make test-update` would overwrite committed reference files with this partial state and emit untracked "out.requests.txt" files across cluster, deploy, and template tests. Wrap the timeout error with the errScriptTimedOut sentinel and gate OverwriteMode on errors.Is matching it. Also short-circuit the unexpected-files loop so leftover partial files are not flagged or written. Existing comparisons still run, so selftest/timeout keeps passing. Task: 009.md Co-authored-by: Isaac
966f67f to
e0c91f9
Compare
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.
Changes
Fix
experimental.scriptshooks silently dropping the last line of output when it doesn't end with a trailing newline (e.g.printf "done").Tests
Added acceptance test at
acceptance/bundle/scripts/no-trailing-newline/and unit tests for the script executor.Running the acceptance test against the previous release demonstrates the bug:
v0.296.0 drops "line without newline" because the last line has no trailing
\n. The fix correctly includes it.