The run_in_terminal tool description tells the model it gets up to 60KB of output, but the live output-retrieval path caps at 16KB.
Tool description strings at runInTerminalTool.ts#L135 and #L219 both say:
Output is automatically truncated if longer than 60KB to prevent context overflow
There are two MAX_OUTPUT_LENGTH constants with different values:
So every run_in_terminal invocation that produces more than ~16KB of output returns only the last 16KB, regardless of what the tool description claims.
User-visible implications
truncateOutputKeepingTail keeps the tail, so the head is what gets dropped. That's where errors usually live for npm install, pip install, cargo build, pytest -v, git log, etc. The agent reads a truncated tail, confidently concludes "nothing actionable in the output", and the user has to re-run or scroll up to find the real failure.
The model also plans against the wrong budget: told 60KB, it doesn't paginate or filter commands that would exceed 16KB, so the problem compounds on anything verbose.
Shape of the fix
- Pick one number. Either bump
outputHelpers.ts to 60000 (or make it a setting like chat.tools.terminal.maxOutputBytes), or change the description strings to 16KB. The description and the truncation limit must agree.
- Delete
sanitizeTerminalOutput — it's dead code, and having a second MAX_OUTPUT_LENGTH constant in the same module is how this drift happened.
The
run_in_terminaltool description tells the model it gets up to 60KB of output, but the live output-retrieval path caps at 16KB.Tool description strings at runInTerminalTool.ts#L135 and #L219 both say:
There are two
MAX_OUTPUT_LENGTHconstants with different values:runInTerminalHelpers.ts#L51→60000, only used bysanitizeTerminalOutput, which has no non-test callers.outputHelpers.ts#L10→16000, used bygetOutput, which is the only output path reached byrunInTerminalTool,getTerminalOutputTool, andtaskHelpers.So every
run_in_terminalinvocation that produces more than ~16KB of output returns only the last 16KB, regardless of what the tool description claims.User-visible implications
truncateOutputKeepingTailkeeps the tail, so the head is what gets dropped. That's where errors usually live fornpm install,pip install,cargo build,pytest -v,git log, etc. The agent reads a truncated tail, confidently concludes "nothing actionable in the output", and the user has to re-run or scroll up to find the real failure.The model also plans against the wrong budget: told 60KB, it doesn't paginate or filter commands that would exceed 16KB, so the problem compounds on anything verbose.
Shape of the fix
outputHelpers.tsto 60000 (or make it a setting likechat.tools.terminal.maxOutputBytes), or change the description strings to 16KB. The description and the truncation limit must agree.sanitizeTerminalOutput— it's dead code, and having a secondMAX_OUTPUT_LENGTHconstant in the same module is how this drift happened.