Skip to content

[Bug]: Repeated hard resets on same session key despite high reserveTokensFloor; retry loop re-injects bootstrap context #63216

@sisutuulenisa

Description

@sisutuulenisa

Summary

OpenClaw repeatedly hits hard context-overflow resets on a specific group session key:

  • agent:main:voltti:group:46679641

This happens even with high compaction headroom configured (reserveTokensFloor already above the recommended value), and after aggressive pruning/compaction tuning.

The user-facing fallback message suggests increasing agents.defaults.compaction.reserveTokensFloor, but in this case it is already high and does not resolve the loop.

Environment

  • OpenClaw: 2026.4.8
  • Provider/model: openai-codex/gpt-5.3-codex
  • Channel/plugin path: Basecamp via local Voltti extension
  • Host: Linux

Relevant config at time of failures:

  • agents.defaults.compaction.reserveTokensFloor: 60000
  • agents.defaults.compaction.reserveTokens: 60000
  • agents.defaults.compaction.keepRecentTokens: 8000
  • agents.defaults.bootstrapMaxChars: 6000
  • agents.defaults.bootstrapTotalMaxChars: 12000
  • agents.defaults.contextPruning.mode: cache-ttl

What happens

For normal inbound Basecamp events in this thread, OpenClaw repeatedly does:

  1. context overflow detected (attempt 1/3)
  2. auto-compaction retry
  3. context overflow detected (attempt 2/3)
  4. auto-compaction retry
  5. context overflow detected (attempt 3/3)
  6. tool result truncation attempt (sometimes)
  7. hard reset/restart of session key to a new session ID

This cycle repeats across multiple newly restarted session IDs.

Representative logs

[agent] [context-overflow-diag] sessionKey=agent:main:voltti:group:46679641 ... compactionAttempts=3 ...
[agent] [context-overflow-recovery] Attempting tool result truncation ...
[agent] [context-overflow-recovery] Tool result truncation did not help: empty session
Auto-compaction failed (...). Restarting session agent:main:voltti:group:46679641 -> <new-session-id> and retrying.

Also observed repeatedly in the same failing cycle:

[agent] workspace bootstrap file AGENTS.md is 11593 chars (limit 6000); truncating ...
[agent] workspace bootstrap file TOOLS.md is 13283 chars (limit 1579); truncating ...
[agent] remaining bootstrap budget is 53 chars (<64); skipping additional bootstrap files ...

This suggests bootstrap context is re-injected on each retry path for the same failing turn.

Why this looks like a bug

  1. The fallback operator hint is misleading in this scenario:
    • reserve floor is already high (60000), yet resets continue.
  2. tool result truncation did not help: empty session appears in cases where failures still persist immediately after.
  3. Re-injecting bootstrap context every retry may amplify failure loops in already-tight runs.

Additional related observation

In earlier failing sessions for this same key, duplicate user payloads were observed in transcript history during retries/restarts (same inbound content repeated multiple times with different message IDs/timestamps), which may contribute to avoidable token growth.

Expected behavior

  • If reserve headroom is already high, fallback guidance should avoid always suggesting reserveTokensFloor as primary fix.
  • Retry path should avoid repeatedly re-inflating prompt context where possible.
  • If truncation reports empty session, recovery should either branch to a minimal context execution path or provide a more actionable root-cause diagnostic.

Related issues

Request

Please investigate retry-path prompt construction and recovery behavior for cases where:

  • compaction repeatedly succeeds but overflow immediately reoccurs,
  • truncation says "did not help: empty session",
  • and bootstrap injection appears on every retry in the same failing cycle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.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.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    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