nanocoder
nanocoder copied to clipboard
[Bug] execute_bash keeps the first 5 MB of output and drops the end, where build and test summaries are
Description
Each output stream is capped at 5 MB, and the cap keeps the start and drops everything after it. For a command with very long output, the summary at the end never reaches the model. PR #777 (for #764) made the final trimming head plus tail, but it only works on the data that is left after this cap.
Environment
- OS: Windows 11 Home 10.0.26300
- Node version: v22.22.3
- Nanocoder version: 1.32.0 (built from main at 5df35b3a)
- Provider: Not provider-specific
- Model: Not model-specific
Steps to Reproduce
-
Call
execute_bashwith:node -e "for(let i=0;i<200000;i++)console.log('progress line '+i+' ok ok ok ok ok ok'); console.log('SUMMARY: 1 failed'); process.exit(1)"
Expected Behavior
The model sees the start and the end of the output, including SUMMARY: 1 failed.
Actual Behavior
The result stops at about line 137,281 and ends with a truncation marker. The summary line is missing.
Logs/Screenshots
...progress line 137281 ok ok ok o
... [Output truncated to prevent memory exhaustion]
(With 120,000 lines the summary is present, so this only affects output above 5 MB.)
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder (main)
Suggested fix:
source/utils/stream-collector.ts:44(makeStreamCollector) stops appending afterBASH_MAX_OUTPUT_BYTES(source/constants.ts:173). Keep a bounded head and a rolling tail buffer, and add an "N bytes omitted" marker between them.- Add a test with output larger than the cap and a final summary line.
Related: #764 (closed), PR #777.
happy to help @addyCooks