Skip to content

[Bug]: Hard context reset destroys in-progress task state with no recovery path #55366

@shiftymix

Description

@shiftymix

Summary

When an agent hits the context limit and compaction cannot recover enough space, OpenClaw fires a hard session reset with this message:

⚠️ Context limit exceeded. I've reset our conversation to start fresh - please try again.

The reset wipes all in-progress task state, leaving the agent with no memory of what it was doing. For long-running data tasks (e.g., reading an Excel file and writing to Google Sheets), this means the task must be restarted from scratch, with no way to resume.

Expected Behavior

On hard reset, OpenClaw should inject a minimal recovery context into the new session — at minimum:

  • The task goal / last user instruction
  • The agent's last known progress state
  • A note that the session was reset due to context limits

This would allow the agent to resume intelligently rather than going completely blank.

Actual Behavior

Session is wiped. Agent responds as if it has never seen the conversation. User must re-explain the entire task.

Reproduction

  1. Give an agent a long-running data task (e.g., read a multi-tab Excel file, write data to Google Sheets row by row)
  2. Let the task run until context fills up
  3. Observe the hard reset message — agent loses all task context and cannot continue

Environment

  • OS: Windows 10 x64
  • OpenClaw version: 2026.3.23-2 (7ffe7e4)
  • Agent: claude-sonnet-4-6 (200K context window)
  • Channel: Discord
  • Config: agents.defaults.compaction.reserveTokensFloor: 25000 (above suggested threshold), contextTokens: 160000, keepRecentTokens: 20000

Notes

The hard reset is understandable as a last resort, but the UX impact is severe for task-oriented agents. Even a one-sentence summary of the last instruction injected into the reset context would dramatically improve recoverability.

Related: this is one of the systemic issues flagged in #55298 comments — compaction/context management needs a more graceful degradation path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions