Conversation
Add reduceToolOutput() applied to function_call_output and custom_tool_call_output items during input normalisation: ANSI and progress noise stripped, successful output capped to its last meaningful lines, failures keep the first error block plus tail lines, and search output is capped per file with remainder notes. Reductions are marked inline; user prose is never reduced. Defaults: on, 20 successful lines, 80 failure lines, 5 matches/file. Set enableToolResultReducer false for byte-identical prior behaviour.
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.
What changed
Adds
reduceToolOutput(output, config)(src/protocol.mjs), applied inside input normalisation before per-turn truncation tofunction_call_outputandcustom_tool_call_outputitems whenenableToolResultReduceris on:[...].+N more matches in <file>note.[tool output reduced by Hyperagent Codex Bridge: N lines -> M].User prose and assistant turns are never reduced — only typed tool-output items. Config:
enableToolResultReducer(default true),maxSuccessfulCommandLines,maxFailedCommandLines,maxSearchMatchesPerFile.Why it saves credits
Tool results are re-sent inside every subsequent turn of a tool loop; noisy logs multiply across turns.
Measured locally (synthetic 184-line failing
npm testlog):Testing
npm test: 79 pass, 0 fail (3 pre-existing skips). New tests cover ANSI stripping, successful-tail retention, failure-block preservation, per-file search caps, prose immunity, and disable-flag pass-through.