Skip to content

[Bug]: Control UI chat can stay stuck busy and stop flushing queued messages after a long run #42213

Closed
BingqingLyu/openclaw
#370

Description

@siewcapital

Summary

Control UI chat can get stuck in a busy state after a long-running chat.send run. When that happens, the next user message is queued in the UI but never flushes automatically. Sending another message later can cause the previous queued work to resume.

Symptoms

  • A long task appears to stop progressing in the Control UI chat
  • The compose box still accepts input, but the next message does not actually send
  • The message is queued behind the stale run
  • After another manual prompt (for example, "continue your job"), the session resumes and the queued work can continue

Expected behavior

  • If the original run has already finished on the gateway, the UI should recover automatically
  • Queued messages should flush once the previous run is no longer active
  • The user should not have to send another prompt just to unstick the session

Actual behavior

  • The UI can remain blocked by a stale chatRunId
  • Queued messages stay in the queue because the UI never sees the terminal event that would normally clear the busy state

Root cause hypothesis

The backend already supports agent.wait for chat.send runs, including cases where the run finishes without normal lifecycle events. The Control UI appears to rely only on chat terminal events to clear chatRunId, so a missed final/error/aborted event can leave the session stuck busy.

Why this matters

This makes long-running chat interventions unreliable in the dashboard. The user sees work stop, types a follow-up message, and that message silently waits instead of going out.

Evidence

  • Reproduced in the Control UI chat with a long-running task
  • Existing backend tests already cover agent.wait resolving chat.send runs without lifecycle events
  • UI code paths show the queue only flushes once the busy state is cleared

Activity

  1. clawsweeper commented on Apr 27, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 19, 2026, 5:51 AM ET / 09:51 UTC.

    Summary
    Keep open: current Control UI blocks the durable outbox while a local run marker remains, and its recovery only clears that marker from a terminal event or an inactive/terminal session row. The reported missed-event path therefore remains plausible, and the open linked repair is the canonical path rather than a reason to dispatch duplicate work.

    Reproducibility: yes. source provides a high-confidence deterministic fault path: retain chatRunId, drop the terminal event and inactive session update, then enqueue a visible-session follow-up. I did not execute that path in this read-only review.

    Regression provenance
    Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

    Next step
    An open linked repair already owns the same owner-boundary fix, so another automated fix PR would duplicate active work.

    Review details

    Best possible solution:

    Review and land the owner-boundary repair in #126180 after exact-run fault proof covers dropped terminal and session-state events.

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

    Yes, source provides a high-confidence deterministic fault path: retain chatRunId, drop the terminal event and inactive session update, then enqueue a visible-session follow-up. I did not execute that path in this read-only review.

    Is this the best way to solve the issue?

    Yes: recording an exact terminal-run fact at the Gateway lifecycle owner and consuming it at the existing UI recovery boundary is safer than adding a browser watchdog or speculative timeout.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The linked repair changes both Gateway lifecycle projection and Control UI delivery; its exact-run proof must show that active or unrelated runs are never cleared while a settled matching run resumes FIFO delivery.

    Codex review notes: model internal, reasoning high; reviewed against 7bf21bc824c5.

    Label changes

    Label justifications:

    • P1: A normal Control UI chat workflow can leave a user follow-up unsent until the user manually intervenes.
    • impact:session-state: A stale local run identity incorrectly keeps the selected chat session busy after the Gateway has settled.
    • impact:message-loss: The affected queued message is suppressed indefinitely rather than automatically delivered after the prior run ends.
    Evidence reviewed

    What I checked:

    Likely related people:

    • Shubhankar Tripathy: Current-main blame attributes the session-row reconciliation that governs this recovery boundary to their commit. (role: recent Control UI lifecycle contributor; confidence: high; commits: f0b40777b85b; files: ui/src/pages/chat/run-lifecycle.ts, ui/src/pages/chat/chat-state-events.ts)
    • yanmo42: The open canonical repair carries forward the narrower lifecycle-owner recovery direction and preserves this contributor’s work. (role: candidate repair author; confidence: medium; commits: b8696bd2c0a0; files: ui/src/pages/chat/chat-outbox-drain.ts, ui/src/pages/chat/run-lifecycle.ts)
    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.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P2
    clawsweeper:source-repro
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    impact:message-loss
    impact:session-state
    issue-rating: 🦞 diamond lobster
    on May 16, 2026
  3. openclaw-barnacle commented on Jun 8, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  4. added
    stale
    on Jun 8, 2026
  5. added
    issue-rating: 🐚 platinum hermit
    clawsweeper:needs-live-repro
    and removed
    clawsweeper:source-repro
    issue-rating: 🦞 diamond lobster
    on Jun 18, 2026
  6. removed
    stale
    on Jun 19, 2026
  7. 8 remaining items

  8. wnzzer commented on Jul 16, 2026

    @wnzzer

    Still reproduces on OpenClaw 2026.7.1 (commit 2d2ddc4) — Web/Control UI, browser.

    Confirming this is still present on the latest release. Exact scenario:

    • A long-ish assistant reply completed normally (visible in the transcript).
    • The next message I typed while the agent was busy stayed pinned under Queued (1) and never flushed after the run finished — it just sat there indefinitely, with no auto-recovery.
    • Model: Claude Opus 4.6, main agent, browser Web UI.

    The workaround described in the issue is confirmed working: sending one more message clears the stale busy state and the queued message finally goes out.

    Screenshot detail: the assistant's reply finished at 21:50, and the follow-up message stayed frozen in Queued (1) afterward — never sent.

    The linked fix PR #90618 still appears open/unmerged — is anything blocking it from landing? Happy to help test a build.

  9. added
    issue-rating: 🐚 platinum hermit
    clawsweeper:needs-live-repro
    and removed
    clawsweeper:source-repro
    issue-rating: 🦞 diamond lobster
    on Jul 31, 2026
  10. added
    clawsweeper:source-repro
    issue-rating: 🦞 diamond lobster
    P1
    and removed
    clawsweeper:needs-live-repro
    issue-rating: 🐚 platinum hermit
    P2
    on Aug 13, 2026
  11. clawsweeper commented on Aug 23, 2026

    @clawsweeper
    Contributor

    Fixed by PR #126180, merged as a77fbde. The Gateway now records the exact terminal client run across lifecycle and restart-recovery owners, and the Control UI releases only the matching queued follow-up. Focused browser, Gateway, protocol-generation, exact-head CI, autoreview, and three consecutive clean ClawSweeper reviews passed.

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

    P1clawsweeper:linked-pr-openclawsweeper:no-new-fix-prclawsweeper:source-reproimpact:message-lossimpact:session-stateissue-rating: 🦞 diamond lobster

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions