Fix TUI Esc abort stale busy state#86200
Conversation
|
Codex review: needs changes before merge. Reviewed June 3, 2026, 2:38 PM ET / 18:38 UTC. Summary PR surface: Source +94, Tests +47. Total +141 across 8 files. Reproducibility: yes. for the patch defect by source inspection: Esc starts abortActive asynchronously, abortActive returns restoredDraftText only after awaiting abortChat, and the later editor.setText can overwrite text typed during that gap. I did not run an interactive PTY repro in this read-only review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Land a canonical TUI pending-submit fix that preserves current main's stale-busy clearing, guards draft restoration against editor races, and then closes or supersedes overlapping pending-message PRs. Do we have a high-confidence way to reproduce the issue? Yes for the patch defect by source inspection: Esc starts abortActive asynchronously, abortActive returns restoredDraftText only after awaiting abortChat, and the later editor.setText can overwrite text typed during that gap. I did not run an interactive PTY repro in this read-only review. Is this the best way to solve the issue? No, not yet. Restoring a still-unregistered aborted draft is a reasonable fix direction, but the best version must make the restore conditional on the editor not having changed and should include focused regression coverage for that ordering case. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 892602eaba07. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +94, Tests +47. Total +141 across 8 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
04dcad1 to
6cbefa6
Compare
6cbefa6 to
21f2ff2
Compare
|
Future hardening note: this PR keeps the fix TUI-local and intentionally conservative. The TUI now treats the submitted prompt as a restore candidate only until a chat/lifecycle event or history reconciliation proves the run is registered/durable; early Esc abort can then redact the pending row and restore the text into the editor. A more deterministic gateway-level version would add an explicit user-prompt durability signal, for example a |
This comment was marked as spam.
This comment was marked as spam.
21f2ff2 to
4504b2c
Compare
|
Addressed ClawSweeper feedback:
Verification: node scripts/run-vitest.mjs src/tui/tui-command-handlers.test.ts src/tui/tui-session-actions.test.ts src/tui/tui-event-handlers.test.ts src/tui/components/chat-log.test.ts src/tui/tui.test.ts
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.ui.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-ui.tsbuildinfo
git diff --check
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
792880e to
a17209c
Compare
a17209c to
c1793c6
Compare
|
Issue already fixed |
Summary
pendingOptimisticUserMessageafter a successful TUI abort of a pending submit, alongsidependingChatRunId.abortActive()so Esc,/stop, and stop-text abort paths handle pending submits consistently.Fixes #86199
Verification
node scripts/run-vitest.mjs src/tui/tui-command-handlers.test.ts src/tui/tui-session-actions.test.ts src/tui/tui-event-handlers.test.ts src/tui/components/chat-log.test.ts src/tui/tui.test.tsnode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.ui.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-ui.tsbuildinfogit diff --checkReal behavior proof
Behavior addressed: TUI Esc abort could clear the pending run id while leaving
pendingOptimisticUserMessageset, causing the next prompt to be blocked as busy even though a second Esc reportedno active run. During the earliest submit window, a same-session history reload could also erase the just-submitted prompt before the run id was fully bound. Early Esc abort now restores the still-unregistered prompt to the editor instead of leaving it as a lost transcript row, and command-driven aborts share the same pending draft cleanup.Real environment tested: macOS arm64, Node v22.22.0, OpenClaw worktree
tui-contradicting-esc-pattern, commit 4504b2c.Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: the regression coverage verifies that aborting a pending run clears both local busy-state fields, pending user prompts survive same-session history reloads when history has not committed them yet, pending prompts reconcile to a single history-backed row once the submitted prompt appears in history, chat/lifecycle registration clears the local draft-restore candidate, and command aborts of a pending run drop the pending row and restore the draft through shared
abortActive()cleanup.What was not tested: no live interactive TUI PTY run was executed; coverage is focused unit coverage for the state transitions behind the stale busy lock, early prompt disappearance, and early-abort draft restoration.