Repository navigation
fix(terminal): preserve Unicode boundaries when truncating output - #1186
Merged
Olga Lavrichenko (OLavrik) merged 3 commits intoNov 5, 2026
Conversation
Afloat (Afloat16)
requested review from
Olga Lavrichenko (OLavrik),
Rustam Sadykov (SBOne-Kenobi),
danyaberezun and
Rinat S (rsolmano)
as code owners
November 3, 2026 15:11
Olga Lavrichenko (OLavrik)
approved these changes
Nov 5, 2026
Olga Lavrichenko (OLavrik)
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! Nice catch on the orphaned low surrogate, and the backpressure test is a good touch.
Olga Lavrichenko (OLavrik)
enabled auto-merge
November 5, 2026 10:25
…ual edge distance, since wheeling to the bottom-most Submit row can legitimately re-attach follow.
Contributor
Author
|
Thanks for the review and the E2E follow-up. I checked 9f683b6 against the approved 843c8f2: the only additional change is your follow-state assertion adjustment in The CI run for the current head is awaiting maintainer approval, and the required |
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.
Problem
When pending terminal output exceeds its ceiling, slicing by UTF-16 code units can retain the low half of a surrogate pair. The next delivered batch then starts with a replacement character. This also occurs while the connection is backpressured.
Approach
If the truncation boundary bisects a high/low surrogate pair, move it forward by one code unit. The retained output still fits the configured ceiling and preserves complete pairs that already fit.
Changes
Add normal, exact-boundary and backpressure regression cases. Document the UTF-16 ceiling and whole-character truncation in the terminal specification.
Screenshots
Not applicable — no frontend changes.
Validation
bun:testaliased to Vitest; test assertions and production source were unchanged by the runner.packages/server/src/terminal/outputBatcher.test.ts.git diff --check: passed.Checklist
bun run lint,bun run typecheck,bun run testbun run e2e, orbun run e2e:fullwhen touching agent behavior)SPEC.md/ top-level specs updated to reflect any boundary, contract, or behavior change