← Back to PRs

#18900: fix(bootstrap): clarify truncation warning with budget context

by BinHPdev open 2026-02-17 05:25 View on GitHub →
channel: mattermost agents size: S
## Summary - Fix confusing bootstrap file truncation warning that showed the remaining total budget as "limit N" without context, making users think their `bootstrapMaxChars` was being ignored - Warning now distinguishes between per-file limit truncation ("per-file limit 20000") and total budget exhaustion ("budget 8728 of 150000 total remaining; per-file limit 20000") Closes #18690 ## Test plan - [x] New unit tests verify warning message format for both per-file limit and total budget scenarios - [x] `pnpm build` passes - [x] Existing e2e tests for `buildBootstrapContextFiles` remain compatible (warning still contains "limit" substring) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h3>Greptile Summary</h3> Improves the bootstrap file truncation warning message to clearly distinguish between per-file limit truncation and total budget exhaustion. Previously, when files were truncated due to the remaining total budget being lower than `bootstrapMaxChars`, the warning only showed "limit N" without context, confusing users who thought their configured `bootstrapMaxChars` was being ignored. The fix adds conditional warning text: when truncation is due to per-file limit only, it shows "per-file limit 20000"; when the effective limit is reduced by total budget consumption from earlier files, it shows "budget 4000 of 12000 total remaining; per-file limit 20000". This makes the budget allocation transparent to users. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The changes are well-isolated to warning message formatting with comprehensive test coverage. The logic correctly distinguishes between per-file and total budget truncation scenarios. Existing e2e tests verify backward compatibility (warning still contains "limit" substring), and new unit tests validate both warning message formats. No functional behavior changes to the truncation logic itself. - No files require special attention <sub>Last reviewed commit: 20eb125</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs