openclaw - 💡(How to fix) Fix TUI Esc abort can leave stale optimistic busy state [3 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The TUI can remain stuck in the busy-submit path after pressing Esc to abort a pending run. The first Esc successfully aborts the backend run, but the local optimistic submit flag remains set, so the next normal prompt is blocked with:

agent is busy — press Esc to abort before sending a new message

Pressing Esc again then reports:

no active run

because both tracked run ids are already clear while pendingOptimisticUserMessage is still true.

Root Cause

because both tracked run ids are already clear while pendingOptimisticUserMessage is still true.

Fix Action

Fixed

Code Example

agent is busy — press Esc to abort before sending a new message

---

no active run
RAW_BUFFERClick to expand / collapse

Summary

The TUI can remain stuck in the busy-submit path after pressing Esc to abort a pending run. The first Esc successfully aborts the backend run, but the local optimistic submit flag remains set, so the next normal prompt is blocked with:

agent is busy — press Esc to abort before sending a new message

Pressing Esc again then reports:

no active run

because both tracked run ids are already clear while pendingOptimisticUserMessage is still true.

Current behavior

The TUI submit guard treats pendingOptimisticUserMessage as busy state. abortActive() clears pendingChatRunId after a successful abort, but it does not clear pendingOptimisticUserMessage.

That can leave the TUI in a contradictory local state:

  • no active chat run id
  • no pending chat run id
  • optimistic user message still pending
  • prompt submission blocked as busy
  • second Esc cannot abort anything and shows no active run

Expected behavior

After a successful Esc abort of the active or pending TUI run, the TUI should clear all local pending-submit state for that run so the next prompt can be sent normally.

Expected behavior:

  • pendingChatRunId is cleared
  • pendingOptimisticUserMessage is cleared
  • activity status becomes aborted
  • the next normal prompt is not blocked by stale optimistic state
  • repeated Esc after the abort does not become the only way to discover there is no tracked run

Notes

Relevant paths:

  • src/tui/tui-command-handlers.ts blocks normal submits when pendingOptimisticUserMessage is set.
  • src/tui/tui-session-actions.ts clears pendingChatRunId on successful abort, but currently leaves pendingOptimisticUserMessage set.
  • This is distinct from #85782, which covers lifecycle/provider errors leaving active-run state stuck.

Acceptance criteria

  • A successful Esc abort clears stale optimistic submit state.
  • Switching sessions also clears stale optimistic submit state along with the other run-state fields.
  • Add focused regression coverage for aborting while both pendingChatRunId and pendingOptimisticUserMessage are set.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

After a successful Esc abort of the active or pending TUI run, the TUI should clear all local pending-submit state for that run so the next prompt can be sent normally.

Expected behavior:

  • pendingChatRunId is cleared
  • pendingOptimisticUserMessage is cleared
  • activity status becomes aborted
  • the next normal prompt is not blocked by stale optimistic state
  • repeated Esc after the abort does not become the only way to discover there is no tracked run

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix TUI Esc abort can leave stale optimistic busy state [3 pull requests]