mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 14:01:24 +08:00
fix(auto-reply): preserve sessions after compaction failures (#70479)
Summary: - The PR removes the auto-reply compaction-failure session reset hook, adds preserved-session recovery guidance for overflow/compaction failure paths, and updates focused tests, docs, and the changelog. - Reproducibility: yes. at source level with high confidence. Current main routes both embedded overflow paylo ... resetSessionAfterCompactionFailure, and the PR body includes before/after terminal proof of those branches. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(auto-reply): drop dead compaction reset hook - PR branch already contained follow-up commit before automerge: fix(auto-reply): preserve sessions after compaction failures Validation: - ClawSweeper review passed for head193d3c0fdd. - Required merge gates passed before the squash merge. Prepared head SHA:193d3c0fddReview: https://github.com/openclaw/openclaw/pull/70479#issuecomment-4325128777 Co-authored-by: FullerStackDev <263060202+fuller-stack-dev@users.noreply.github.com> Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -274,6 +274,11 @@ In the embedded Pi agent, auto-compaction triggers in two cases:
|
||||
number of tokens`, `input token count exceeds the maximum number of input
|
||||
tokens`, `input is too long for the model`, `ollama error: context length
|
||||
exceeded`, and similar provider-shaped variants) → compact → retry.
|
||||
If overflow recovery still fails, OpenClaw surfaces explicit guidance to the
|
||||
user and preserves the current session mapping instead of silently rotating
|
||||
the session key to a fresh session id. The next step is operator-controlled:
|
||||
retry the message, run `/compact`, or run `/new` when a fresh session is
|
||||
preferred.
|
||||
2. **Threshold maintenance**: after a successful turn, when:
|
||||
|
||||
`contextTokens > contextWindow - reserveTokens`
|
||||
|
||||
Reference in New Issue
Block a user