fix(tool): do not count a trailing newline as a truncated line - #789
Merged
Ishaan Gangwani (ishaan1124) merged 2 commits intoSep 29, 2026
Conversation
ANIRUDDHA ADAK (aniruddhaadak80)
requested review from
Aayam Bansal (aayambansal) and
Ishaan Gangwani (ishaan1124)
as code owners
September 28, 2026 15:04
|
ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/truncate-phantom-line-count
branch
from
September 29, 2026 04:48
ef4ffe0 to
f200df5
Compare
split(\n) yields a phantom final element for text that ends in a newline, so the preview kept an empty entry and the count included a line that was never removed. A 100-line file truncated to 10 announced 91 lines removed. Drop the trailing newline before splitting.
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/truncate-phantom-line-count
branch
from
September 29, 2026 09:49
f200df5 to
6dd5cd1
Compare
# Conflicts: # CHANGELOG.md
Ishaan Gangwani (ishaan1124)
merged commit Sep 29, 2026
5514c8d
into
synthetic-sciences:main
8 of 9 checks passed
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.
What
Truncate.outputcounted a phantom line for any output ending in a newline, so the "...N lines truncated..." figure it shows the model was one too high and the preview carried a blank entry.Why it matters
That count is how the model judges how much of an output it is missing, printed right under "The tool call succeeded but the output was truncated." Almost every CLI and log file ends in a newline, so this was the common case, not an edge case.
The byte path is unaffected, and the full output written to disk is byte-identical — only the count and the trailing blank preview line change.
Verification
Fails before, passes after:
The new test is the existing
truncates by line countcase plus a trailing newline, so the two together pin both shapes:All 13 pre-existing tests in the file still pass, including the byte-limit, tail-direction, and saved-output cases.
The change
bun run typecheckclean; touched files are Prettier-clean (checked on LF-normalized copies — this Windows checkout hascore.autocrlf=true, which makes Prettier flag every file in the repo).Fixes #788