Repository navigation
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
3 of 6 tasks
1 task done
This branch has not been deployed
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 #45099
Supersedes #50660 (that one targets
dev; the missing bound is present onv2too).Type of change
What does this PR do?
Session shell output was injected into the next model request in full, up to the capture limit, bypassing the 50 KiB bound applied to normal tool output. A large shell command (for example a
bun typecheckrun with extensive diagnostics) could produce a request that exceeded the model context window, fail asprovider.unknown, and leave the session stranded until a manual compaction.On
v2the shell message reaches the model inpackages/core/src/session/runner/to-llm-message.ts, where theshellcase interpolatedmessage.output?.outputverbatim. This bounds it there, mirroringToolOutput.MAX_BYTES(50 KiB): the full captured output stays in the session record for the user, while the model receives a bounded preview with a clear truncation marker.Truncation is byte-aware and iterates by code point, so multi-byte UTF-8 content is not split into replacement characters at the boundary.
This ports the fix from the
dev-targeted #50660 ontov2.How did you verify your code works?
bun test test/session-runner-message.test.tsfrompackages/core- 30 pass, including two new cases: a 60 KiB ASCII shell output is bounded and carries[truncated: N bytes omitted], and a multi-byte (é) output never contains a replacement character at the boundary.bun typecheckinpackages/core;bun run lint- 0 warnings / 0 errors.Note:
bun run checkstill cannot complete in my Windows checkout becausepackages/app/src/custom-elements.d.tsis a git symlink (mode 120000) materialized as a text file (core.symlinks=false), which fails@opencode/app#typecheckwith TS1128. That is unrelated to this change and passes on a normal checkout.Screenshots / recordings
Not applicable; no UI change.
Checklist