-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Overflow recovery should truncate tool results before waiting full auto-compaction timeout #81182
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, 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.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, 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.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Summary
In a tool-heavy Telegram direct session, an overflow recovery path waited for the full auto-compaction safety timeout (~900s) before falling back to tool-result truncation. The subsequent truncation completed almost immediately and allowed the prompt to continue, so the user-visible latency appears avoidable.
This looks related to existing compaction/context issues such as #53008, #64962, #78562, and #45503, but the specific recovery-order problem is:
What happened
A Telegram direct session was asked to make a small configuration change (switch default model to
openai-codex/gpt-5.5). The actual config change/hot reload was not the slow part. The delay came from context overflow recovery in the active main session.Observed log timeline (Asia/Seoul):
The relevant point is that tool-result truncation took milliseconds after the 900s compaction timeout, and the session had 281 tool results. That suggests the overflow was at least substantially tool-result-driven.
Expected behavior
For overflow recovery in tool-heavy sessions, OpenClaw should avoid waiting the full auto-compaction timeout before applying a cheap deterministic reduction.
Possible behavior:
toolResultChars, tool result count, or similar heuristic).Actual behavior
The recovery path waited for LLM auto-compaction to hit the safety timeout first (
durationMs=912840, default 900s-ish), then performed tool-result truncation.This caused ~15 minutes of avoidable user-visible latency in Telegram.
Impact
Environment
openai-codex/gpt-5.4openai-codex/gpt-5.5272000 tokensRelated issues
Suggested fix
A conservative fix could be:
Alternatively, start auto-compaction but set a much shorter escalation timer for tool-heavy sessions (for example 30-60s), then truncate tool results if compaction has not completed.