You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Tool results sent to the LLM are right-padded to the widest line #1590
Every tool result sent to the LLM is right-padded with spaces to the widest line of the result. FormatToolResultForLLM renders the result through the lipgloss tree in renderExpandedTree (internal/tools/formatter.go), and lipgloss.JoinHorizontal pads every line of a block to the block's widest line. A Read of a file with one long line turns every other line of that file into a line of that length. Split out of #1586, where this accounts for most of the gap between the compaction estimate and the provider's prompt_tokens.
Steps to Reproduce
Build a ToolExecutionResult for Bash with an output of "short\n" + 120 x "x" + "\nalso short\n".
Render it with tools.BaseFormatter{}.FormatExpanded(result, body) (what FormatForLLM calls).
Measure the rune length of each line of the Result: block.
Expected Behavior
Lines keep their own length. short is 4 + 5 runes with the tree indent.
On the run in #1586, 58 tool results with 296k chars of content became 1.33M chars once padded. The padding is sent to the provider on every request, and the chars/4 estimate counts it at full weight, which is why estimateTriggerTokens crossed 500k while the provider reported 231k.
Activity
inference-gateway-releaser commentedon Oct 20, 2026
🎉 This issue has been resolved in version 0.234.0 🎉
The release is available on:
Your semantic-release bot 📦🚀