-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Long-running tool results can poison persisted session context #87651
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.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.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
In OpenClaw 2026.5.26, long-running tools can persist many individually sub-cap
toolResultentries into a session. The aggregate persisted tool output can later make even very short follow-up messages exceed the model context window.This is not specific to one command or provider. The concrete report came from a Telegram direct session with a long-running
processtask, but the underlying issue is a general persisted-history/tool-output budget problem.Real environment
processtaskUser-visible symptom
After a long-running process task produced repeated tool output, normal short Telegram messages failed repeatedly:
This happened even for short follow-up messages such as:
So the problem was not the current user input length; the previous persisted session history had grown too large.
Evidence from session inspection
The affected direct session contained many repeated persisted messages like:
Each individual chunk could be under an existing per-result cap, but the active branch accumulated enough of them that later prompts replayed too much tool output.
Raw screenshots/logs are intentionally not attached here because they include private Telegram/session details. The relevant error text and persisted-message shape are quoted above in redacted form.
Expected behavior
Persisted session history should not allow repeated tool outputs to grow without an aggregate budget. A long-running tool should not poison future turns such that unrelated short user messages fail context assembly.
Related fix
A proposed fix is in:
The PR keeps the existing per-tool-result cap, and adds an aggregate persisted
toolResultbudget for the active branch so repeated sub-cap outputs are rewritten/truncated before later user turns can replay them all.