Repository navigation
Description
Summary
After a single very large agent turn on anthropic/claude-opus-4-7 (~48k output tokens, 933k total tokens, 9-minute wall clock), the session's active embedded run counter never decrements; subsequent inbound Slack DMs are silently appended to the session's message log but no new model turn fires for ~30 minutes until a manual openclaw gateway restart.
Steps to reproduce
Observed once on 2026-06-04 in a normal Slack DM session on 2026.6.1. Repro path supported by ~/Library/Logs/openclaw/gateway.log and the session trajectory at <HOME>/.openclaw/agents/main/sessions/<sessionId>.trajectory.jsonl:
- Open a Slack DM session on
anthropic/claude-opus-4-7(default model,thinking=medium). - Trigger a turn that produces a single very large assistant payload — in this case, two
writetool calls that emitted ~75 KB of markdown each (a spec + an implementation plan), in one turn. - Observed
model.completedusage for that turn:{input: 13, output: 48250, cacheRead: 801880, cacheWrite: 83403, total: 933546}, wall clock 09:39:27 → 09:48:29 (GMT+3) = 9 min 2 s. Noaborted, notimedOut, noidleTimedOut, noexternalAbort, nopromptErrorSource.compactionCount: 0. - Send a follow-up inbound on the same Slack DM (a normal small request — e.g., "turn this markdown into slides"). Two subsequent turns at 10:23:10 and 10:23:59 GMT+3 completed normally (~49 s and 14 s).
- Send three further inbound messages over the next ~30 minutes:
- 10:33:30 GMT+3: "confirm which skill and template you will use"
- 10:54:34 GMT+3: "are you there?"
- 10:55:04 GMT+3: "did you see this task?"
- No model turn fires for any of them until the gateway is manually restarted at 10:48:54 (and then again at 10:50:52). The session's
messageslist grew from 58 → 60 → 62 → 65 across the silent window (visible inprompt.submittedpayloads), confirming inbound was accepted by Slack and queued into the session, but nomodel.completedevent fires until 10:54:43.
At gateway SIGTERM at 10:48:54 the drain banner reports:
[gateway] draining 0 active task(s) and 1 active embedded run(s) before restart with timeout 300000ms
— i.e. the gateway still believed one embedded run was active on this session, even though the last model.completed for it had fired 24 minutes earlier at 10:24:13.
Expected behavior
After a successful model.completed event, the session's active embedded runs counter for that session decrements to zero, so the next inbound message on the same session triggers a new model turn within seconds (as is normal — observed dozens of times in the same session before and after this incident).
Actual behavior
A single very large model.completed event (~48k output tokens / 9-min wall clock) appears to leave the session's active embedded runs counter pinned at 1 even after two subsequent normal turns complete on the same session. Every later inbound on that session is silently queued into the message log without triggering a turn, until the gateway process is restarted. Drain banner at SIGTERM confirms one embedded run was still considered active.
OpenClaw version
2026.6.1 (build 2e08f0f)
Operating system
macOS 26.5.1 (build 25F80), Apple Silicon
Install method
pnpm global (pnpm@openclaw@2026.6.1)
Model
anthropic/claude-opus-4-7 (default model, thinking=medium)
Provider / routing chain
openclaw → anthropic (direct provider, no proxy / gateway / openrouter in between)
Additional provider/model setup details
Default route is openclaw → anthropic; no per-agent override on this session. model: "claude-opus-4-7", modelProvider: "anthropic" in sessions.json. No cloudflare-ai-gateway, no openrouter in this path. No model-side error of any kind in the trajectory.
Logs, screenshots, and evidence
Trajectory excerpt for the Slack DM session (paths and session ids redacted). All times GMT+3:
turn start end dur_s in_tok out_tok cache_read total stop err
#7 09:39:27 09:48:29 542.4 13 48250 801880 933546 null null <-- huge turn
#8 10:23:10 10:23:59 49 8 2645 312673 405436 null null <-- normal turn after
#9 10:23:59 10:24:13 14 6 121 46362 139089 null null <-- normal turn after
--- 30 min 22 s silence; 3 inbound messages queued, no turns ---
#10 10:54:35 10:54:43 8 6 137 46362 139273 null null <-- after manual restart
#11 10:54:58 10:56:01 63 16 2449 1476392 1579483 null null
#12 10:56:02 10:56:08 7 6 137 46362 149341 null null
messages array length captured at the start of each prompt during the silent window (from prompt.submitted.data.messages):
10:23:10 messages=52
10:23:59 messages=58 <-- last turn that fired
10:54:36 messages=60 <-- "are you there?" added; no turn ran in between for 2 prior inbound
10:54:58 messages=62
10:56:02 messages=65
model.completed.data for the huge turn (#7) — no error/abort/timeout flags anywhere:
aborted=False idleTimedOut=False timedOut=False
timedOutDuringToolExecution=False externalAbort=False
promptErrorSource=None compactionCount=0
usage={'input': 13, 'output': 48250, 'cacheRead': 801880,
'cacheWrite': 83403, 'total': 933546}
Gateway log entries during the silent window:
10:23:59 [slack] delivered reply to channel:<channel-id> (last successful reply)
10:30:00 [cron:<cron-id>] Thinking level "medium" is not supported for anthropic/claude-haiku-4-5-20251001; downgrading to "off".
10:40:00 [cron:<cron-id>] Thinking level "medium" is not supported for anthropic/claude-haiku-4-5-20251001; downgrading to "off".
10:48:54 [gateway] signal SIGTERM received
10:48:54 [gateway] received SIGTERM; restarting
10:48:54 [gateway] draining 0 active task(s) and 1 active embedded run(s) before restart with timeout 300000ms <-- THE SMOKING GUN
10:49:07 [gateway] loading configuration…
10:49:09 [gateway] agent model: anthropic/claude-opus-4-7 (thinking=medium, fast=off)
10:49:12 [slack] socket mode connected
10:50:52 [gateway] signal SIGTERM received (second restart, no work in flight)
10:51:09 [slack] socket mode connected
10:54:34 inbound "are you there?" arrives via Slack socket mode → turn fires
10:54:43 [slack] delivered reply to channel:<channel-id>
Notably absent from the silent window:
- No Slack socket-mode disconnect/reconnect.
- No
errorevent on the session. - No stall-detector / no-output-watchdog firing.
- No compaction event (
compactionCountwas 0 throughout).
Impact and severity
- Affected: Slack DM sessions on
anthropic/claude-opus-4-7that produce a single very large turn (>30k output tokens or >5-min wall clock). Likely reproducible on other channels (WhatsApp, Telegram) using the same session-lane mechanism — not yet verified. - Severity: High. Silent outage — user sees their messages delivered to Slack with no error and no reply for ~30 min. No diagnostic surface on either side; only a hand-restart unblocks it.
- Frequency: Observed once in ~3 weeks of
2026.6.1use; appears tied to the single-huge-turn pattern, not generic load. Likely intermittent in the wild because few turns hit the size threshold. - Consequence: Time-sensitive requests sit unanswered until a human notices and restarts the gateway. In this incident: 30 min 22 s outage, 3 user messages dropped onto the silent queue, ended only by manual restart.
Additional information
This looks like the same root cause family as #54488 ("Session lane starvation: followup drain monopolizes session lane, blocks inbound dispatch for 20-30min") and #84903 ("A single stalled agent session blocks the entire Gateway event loop"), but the trigger here is not a followup-drain backlog or compaction cycle — it's a single oversize successful turn on claude-opus-4-7. Compaction count was 0 the entire time, and the next two turns after the huge one completed normally before the silent window started, so the "stuck active embedded run" counter likely went out of sync only on turn #9's release path, not on turn #7. The actual messages array kept growing as inbound was accepted, so the inbound queue itself works — only the lane release / next-turn dispatch is broken.
Suggested investigation:
- Audit the embedded-run release path for the case where a turn finished but a follow-up turn started in the same dispatch window before the release fully propagated.
- Verify that
clearActiveEmbeddedRunis idempotent and decrements to zero, not by one, since back-to-back turns may double-increment. - Add a periodic reconciliation between
active embedded runsand the session's actual current run state, so a stuck counter self-heals within minutes instead of requiring a process restart.
Last known good: previous instances of the same session up to turn #6 (09:24:00) ran for ~2 hours with no issue. First known bad: trajectory file flags none of the abort/timeout/error fields, so the bad state is not surfaced anywhere visible to the agent itself. Workaround: openclaw gateway restart clears it.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 4, 2026
Codex review: this still needs some work.
Summary
Keep this issue open: independent reports establish silent session stalls on official releases, and neither a verified fix nor an exact canonical replacement resolves the reported lifecycle failure.
Reproducibility: no. high-confidence current-main reproduction is established; the release reports are concrete, but source inspection does not prove their proposed ownership-leak mechanism.
Maintainer decision needed
Next step
Identify the retained lifecycle owner in a current-version stall and establish a failing completion-to-next-inbound regression before selecting a focused repair.
Review details
Best possible solution:
Release completed work through its lifecycle owner and resume queued input while preserving genuinely active successor runs.
Do we have a high-confidence way to reproduce the issue?
No high-confidence current-main reproduction is established; the release reports are concrete, but source inspection does not prove their proposed ownership-leak mechanism.
Is this the best way to solve the issue?
Repairing the proven lifecycle owner is preferable to unconditional reconciliation, which could clear a valid successor or abort legitimate long-running work.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 204ff9770617.
Label changes
Label changes:
No label changes.
Label justifications:
P1: Independent official-release reports describe prolonged silent interruption of active channel conversations requiring a Gateway restart.impact:session-state: The reported blockage concerns retained session work ownership after apparent completion.impact:message-loss: Accepted inbound messages remain unanswered while the affected conversation is stalled.Evidence reviewed
Acceptance criteria:
What I checked:
src/agents/embedded-agent-runner/runs.ts:1498, 204ff9770617)src/agents/embedded-agent-runner/run/attempt-settle.ts:67, 204ff9770617)src/logging/diagnostic.ts:360, 204ff9770617)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed October 15, 2026, 10:37 PM ET / October 16, 2026, 02:37 UTC.
ryanbush101 commentedon Jun 15, 2026
I hit what looks like the same class of issue today on
OpenClaw 2026.6.6 (8c802aa)with a Slack DM session.Environment:
openai/gpt-5.5with Codex embedded runner availableUser-visible symptom:
openclaw gateway restart/ OpenClaw restart clears it and replies resume.Relevant redacted log sequence from
/tmp/openclaw/openclaw-2026-06-15.log:Later repeated around the same Slack DM lane:
One possible confounder: the same install had repeated state migration warnings before I repaired plugin state:
I repaired that separately by backing up state, moving the legacy
/Users/bane/.openclaw/plugins/installs.jsonout of the live path, and runningopenclaw plugins registry --refresh. After that:So the stale plugin metadata may have contributed, but the session behavior itself matches this issue: active embedded run remains pinned/stale, queued Slack DM inbound does not recover cleanly, and restart is the practical recovery path.
13 remaining items
guanbear commentedon Aug 28, 2026
We observed the same failure class on a Feishu direct-message session running OpenClaw
2026.7.1in a Linux container. This adds a second channel and a newer release to the evidence here.Observed sequence
killedstate.Additional isolation
openclaw message sendsucceeded while inbound turns for this one session remained blocked.This appears consistent with the counter/lifecycle leak described in this issue rather than a channel transport failure. The strongest invariant for a regression test would be: once child work reaches a terminal state, requester-session embedded-run accounting must eventually return to zero even when completion announce/wake fails.
openclaw-barnacle commentedon Sep 21, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
steipete commentedon Oct 24, 2026
Thanks for filing this. We're closing older issues that no longer look actionable on current
main.We couldn't confirm a leaked run counter on current main, and the reports are from 2026.6.1 and 2026.7.1. If a session still stops processing inbound messages until restart on a current release, please open a fresh issue with the diagnostic output captured during the stall.