fix: return user-facing error when session reset after compaction failure#1187
Merged
steipete merged 3 commits intoopenclaw:mainfrom Jan 18, 2026
Merged
Conversation
…lure Previously, when auto-compaction failed due to context overflow, the system would reset the session and silently continue the execution loop without sending any response to the user. This made it appear as if messages were being ignored. This change ensures users receive a clear error message explaining that the context limit was exceeded and the conversation has been reset, consistent with how role ordering conflicts are already handled. Fixes the silent failure case where message + compaction exceeds context limits.
When context limit is exceeded, the error message now suggests setting agents.defaults.compaction.reserveTokensFloor to 4000 or higher to prevent future occurrences.
Contributor
|
Contributor
|
Thanks Lauren, looking into this - agree the current behavior is not ideal! |
steipete
added a commit
that referenced
this pull request
Jan 18, 2026
Contributor
|
Landed via temp rebase onto main.
Thanks @fayrose! |
Contributor
This was referenced Feb 17, 2026
dominicnunez
pushed a commit
to dominicnunez/openclaw
that referenced
this pull request
Feb 26, 2026
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
…silent-reset fix: return user-facing error when session reset after compaction failure
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.
Problem
When auto-compaction fails due to context overflow, the system resets the session and silently continues the execution loop without sending any response to the user. This makes it appear as if messages are being ignored, which is confusing and feels like data loss.
Root Cause
In
agent-runner-execution.ts, whenresetSessionAfterCompactionFailure()is called, the code usescontinueto restart the loop instead of returning a user-facing response. Compare this to how role ordering conflicts are handled - they properly return an error message to the user.Solution
continuewith a properreturnthat sends the user a clear error messageThe error message now reads:
Changes
src/auto-reply/reply/agent-runner-execution.ts:Testing
Tested on production instance experiencing this bug. After the fix: