Repository navigation
Description
Summary
On a long-running gateway, isolated cron jobs using the claude-cli backend intermittently get classified as stuck while they are actively streaming, and the built-in lane recovery then fails to release the lane (released=0). Leaked lanes accumulate over hours until a full gateway restart clears them. Subsequent isolated cron runs fail at the pre-runner stage with stalled before execution start (last phase: runtime-plugins).
Environment
- OpenClaw: 2026.5.28 (e932160)
- Runtime:
claude-cli(Claude Code CLI), OAuth; models route viaagentRuntime: claude-cli - OS: Linux, systemd user service
- Jobs:
sessionTarget: isolated,payload.kind: agentTurn
Symptoms
openclaw cron listshows isolated jobs inerror.- Cron records:
cron: isolated agent run stalled before execution start (last phase: runtime-plugins). - Only
isolated-target jobs are affected; main-session jobs are fine. - Builds up over hours; a gateway restart flushes it (temporarily).
Diagnostic evidence (gateway journald)
[diagnostic] stuck session: sessionId=<uuid> sessionKey=agent:main:cron:<jobId>:run:<runId> state=processing age=139s queueDepth=1 reason=queued_work_without_active_run classification=stale_session_state lastProgress=cli_live:stream_progress lastProgressAge=0s recovery=checking
[diagnostic] stuck session recovery: sessionId=<uuid> ... age=139s action=release_lane aborted=false drained=true released=0
[diagnostic] stuck session recovery outcome: status=released action=release_lane ... lane=session:agent:main:cron:<jobId>:run:<runId> released=0
Key contradictions:
lastProgress=cli_live:stream_progress lastProgressAge=0s— the run is streaming at the instant it is classified stuck.reason=queued_work_without_active_run— the lane has queued work but no active run is bound to it, despite the CLI streaming.- Recovery
action=release_lane ... released=0— recovery runs but frees nothing, so the lane stays occupied. This is the leak.
Ruled out
timeoutSeconds— the pre-runner watchdog is capped independently (perdocs/automation/cron-jobs.md), so raising per-job timeouts has no effect. Confirmed.- Concurrency — already
cron.maxConcurrentRuns: 3; lowers frequency, doesn't stop it. - Plugin/MCP cold-start bloat — contributes to the trigger window (CLI startup loads plugins + bundle MCP), but removing a failing plugin barely changed startup time; not the root fault.
Hypothesis
For the cli_live (claude-cli streaming) runtime there is a window where a cron run is streaming but is not (yet / any longer) registered as the lane's active run. The stuck-session classifier sees queued_work_without_active_run and calls release_lane, but because the run↔lane linkage is inconsistent, released=0 and the lane is never reclaimed. Leaked lanes eventually exhaust isolated capacity, so new isolated runs stall at the pre-runner runtime-plugins phase.
Impact
Recurring failure of scheduled isolated jobs every few hours, only mitigated by periodic gateway restarts.
Repro conditions
claude-cli backend + isolated cron jobs + gateway uptime of several hours + light concurrency. Happy to provide a debug bundle.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
jarvis-drakon commentedon Jun 3, 2026
Related prior work — this looks like an uncovered variant of #79612
queued_work_without_active_runfor reply runs — the fix "mirrors reply operations into diagnostic activity" so queued sessions with active reply work aren't misclassified.isolated/cli_livestreaming path:lastProgress=cli_live:stream_progress, not a reply run. The reply-run mirroring in Fix stale diagnostic lanes for reply runs #81302 appears not to cover the cli_live cron-run case, which is why it still reproduces on v2026.5.28 (released after Fix stale diagnostic lanes for reply runs #81302 merged).Ask: extend the active-run/diagnostic-activity mirroring (per #81302) to cover
cli_livecronisolatedstreaming runs, sorelease_lanecan actually reclaim the lane instead of returningreleased=0. Confirmed still present on v2026.5.28.clawsweeper commentedon Jun 3, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 27, 2026, 2:47 AM ET / 06:47 UTC.
Summary
Keep open pending a focused current-main confirmation. The merged run-lifecycle reliability work appears to address the false recovery against fresh
cli_liveprogress, but the report’s later isolated-cron degradation and discarded-output outcome have not been verified against current main here.Reproducibility: unclear. for current main. The supplied candidate PR documents a deterministic source-level snapshot matching the reported fresh-progress classifier path, but no current-main live cron run was available in this review.
Ways to help us reproduce this
Maintainer decision needed
cli_live:stream_progressisolated cron turn or leave later isolated cron jobs unable to start after the merged lifecycle reliability changes?claude-clicron scenario and close this issue if fresh progress no longer triggers recovery and later runs still admit normally.Why: The merged PR is strong provenance for the classifier and recovery class, but the reporter’s claimed downstream effect requires a current-main runtime observation before this issue can safely close.
Next step
A merged PR plausibly owns the central recovery fix, so the next action is a current-main runtime confirmation rather than another parallel repair branch.
Review details
Best possible solution:
Run a bounded current-main isolated
claude-clicron scenario that observes fresh stream progress, recovery decisions, completion delivery, and subsequent cron admission; close this issue only if that confirms the merged lifecycle work resolves the reported behavior or split any remaining setup stall into a narrower canonical report.Do we have a high-confidence way to reproduce the issue?
Unclear for current main. The supplied candidate PR documents a deterministic source-level snapshot matching the reported fresh-progress classifier path, but no current-main live cron run was available in this review.
Is this the best way to solve the issue?
Unclear. The merged lifecycle work and the narrow fresh-progress guard are plausible fixes for the observed false recovery, but a current-main run must establish whether the downstream isolated-cron admission failure is also resolved.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
v2026.7.1.Codex review notes: model internal, reasoning high; reviewed against a731397ea176.
Label changes
Label changes:
issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.clawsweeper:needs-live-repro: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label.clawsweeper:needs-product-decision: Current issue advisory state no longer selects this label.clawsweeper:source-repro: Current issue advisory state no longer selects this label.impact:crash-loop: Current review impact labels areimpact:session-state.issue-rating: 🦞 diamond lobster: Current issue advisory state no longer selects this label.Label justifications:
P1: Repeated scheduled isolated-agent runs can be falsely recovered mid-stream and disrupt real user automation until operator intervention.impact:session-state: The reported fault is inconsistent run, lane, and diagnostic-session lifecycle state during active work.Evidence reviewed
What I checked:
cli_live:stream_progressclassification path and scopes its repair to suppress recovery while progress is within the stale threshold. (src/logging/diagnostic-session-attention.ts, 8fcf34c4f4ed)AGENTS.md:1)Likely related people:
src/logging/diagnostic-session-attention.ts,src/logging/diagnostic-session-recovery.ts,src/agents)claude-clidiagnostic state reported here. (role: adjacent fix author; confidence: medium; commits: 8fcf34c4f4ed; files:src/logging/diagnostic-session-attention.ts,src/logging/diagnostic-session-attention.test.ts)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 autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.RyanSandoval commentedon Jun 10, 2026
Corroborating data: still reproduces on
2026.6.5 (5181e4f)— macOS 26.5 arm64, node 26.2.0,claude-clibackend (OAuth auth-profile), LaunchAgent gateway.Same signature, at steady volume on a long-running gateway:
stuck sessiondetections on 2026-06-08, 15 on 2026-06-09, spread across ~11 different cron jobs (pollers, daily agentTurn jobs) — so it's systemic, not job-specific.lastProgress=cli_live:stream_progresswithlastProgressAgeof 0–14s (mostly0s). Breakdown for 2026-06-09:action=release_lane aborted=false drained=true released=0— consistent with OP's lane-release failing to find anything to release.status: okdespite the recovery firing mid-stream, but we also have a recent run failing withcron: isolated agent setup timed out before runner start— which looks like the downstream effect OP describes (stalled before execution start (last phase: runtime-plugins)), i.e. accumulated lane leakage degrading later isolated runs until a gateway restart.Also matching OP's restart observation: a gateway restart attempt was itself deferred with
restart blocked by active background task run(s)while these lanes were in this state.Net: the
queued_work_without_active_runclassifier appears to not account for livecli_live:stream_progressheartbeats on the claude-cli backend —lastProgressAge=0sshould presumably disqualify a session fromstale_session_state.akmad commentedon Jul 24, 2026
Corroborating on 2026.6.11 (stable) — still present, and with a consequence worse than lane leakage: the recovery can stop the cron job while the CLI turn is alive, and the turn's side effects still land while its output is discarded.
Setup: Linux, Docker gateway,
claude-clibackend (OAuth), one-shotcron addjobs dispatching a coding agent (--session-keyset,--delete-after-run).Two consecutive dispatches (same job shape, ~1.2KB prompt) were both classified stuck at ~2.4 min, matching the reporter's signature bit-for-bit — including
lastProgress=cli_live:stream_progress lastProgressAge=0sat the moment of classification, i.e. the stream was demonstrably alive:What happened next in both cases: the underlying Claude CLI turn kept running (one for 12.8 min,
durationMs=768781, 1703 raw stream lines), completed its work — in our case including agit pushto a real PR — and was then torn down atclaude live session close: reason=restart, with the turn's final output discarded. Net effect: silent zombie side-effects (the push landed) with no completion event, which is arguably more dangerous than the lane leak.Meanwhile a 12-minute claude-cli cron turn for a different agent on the same gateway survived untouched the same day, so the false-positive appears to be a bookkeeping race (queued item vs. active-run registration for the session), not turn length.
Dispatching the identical payload via the gateway
agentRPC (gateway call agent) instead ofcron addavoids the detector entirely and ran >40 min unharmed — consistent with the cron-session bookkeeping being the trigger.+1 to the obvious guard: never
release_lane/stop a job whose session showedstream_progresswithin the last few seconds —lastProgressAge=0sis right there in the diagnostic line that decides to kill it.steipete commentedon Jul 27, 2026
Thank you for the detailed production evidence, especially the exact
cli_live:stream_progress/released=0logs and the later Docker corroboration. I traced the actual Claude live-stream producer, diagnostic classifier, queue accounting, and recovery tests on currentmain; this exact false-stall and orphaned-lane behavior is now fixed.The canonical evidence-based liveness fix is 969efda, followed by the queued-run and recovery hardening in #114058 / 0951d0d. The liveness commit and the merged hardening PR head both have successful GitHub checks.
Specifically:
cli_live:stream_progressevent shown in your logs:openclaw/src/agents/cli-runner/claude-live-session.ts
Lines 791 to 803 in 0951d0d
openclaw/src/logging/diagnostic.test.ts
Lines 886 to 927 in 0951d0d
queued_work_without_active_run:openclaw/src/logging/diagnostic.ts
Lines 239 to 247 in 0951d0d
openclaw/src/logging/diagnostic-stuck-session-recovery.integration.test.ts
Lines 128 to 173 in 0951d0d
Closing as completed on
main. If this signature persists on a build that includes both linked fixes, please file a new issue with the exact build and a redacted current diagnostic trace; that would be a distinct regression.