Repository navigation
fix(tools): stop right-padding tool result lines sent to the model - #1593
Merged
Merged
Conversation
lipgloss pads every line of a multi-line tree node to the node's widest line, so a Read of a file with one long line reached the model with every line stretched to that width. On the run in #1586 that turned 296k chars of tool output into 1.33M chars, every request. The expanded tree now trims the trailing spaces lipgloss adds, which keeps the compaction estimate near the provider's prompt_tokens and stops sending the padding.
3 tasks
Contributor
|
🎉 This PR is included in version 0.234.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Resolves #1590
Summary
Tool results reach the model through the expanded lipgloss tree, and
lipgloss.JoinHorizontalpads every line of a multi-line node to the node's widest line. A Read of a file with one 120-char line sent every line of that file as 124 runes. On the run in #1586, 58 tool results with 296k chars of content left the CLI as 1.33M chars on every request, which is also why the chars/4 compaction estimate ran 2x above the provider'sprompt_tokens.Changes
renderExpandedTreepasses its output throughtrimLinePadding, which drops the trailing spaces per line. One choke point covers every tool'sFormatExpanded.TestFormatExpandedKeepsLineLengthspins that no line of a rendered result ends in padding and the short line keeps its own length.no docs ticket: internal bug fix, no user-facing behavior change beyond smaller requests.