Skip to content

WhatsApp 1:1: inbound image wedges main lane ~3min before processing — multimodal run strands active_reply_work/queued_work_without_active_run (repro on 2026.6.10, post-#95039) #96834

Closed as not planned

Description

@aleps001

Bug type

Behavior bug (incorrect output/state without crash)

Summary

On WhatsApp direct (1:1), sending an image to the main agent wedges the message lane for ~3 minutes before any real processing of the prompt starts. The inbound image is injected as a native multimodal image block into the main agent's run, so the run that ingests it is itself an embedded_run. When that run reaches run:completed, its active-reply marker is not cleared: the lane stays state=processing with reason=queued_work_without_active_run, and the stuck-session recovery skips with active_reply_work (action=keep_lane) for ~3 min before finally escalating to abort_embedded_run and releasing the lane. Only after that does the agent route the request to a worker.

This is the same reason-code signature as the canonical follow-up-drain race #91909 (queued_work_without_active_run → keep_lane/active_reply_work → abort_embedded_run), which was closed as fixed by #95039. However:

Filing as a focused, image/multimodal-specific variant and cross-referencing #91909 / #95039 so maintainers can either fold it into the canonical tracker or treat it as a surviving variant of the same race.

Environment

  • OpenClaw 2026.6.10 (aa69b12d), self-hosted Linux, systemd user gateway, loopback bind
  • Channel: WhatsApp direct (1:1)
  • messages.visibleReplies=automatic
  • Main agent model: gpt-5.5
  • Queue mode: default (steer)
  • openclaw tasks list: 0 queued · 0 running · 0 issues during the wedge (the wedge is invisible to the task subsystem)

Steps to reproduce

  1. In a WhatsApp direct chat, send the main agent an image (no caption / "what is this?" style).
  2. The agent receives the image as a native multimodal block, replies once (e.g. a clarifying question), and the run reaches run:completed.
  3. Observe: the lane stays processing; subsequent inbound (and internal queue work) does not start a new run.
  4. ~3 min later the stuck-session watchdog fires and abort_embedded_run releases the lane; only then does real routing/processing begin.

Observed log evidence (BRT timestamps)

13:37:18  inbound image (no caption) -> injected as native multimodal image block into main's run
13:37:26  main replies (text), run:completed ~13:37:27

13:40:36  WARN stuck session: sessionKey=agent:main:whatsapp:direct:+<redacted>
          state=processing age=136s queueDepth=5
          reason=queued_work_without_active_run classification=stale_session_state
          lastProgress=run:completed lastProgressAge=189s terminalProgressStale=true recovery=checking

13:40:36 .. 13:43:35  (repeated)
          stuck session recovery outcome: status=skipped action=keep_lane
          activeSessionId=<same> activeWorkKind=embedded_run reason=active_reply_work

13:43:51  stuck session recovery outcome: action=abort_embedded_run   -> lane released
13:43:52+ queued messages finally processed; main then spawns the worker correctly

Trajectory confirms the inbound image was present in the model context as a type:image multimodal block (no separate vision/OCR tool call) — i.e. the wedging embedded_run is the main agent's own multimodal run, not a Codex app-server / subprocess (distinguishing this from the Codex-embedded-runner reports #85251 / #85532).

Expected

Receiving an image on a 1:1 lane should not strand the lane. Either the multimodal run's active-reply marker must be cleared on run:completed so the followup drain can start, or recovery must treat lastProgress=run:completed + terminalProgressStale=true as authoritative over a stale embedded_run active_reply_work marker and release the lane immediately instead of waiting ~3 min.

Related

Activity

  1. clawsweeper commented on Jun 25, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Keep open: independent official-release reports establish completion-boundary stalls, and the verified recovery improvements do not conclusively resolve the original reply-owner leak.

    Reproducibility: Historical production failures are concrete, but neither a current-main reproduction nor a narrow current-source defect is established; this read-only review ran no tests.

    Next step
    Obtain a redacted current-release trace connecting inbound receipt, reply-owner phase, completion settlement, and successor admission before selecting a focused repair.

    Review details

    Best possible solution:

    Ensure every run-ending path settles its exact reply owner and advances pending messages without replaying completed effects.

    Do we have a high-confidence way to reproduce the issue?

    Historical production failures are concrete, but neither a current-main reproduction nor a narrow current-source defect is established; this read-only review ran no tests.

    Is this the best way to solve the issue?

    Repair the lifecycle obligation identified by a current trace; clearing all ownership at run.completed would bypass legitimate delivery and persistence settlement.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No current-release trace identifies the exact retained reply owner or unresolved completion obligation; the historical reason codes cover several mechanisms.

    Codex review notes: model internal, reasoning medium; reviewed against 50a5f43bb30b.

    Label changes

    Label changes:

    • add issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.
    • remove issue-rating: 🦐 gold shrimp: Current issue advisory state no longer selects this label.

    Label justifications:

    • P1: Independent official-release incidents describe prolonged failures of established channel conversations.
    • impact:session-state: Completed execution, retained reply ownership, and successor admission disagree about whether the session can proceed.
    • impact:message-loss: The discussion includes unprocessed inbound messages and a reported loss, while explicitly correcting recovery flags that overstate loss.
    Evidence reviewed

    What I checked:

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 16, 2026, 1:31 AM ET / 05:31 UTC.

  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on Jun 25, 2026
  3. aleps001 commented on Jul 7, 2026

    @aleps001
    Author

    Update: stronger repro — 24-minute continuous detect/abort loop that never actually drains, isolated from the #86538 lock/takeover family

    Fresh repro on the same environment (2026.6.10), this time with a burst of 9 WhatsApp images sent one-by-one over ~26 minutes (WhatsApp's multi-photo send), captured via journalctl (the daily file log had already rotated out, but the systemd-journal retention covers this window in full — no gaps).

    Session: agent:main:whatsapp:direct:<redacted>, sessionId 213973c6-....

    What happened, minute by minute (BRT):

    • 12:07:45 — first detection: queueDepth=9 reason=queued_work_without_active_run classification=stale_session_state lastProgress=run:completed terminalProgressStale=true — the same phantom-embedded_run signature as the original report.
    • From 12:07:45 to 12:32:00 (24 minutes, uninterrupted), the session cycles through the same detect -> reclaim -> abort sequence 7 times:
      1. Repeated stuck session recovery outcome: status=skipped action=keep_lane ... reason=active_reply_work for ~2 minutes,
      2. then stuck session recovery reclaiming stale active reply work,
      3. then stuck session recovery: ... action=abort_embedded_run aborted=true drained=false released=0.
    • released=0 on every single one of the 7 abort cycles. The abort never actually drains the queue or clears the underlying condition — a fresh embedded_run marker reappears within ~2 minutes and the whole detect/keep_lane/reclaim/abort sequence repeats. This is a materially different (and worse) picture than "aborts once and the lane recovers" — here the recovery action is closer to a no-op that just resets the clock.
    • Individual image replies during this window were still prompt (the user got a quick reply to each photo), so the conversational experience partially masked a background session-state loop that never actually resolved on its own.
    • The loop only stops at 12:32:00 (7th abort), immediately after the user sent an explicit closing message ("mandei os 9 print screens") that let a real turn complete (dispatch to a worker) — i.e., what broke the loop was a fresh user-driven turn, not any self-healing by the recovery mechanism itself.
    • No EmbeddedAttemptSessionTakeoverError / SessionWriteLockTimeoutError anywhere in this window — this repro is a clean, isolated case of the queued_work_without_active_run / active_reply_work mechanism from the original report, without the session-write-lock family from [Bug]: Session write-lock timeouts block subagent delivery lanes #86538 (ruled out explicitly by grepping the full window).

    Why this matters beyond the original report: the original repro described one detect -> abort -> release cycle resolving in ~3 minutes. This repro shows the same mechanism can loop indefinitely (7+ cycles / 24+ minutes observed here, with no indication it would have stopped without user intervention) because abort_embedded_run is not actually draining/releasing the lane (released=0 every time) — it's only resetting the stale-state clock, not fixing the root marker. That raises the severity: this isn't bounded to a short self-heal window in bursty/multi-image scenarios.

    Happy to share the raw journald excerpt (redacted) if useful for reproduction.

  4. aleps001 commented on Jul 7, 2026

    @aleps001
    Author

    Correction / severity upgrade to my prior comment: raw webhook timestamps show a 26-minute delay before the agent even saw the user's closing message, not user-paced sending

    My earlier comment in this thread mischaracterized the images as sent "one-by-one over ~26 minutes." Cross-checking the raw WhatsApp inbound-webhook log (before any agent processing) against the session transcript shows something more severe: the user sent everything in a ~90-second burst, but the agent didn't act on the final instruction until 26 minutes later.

    Raw inbound arrival (webhook receipt, journalctl, BRT):

    12:05:05.347  inbound text  (the opening instruction: "vou te mandar 9 print screens...")
    12:06:05.665  inbound image 1
    12:06:05.871  inbound image 2
    12:06:05.924  inbound image 3
    12:06:06.106  inbound image 4
    12:06:06.225  inbound image 5
    12:06:06.635  inbound image 6
    12:06:06.746  inbound image 7
    12:06:07.063  inbound image 8
    12:06:08.744  inbound image 9
    12:06:35.898  inbound text  (the closing instruction, sent by the user right after the image burst)
    

    All 9 images arrived within ~3 seconds (WhatsApp's native multi-select send), and the closing text arrived 30 seconds later. So the full user-side interaction — 9 images + open + close instructions — took under 100 seconds end-to-end.

    But the session transcript (.jsonl, UTC timestamps, -3h for BRT) only reflects the closing instruction being acted on at 12:32:38 BRT — 26 minutes after it was actually sent. In between, the same session was cycling through the detect -> keep_lane -> reclaim -> abort_embedded_run loop described in my previous comment (7 cycles, released=0 every time), and each queued image appears to have been drained roughly once per abort cycle (~every 4 minutes) rather than immediately.

    Net effect: a burst that should complete in under two minutes took 26 minutes end-to-end, and for essentially all of that window the user's own explicit follow-up instruction ("done sending, please proceed") sat unprocessed behind the phantom-embedded_run loop. The per-image acknowledgment replies the user saw during the wait were themselves being drained from the same backlog at the loop's cadence, not generated in real time — so the conversation looked alive while the actual instruction was stuck.

    (Note: the WhatsApp inbound log only records char-count, not body text, so I'm inferring the 12:06:35 message is the closing instruction from timing + the user's own account of when it was sent — not from reading the message body itself.)

  5. gertieloop commented on Jul 8, 2026

    @gertieloop

    Live repro — same run:completed → queued_work_without_active_run lane strand, but TEXT-ONLY (no image / no multimodal block). This may broaden the issue beyond the multimodal framing.

    Environment

    • OpenClaw 2026.6.9 (c645ec4), self-hosted macOS, loopback bind, WhatsApp direct (1:1) to the main agent.
    • messages.visibleReplies=automatic, default queue mode.
    • A local gateway plugin runs an in-process "coherence" hook that, on certain triggers, spawns an isolated advisory subagent (runtime=subagent) into the same main session. Flagging this because it appears to be one trigger, not the root cause (see below).

    What happened (no image anywhere in the flow)

    1. Operator ran openclaw gateway restart (SIGUSR1 in-process restart) to reload a plugin. The restart drained an in-flight main-session embedded run.
    2. The drained run reached run:completed after the restart (its llm_output fired to our dashboard), but the WhatsApp lane stayed state=processing. Subsequent plain-text inbounds enqueued and never started a new run — queueDepth climbed 5 → 6, zero thinking_start, total outbound silence. All prompts were text; there was never a multimodal block.
    3. Built-in recovery fired at age≈306s:
      stuck session: state=processing queueDepth=5 reason=queued_work_without_active_run
        classification=stale_session_state lastProgress=run:completed lastProgressAge=1594s
        terminalProgressStale=true recovery=checking
      stuck session recovery: action=abort_embedded_run aborted=true drained=false released=0
      
      Note released=0 on the command lane (no active task to release) yet queued work present — i.e. the command lane has active=0, queue>0, and is not pumping. The diagnostic activity marker was cleared at run:completed (recordRunCompleted clears activeEmbeddedRun), so the strand is downstream in the lane scheduler, not the activity tracker.
    4. Recovery is not durable / re-wedges: after the abort_embedded_run it briefly recovered and ran one turn (run:completed again), then re-wedged within ~10 min with the identical queued_work_without_active_run signature (lastProgressAge=599s). So it's a repeating ~5-min cycle, not a one-shot.
    5. Operator /stop cleared it immediately — a fresh thinking_start followed ~1 min later, a full ~4 min before any restart executed. So /stop (killing the in-flight/stale run) is the reliable break; the ~300s auto-recovery is out-paced by re-wedging.

    Why this looks like a scheduler-level strand (candidate)

    With the command lane showing active=0, queue>0, not advancing (released=0), the lost step appears to be a skipped pump() after a task settles under a bumped lane generation. In src/process/command-queue.ts, the completion handler only re-pumps when completeTask() returns true, and completeTask returns false on taskGeneration !== state.generation. A SIGUSR1 resetAllLanes() / recovery resetCommandLane() bumps state.generation while a task is in flight; when that task finally settles, its completion is treated as stale and pump() is skipped, so a genuinely free single-slot lane with queued entries never advances — until an external enqueue that happens to find draining=false, the next stuck-sweep, or /stop. (Sharing as a hypothesis for maintainers; happy to be wrong on the exact site.)

    Offer

    I have the full sanitized JSON-log timeline (all identifiers redacted) and can attach excerpts or test against a patch. The useful new signal vs the original report: this reproduces with plain text only, and the built-in recovery re-wedges rather than resolving, so the multimodal embedded_run is likely a trigger of a more general lane-generation/pump race (cross-ref #91909 / #95039).

  6. Jackten commented on Jul 8, 2026

    @Jackten
    Contributor

    Additional post-#95039 repro on 2026.6.11, new trigger shape: WhatsApp group lane, wedge occurs after a normally-completed run (not before processing), with a diagnostic detail that narrows the leak to the reply-run registry rather than the run-handle registry.

    Environment

    • OpenClaw 2026.6.11 (e13d838), self-hosted macOS (launchd gui agent), Node 22.22.2
    • #95039 (0239932) confirmed contained in the build (git merge-base --is-ancestor → yes; first tag v2026.6.10)
    • Channel: WhatsApp group (Baileys), dedicated agent binding, requireMention=false for the room
    • messages.groupChat.visibleReplies=automatic at incident time; model openai/gpt-5.5, queue mode default (steer)
    • Local checkout carries unrelated overlay commits; src/auto-reply/reply/reply-run-registry.ts, src/auto-reply/reply/get-reply-run.ts, src/auto-reply/reply/dispatch-from-config.ts, src/agents/embedded-agent-runner/runs.ts, src/agents/embedded-agent-runner/run-state.ts, and src/logging/** are byte-identical to the v2026.6.11 tag (verified via git diff v2026.6.11...HEAD -- <paths> → 0 lines)

    Sequence (2026-07-08, UTC)

    1. 21:46:13–21:48:47 — user sends a flurry of 7 group messages (text + PDF attachments). Embedded run ff1e686a processes them, delivers a visible media reply at 21:48:31 (3EB0181586F6E8DF0AC8DD), then logs embedded run done: runId=ff1e686a durationMs=153388 aborted=false at 21:48:47.
    2. 21:49:19 / 21:50:26 / 21:50:59 — three more user messages arrive and are enqueued. No new run starts. The lane emits zero further log lines at DEBUG granularity — no delivery attempt, no error, nothing between run-done and the first watchdog warning.
    3. 21:52:19 → 21:54:47 — six watchdog cycles: stuck session recovery outcome: status=skipped action=keep_lane reason=active_reply_work activeWorkKind=embedded_run.
    4. 21:55:19 — stuck session recovery reclaiming stale active reply work: age=360s queueDepth=1.
    5. 21:55:34 — action=abort_embedded_run aborted=true drained=false forceCleared=true released=0; lane frees, the queued messages finally process.

    Silent window for the user: 21:48:47 → 21:55:34 before recovery even began (default stuckSessionAbortMs = 360s here). Downstream, operator restarts during recovery caused Baileys to redeliver the unacked 10-message burst twice, producing duplicate and out-of-order turn processing — secondary damage, but it's what the wedge escalates into in practice.

    Diagnostic split: handle registry clean, reply-run registry leaked

    The reason=active_reply_work skips were emitted from the second branch of runStuckSessionRecovery (src/logging/diagnostic-stuck-session-recovery.runtime.ts:193), which is only reachable when activeSessionId is undefined — i.e. resolveActiveEmbeddedRunHandleSessionId(sessionKey), the session-file lookup, and isEmbeddedAgentRunHandleActive(sessionId) all found nothing. So at wedge time:

    • ACTIVE_EMBEDDED_RUNS (run-handle registry, src/agents/embedded-agent-runner/runs.ts) — clean, consistent with the embedded run done log at 21:48:47;
    • isEmbeddedAgentRunActive(sessionId) still returned true via isReplyRunActiveForSessionId(sessionId) — i.e. the reply-run operation in src/auto-reply/reply/reply-run-registry.ts (replyRunState.activeRunsByKey) was never completed/released for a run that finished aborted=false and had already delivered visible output mid-run.

    That narrows this survivor past the #95039 drain-restart fix: the dormant-drain restart can't help because the lane still looks occupied to admission — the leak is the un-completed reply-run operation itself, not a missed drain wakeup.

    Contrast with the OP variant: here the wedge is after a completed multi-message run on a group lane (documents/PDF media in the batch, not a bare 1:1 image), and the run had already sent a visible reply successfully before completing. So the strand does not require the pre-processing multimodal path — it can happen at the tail of an ordinary successful group turn.

    Repro conditions observed

    Happy to provide fuller log slices (DEBUG-level daily log retained) or run instrumented builds if that helps pin where the reply-run operation misses complete().

  7. 48 remaining items

  8. added
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    and removed
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Oct 8, 2026
  9. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    and removed
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Oct 16, 2026
  10. steipete commented on Oct 24, 2026

    @steipete
    Contributor

    Thanks for filing this. We're closing older issues that no longer look actionable on current main.

    The latest confirmation is on 2026.7.1, and reply-lane recovery has changed substantially since. We couldn't confirm the stall on current main; if it still happens on a current release, please open a fresh issue with a current trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions