openclaw - 💡(How to fix) Fix Repeated tool-loop context overflows cause successive auto-compactions after successful compaction (v2026.5.5) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#78562Fetched 2026-05-07 03:35:20
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
3
Author
Timeline (top)
cross-referenced ×2commented ×1

In OpenClaw 2026.5.5, a tool-heavy Telegram session can enter repeated auto-compaction loops after browser/log/memory tool output. Each compaction succeeds, but the next tool-loop prompt can immediately hit context overflow again, so the user sees the assistant repeatedly “compacting context over and over” inside the same live task.

This is not the older single 900s compaction-timeout failure. In the current incident, compactions completed in roughly 30–65 seconds, but repeated several times within minutes.

Error Message

2026-05-06T16:44:28.202Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=171 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop. 2026-05-06T16:49:47.993Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=74 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop. 2026-05-06T16:58:39.489Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=96 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop. 2026-05-06T17:00:16.214Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=29 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop. 2026-05-06T17:04:11.434Z [context-overflow-diag] sessionKey=agent:main:subagent:da38255f-6071-4c55-a4d8-3ba166bad7b9 ... messages=26 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop. 2026-05-06T17:06:34.501Z [context-overflow-diag] sessionKey=agent:main:subagent:da38255f-6071-4c55-a4d8-3ba166bad7b9 ... messages=34 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.

Root Cause

  • Several browser.snapshot calls against Vue seat-map pages produced very large accessibility trees.
  • The same session also read memory/startup files and ran runtime diagnostics.
  • OpenClaw repeatedly compacted after Context overflow ... during tool loop, not because of a single huge user message.

Fix Action

Fix / Workaround

After successful auto-compaction, OpenClaw should avoid immediately re-entering another compaction loop for the same task/tool-loop pattern. Possible expected mitigations:

Code Example

2026-05-06T16:44:28.202Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=171 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T16:44:28.203Z context overflow detected (attempt 1/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T16:45:32.677Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

2026-05-06T16:49:47.993Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=74 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T16:49:47.994Z context overflow detected (attempt 2/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T16:50:36.537Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

2026-05-06T16:58:39.489Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=96 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T16:58:39.490Z context overflow detected (attempt 1/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T16:59:39.005Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

2026-05-06T17:00:16.214Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=29 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T17:00:16.215Z context overflow detected (attempt 2/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T17:00:48.647Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

---

2026-05-06T17:04:11.434Z [context-overflow-diag] sessionKey=agent:main:subagent:da38255f-6071-4c55-a4d8-3ba166bad7b9 ... messages=26 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T17:04:11.437Z context overflow detected (attempt 1/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T17:04:39.935Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt
2026-05-06T17:06:34.501Z [context-overflow-diag] sessionKey=agent:main:subagent:da38255f-6071-4c55-a4d8-3ba166bad7b9 ... messages=34 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T17:07:05.531Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt
RAW_BUFFERClick to expand / collapse

Summary

In OpenClaw 2026.5.5, a tool-heavy Telegram session can enter repeated auto-compaction loops after browser/log/memory tool output. Each compaction succeeds, but the next tool-loop prompt can immediately hit context overflow again, so the user sees the assistant repeatedly “compacting context over and over” inside the same live task.

This is not the older single 900s compaction-timeout failure. In the current incident, compactions completed in roughly 30–65 seconds, but repeated several times within minutes.

Environment

  • OpenClaw: 2026.5.5 (b1abf9d)
  • Runtime: embedded Pi / OpenClaw Pi Default
  • Model: openai-codex/gpt-5.5
  • Channel/session: Telegram direct, default account
  • Platform: macOS arm64 / Mac mini
  • Context pruning: cache-ttl, ttl: 1h
  • Compaction config: mode: safeguard, reserveTokensFloor: 30000

Observed evidence

Session status during the incident:

  • Context: 145k/272k (53%)
  • Compactions: 7
  • Queue: steer depth 0

Recent same-session log sequence:

2026-05-06T16:44:28.202Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=171 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T16:44:28.203Z context overflow detected (attempt 1/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T16:45:32.677Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

2026-05-06T16:49:47.993Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=74 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T16:49:47.994Z context overflow detected (attempt 2/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T16:50:36.537Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

2026-05-06T16:58:39.489Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=96 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T16:58:39.490Z context overflow detected (attempt 1/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T16:59:39.005Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

2026-05-06T17:00:16.214Z [context-overflow-diag] sessionKey=agent:main:telegram:default:direct:<telegram-peer> ... messages=29 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T17:00:16.215Z context overflow detected (attempt 2/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T17:00:48.647Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

A subagent in the same window showed the same shape:

2026-05-06T17:04:11.434Z [context-overflow-diag] sessionKey=agent:main:subagent:da38255f-6071-4c55-a4d8-3ba166bad7b9 ... messages=26 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T17:04:11.437Z context overflow detected (attempt 1/3); attempting auto-compaction for openai-codex/gpt-5.5
2026-05-06T17:04:39.935Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt
2026-05-06T17:06:34.501Z [context-overflow-diag] sessionKey=agent:main:subagent:da38255f-6071-4c55-a4d8-3ba166bad7b9 ... messages=34 ... compactionAttempts=1 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
2026-05-06T17:07:05.531Z auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt

Trigger context

The live task was browser-heavy:

  • Several browser.snapshot calls against Vue seat-map pages produced very large accessibility trees.
  • The same session also read memory/startup files and ran runtime diagnostics.
  • OpenClaw repeatedly compacted after Context overflow ... during tool loop, not because of a single huge user message.

Expected behavior

After successful auto-compaction, OpenClaw should avoid immediately re-entering another compaction loop for the same task/tool-loop pattern. Possible expected mitigations:

  • more aggressive post-compaction tool-result truncation when the overflow source is tool output;
  • a cooldown/escalation path after N successful-but-insufficient compactions in the same run/session;
  • force a smaller replay window / compact_then_truncate after repeated tool-loop overflows;
  • surface a clearer diagnostic or user-facing notice that the session is stuck in repeated overflow recovery.

Actual behavior

Compaction succeeds, the prompt retries, then another large tool-loop replay can trigger another context overflow within minutes. From the user perspective, the assistant keeps “compacting context over and over” and the actual task latency becomes confusing/noisy.

Related issues

This appears related to, but narrower/different from:

  • #63279 — large-session overflow/compaction timeout cascade
  • #45686 — compaction circuit breaker/fallback model + force-truncate after repeated failures
  • #70334 — stuck session after successful compaction
  • #64962 — timeout-compaction does not escalate when compaction fails to reduce context

The distinction here: compaction is succeeding quickly, but repeated tool-loop overflows still cause successive compactions in normal browser/tool-heavy work.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

After successful auto-compaction, OpenClaw should avoid immediately re-entering another compaction loop for the same task/tool-loop pattern. Possible expected mitigations:

  • more aggressive post-compaction tool-result truncation when the overflow source is tool output;
  • a cooldown/escalation path after N successful-but-insufficient compactions in the same run/session;
  • force a smaller replay window / compact_then_truncate after repeated tool-loop overflows;
  • surface a clearer diagnostic or user-facing notice that the session is stuck in repeated overflow recovery.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Repeated tool-loop context overflows cause successive auto-compactions after successful compaction (v2026.5.5) [1 comments, 2 participants]