#18900: fix(bootstrap): clarify truncation warning with budget context
channel: mattermost
agents
size: S
Cluster:
Bootstrap and Plugin Fixes
## 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
#19826: fix: add in-prompt warnings and doctor check for bootstrap file tru...
by akramcodez · 2026-02-18
79.3%
#21954: Prevent bootstrap hook truncation crash in prompt report
by graysurf · 2026-02-20
68.7%
#20076: feat(tool-truncation): use head+tail strategy to preserve errors du...
by jlwestsr · 2026-02-18
67.7%
#8617: fix: truncate large console payloads before writing to file log
by dbottme · 2026-02-04
67.6%
#23803: Fix tool metadata truncation
by kamal-ayman · 2026-02-22
66.1%
#18997: fix: improve context overflow error messages and docs
by realhoratiobot · 2026-02-17
65.8%
#19878: fix: Handle compaction when fallback model has smaller context window
by gaurav10gg · 2026-02-18
65.3%
#19879: Feat/foropenclaw bootstrapfiles clean
by akyourowngames · 2026-02-18
65.1%
#17896: fix(config): warn instead of silently swallowing chmod failure on c...
by PlayerGhost · 2026-02-16
64.9%
#16015: fix(gateway): truncate oversized message content in chat.history re...
by fagemx · 2026-02-14
64.8%