Hi, I’m reporting what looks like an error-classification / observability issue in OpenClaw.
In our persistent Discord channel session, the error often surfaced to us is:
terminated
But in the logs, the actual root error is:
Context overflow: estimated context size exceeds safe threshold during tool loop.
So from an operator perspective, terminated looks like the primary failure, when it is actually a downstream symptom after context overflow and compaction/retry activity.
Environment
OpenClaw: 2026.4.14
Model: openai-codex/gpt-5.4
Agent: editorial-acp
Surface: persistent Discord channel session
Session key: agent:editorial-acp:discord:channel:1483839578682032390
Observed pattern
Session grows over time in a long-lived, tool-heavy Discord channel.
A turn hits:Context overflow: estimated context size exceeds safe threshold during tool loop.
OpenClaw attempts auto-compaction/retry.
The run later surfaces as:terminated
Concrete evidence
From /tmp/openclaw/openclaw-2026-04-14.log:
At 2026-04-17T19:10:51.490Z:
[context-overflow-diag] sessionKey=agent:editorial-acp:discord:channel:1483839578682032390 ... error=Context overflow: estimated context size exceeds safe threshold during tool loop.
Immediately after:
context overflow detected (attempt 1/3); attempting auto-compaction for openai-codex/gpt-5.4
Then at 2026-04-17T19:11:26.797Z:
Full summarization failed: Summarization failed: terminated
Then later:
embedded_run_agent_end ... isError:true error:"terminated"
I observed the same pattern earlier the same day as well, including around 2026-04-17T18:58:08.266Z and 2026-04-17T11:22:50.328Z.
Additional correlated signal
I also see repeated Active Memory timeouts around these failing turns, e.g.:
active-memory ... done status=timeout elapsedMs=14120 summaryChars=0
This may not be the root cause, but it appears to add latency/noise around already fragile turns.
Relevant config context
contextTokens: 200000
compaction.mode: "safeguard"
editorial-acp.memorySearch.enabled: true
sources: ["memory", "sessions"]
experimental.sessionMemory: true
active-memory enabled for editorial-acp
active-memory.allowedChatTypes: ["channel", "direct"]
active-memory.timeoutMs: 9000
This is a long-lived shared channel session with many heavy read / exec tool outputs. I do not currently see contextPruning configured.
Expected behavior
If a context-overflow-diag occurs before terminated, I would expect OpenClaw to surface context overflow as the primary/root error, with terminated only as a secondary compaction/retry consequence.
Main ask
Could you please check:
whether terminated is incorrectly masking the real primary error,
whether the compaction/retry path should preserve context overflow as the surfaced root cause,
whether Active Memory on persistent channel sessions is expected to worsen this path,
whether contextPruning should be recommended or auto-enabled more aggressively for this kind of session.