fix: improve context overflow error messages and docs#18997
fix: improve context overflow error messages and docs#18997realhoratiobot wants to merge 1 commit intoopenclaw:mainfrom
Conversation
- Include context window size, source, and message count in overflow error - Add actionable suggestions: reduce workspace files, lower bootstrapMaxChars - Document compaction config keys with examples in docs - Add troubleshooting section for context overflow - Clarify that autoCompact is not a config key (common user confusion) - Improve diagnostic logging with contextWindow and contextSource fields Closes openclaw#5771
|
@greptileai please review |
| const fallbackText = isContextOverflow | ||
| ? "⚠️ Context overflow — prompt too large for this model. Try a shorter message or a larger-context model." | ||
| ? "⚠️ Context overflow — prompt too large for this model. Try /reset or /new for a fresh session, reduce workspace files, or switch to a larger-context model." |
There was a problem hiding this comment.
E2e test expects the old message string
The test in reply.triggers.trigger-handling.ignores-inline-elevated-directive-unapproved-sender.e2e.test.ts (line 140-142) uses toBe() (exact match) against the previous message:
"⚠️ Context overflow — prompt too large for this model. Try a shorter message or a larger-context model."
But this line now returns:
"⚠️ Context overflow — prompt too large for this model. Try /reset or /new for a fresh session, reduce workspace files, or switch to a larger-context model."
That test needs to be updated to match the new message, otherwise it will fail.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/agent-runner-execution.ts
Line: 543:544
Comment:
**E2e test expects the old message string**
The test in `reply.triggers.trigger-handling.ignores-inline-elevated-directive-unapproved-sender.e2e.test.ts` (line 140-142) uses `toBe()` (exact match) against the previous message:
```
"⚠️ Context overflow — prompt too large for this model. Try a shorter message or a larger-context model."
```
But this line now returns:
```
"⚠️ Context overflow — prompt too large for this model. Try /reset or /new for a fresh session, reduce workspace files, or switch to a larger-context model."
```
That test needs to be updated to match the new message, otherwise it will fail.
How can I resolve this? If you propose a fix, please make it concise.|
Closing as AI-assisted stale-fix triage. Linked issue #5771 ("[Bug]: Context overflow error") is CLOSED and was closed on 2026-02-23T16:33:28Z with state reason COMPLETED. If the behavior is still reproducible on current main, reopen #18997 (or open a new focused fix PR) and reference #5771. |
Summary
Improves the user experience when hitting context overflow errors (#5771).
Changes
Error messages (src)
bootstrapMaxChars, use/resetcontextWindowandcontextSourcefieldsDocumentation (docs)
agents.defaults.compactionconfig with full example (mode, reserveTokensFloor, memoryFlush)contextTokens,bootstrapMaxChars,bootstrapTotalMaxCharsautoCompactis NOT a config key (common user confusion from the issue)Before
After
Testing
pnpm buildpassesrun.overflow-compaction.test.ts,config.compaction-settings.test.ts)Closes #5771
Greptile Summary
Improves context overflow error messages with actionable diagnostic information (context window size, source, message count) and adds comprehensive compaction documentation including config examples, related settings, and a troubleshooting section.
run.ts: Error message now includes dynamic context info (window size, source, message count) and specific remediation stepsagent-runner-execution.ts: Catch-all fallback message updated with consistent suggestions (/reset, reduce workspace files, switch model)compaction.md: Added YAML config example, related settings table,autoCompactclarification, and troubleshooting section — all verified against source codereply.triggers.trigger-handling.ignores-inline-elevated-directive-unapproved-sender.e2e.test.ts(line 140-142) usestoBe()exact match against the old fallback message fromagent-runner-execution.tsand was not updated in this PR — this test will failConfidence Score: 3/5
reply.triggers.trigger-handling.ignores-inline-elevated-directive-unapproved-sender.e2e.test.tsexpects the old message string viatoBe()and was not updated, which will cause a test failure. Score of 3 reflects that the functional changes are sound but the PR is not merge-ready until the test is fixed.src/auto-reply/reply/agent-runner-execution.ts— the updated error message at line 544 breaks an e2e test that was not included in this PR's changes.Last reviewed commit: 1eef057
(2/5) Greptile learns from your feedback when you react with thumbs up/down!