fix(shell): truncate metadata preview by bytes#29297
Closed
YOMXXX wants to merge 3 commits into
Closed
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #29288: Why it's related: Both PRs address the same core issue—using UTF-8 byte length instead of character/code unit length for shell tool metadata preview truncation. PR #29288 appears to cover the same fix, likely related to issue #29291 that this PR is closing. |
nexxeln
approved these changes
May 26, 2026
Member
|
tests failing, could you pls fix? |
This was referenced May 26, 2026
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.
Issue for this PR
Closes #29291
Type of change
What does this PR do?
Shell tool metadata previews were checking
text.length, which counts UTF-16 code units rather than UTF-8 bytes. Multi-byte output could exceed the metadata byte limit without being preview-truncated, and slicing by code units could start on an invalid surrogate boundary.This PR makes metadata preview truncation use UTF-8 byte length, trims from a valid byte boundary, and reuses the same byte-tail helper in the existing shell output tail path.
How did you verify your code works?
bun test test/tool/shell.test.ts -t "metadata output"bun test test/tool/shell.test.tsbun typecheckPATH="$HOME/.bun/bin:$PATH" .husky/pre-pushScreenshots / recordings
Not applicable; shell metadata behavior only.
Checklist