Repository navigation
fix: Web UI turns still ask to try again after a stall - #162490
Conversation
|
@clawsweeper review |
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 6:55 AM ET / 10:55 UTC (Revision 8). ClawSweeper reviewWhat this changesThe branch delivers stalled Web UI answers through the original request’s reply owner and prevents inherited skill-library authoring during recovery. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still excludes standalone Web UI recovery. The latest commit resolves the previous Workshop authority concern by removing its writable recovery path; no blocking defect remains. Priority: P1 Review scores
Verification
How this fits togetherGateway chat requests enter OpenClaw’s agent reply pipeline. After a stalled turn is aborted, the follow-up queue can recover an answer from its transcript and deliver it back to the originating chat. flowchart TD
A[Web UI request] --> B[Agent turn and transcript]
B --> C[Stall watchdog abort]
C --> D{Recovery can be delivered?}
D -->|Yes| E[One queued recovery]
D -->|No| F[Retry notice]
E --> G[Source reply owner]
G --> H[Chat answer and history]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +30, Tests +125, Docs 0. Total +155 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep recovery on the existing source-owned follow-up lane, with fresh-message recovery for library authoring and group admission handled separately. Do we have a high-confidence way to reproduce the issue? Yes: current main explicitly refuses standalone recovery for a source-owned Web UI turn, matching the recorded real Gateway stall. This review verified the source path without executing it. Is this the best way to solve the issue? Yes: reusing the existing source retry owner avoids a competing delivery mechanism, and the latest authoring denial removes the previously exposed workspace fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d64730851269. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
…h their source reply owner
…ing turns without tools
35b84d3 to
a581c93
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper approve |
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 5e2d8e3.
|
## What Problem This Solves Fixes: when a Web UI (`chat.send`) turn stalls, and the automatic recovery from #162490 also stalls, the user gets neither an answer nor the "stopped making progress" notice. The chat just shows the run as aborted. ## User Impact In that double-stall case, Web UI users see the same "⚠️ This turn was interrupted because it stopped making progress. Please try again." error they got before #162490. A user's own cancel stays silent, and channel delivery is unchanged. ## Why This Change Was Made #161069 and #162490 promise one last-resort notice if the recovery run also stalls. `followup-delivery.ts` builds that notice payload. The follow-up runner, though, reported the watchdog-aborted run to its source owner as `completion: aborted`, the same as a user cancel. The `chat.send` finalizer (`chat-send-source-finalization.ts`) correctly hides final payloads for aborted runs and emits a bare `aborted` event, so the notice was dropped. The #162490 test missed this because it mocked the finalizer as "delivered". The follow-up runner owns the completion it reports, so the fix is there. A stall-recovery run whose operation the watchdog stalled before any output now completes as `failed`, with the notice as its error. The Gateway already sends that through its terminal error contract (`state: "error"`), the same way the original stalled turn did before #162490. Other aborted follow-ups, including user cancels (`aborted_by_user`), still classify as `aborted` and stay silent. This change adds no new message: it restores the existing notice on the one surface that lost it. Hermes (sibling framework) handles an inactivity timeout the same way: it returns a failed run result with diagnostic text through the turn's own reply path, never a silent cancel. ## Bounded cost No new model calls or runs. This only changes how an already-finished recovery run is classified. Recovery still happens at most once per stalled turn; the existing test covers this (2 model turns, empty queue). ## Evidence - `agent-runner.stalled-turn.test.ts` "sends the Web UI notice, not a second recovery, when the recovery also stalls" now drives the real `createChatSendLateReplyFinalizer`, with a real Gateway request context, and asserts the `chat` event it broadcasts. - On `main` it fails: `state: "aborted"`, no notice. - With the fix it passes: one `state: "error"` event whose `errorMessage` is the notice. - **Live model, real Gateway `chat.send` client.** A local proxy sits in front of the real OpenAI API (`gpt-6-astra`), and an operator WebSocket client (the TUI's `GatewayClient`) sends "What is 17*23? Reply with just the number." and records the `chat` events. A live model can't be made to stall, so the proxy reproduces the stall shape for the question's requests (4 failing requests, then held open until the abort) for both the original turn and its recovery. QA stuck-session bound: 30 s. - **Before (`origin/main` d06974d):** two stuck aborts (ages 48 s and 59 s). The client receives `aborted` for the original run at +56.7 s, then `aborted` for the recovery run at +116.8 s. No notice and no answer. - **After (head `823a966`):** same two stuck aborts (ages 49 s and 59 s). The client receives `aborted` for the original run at +56.7 s, then `state: "error"` with "⚠️ This turn was interrupted because it stopped making progress. Please try again." for the recovery run at +116.7 s. - Telegram isn't affected: channel follow-ups route the notice payload directly, and this change only alters the completion reported to a source owner. - Wall time: `pnpm test src/auto-reply/reply/agent-runner.stalled-turn.test.ts --maxWorkers=1` takes 39.6 s real, 36.0 s Vitest duration (60% transform, 30% tests) for 12 tests. The file's whole suite runs the real `runReplyAgent` with a SQLite transcript. This defect only shows at the boundary between the follow-up runner's completion and the chat.send finalizer, so a cheaper unit test of either side alone (the old mocked finalizer) missed it. - Sibling suites pass: `followup-runner`, `followup-delivery`, `chat-send-late-followup`, and `server.chat-queued-followup` (real Gateway WebSocket), 104 tests. - `node scripts/check-changed.mjs` passes. Optional cleanup of the expired-personal-grant stub was skipped; it would grow the diff. No new user-visible messages: this restores the existing notice on the one surface that lost it, and user cancels stay silent. LOC vs `origin/main`: production +11/−1, tests +26/−10. No overlap with Pash/Sarah changes on the touched files. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves Fixes: Web UI (`chat.send`) turns that stall before replying still end with "⚠️ This turn was interrupted because it stopped making progress. Please try again." instead of the automatic recovery that channel DMs get since openclaw#161069. ## User Impact - When a Web UI turn stalls before replying, the user now gets the recovered answer instead of the retry notice. The stalled run ends as aborted, and the answer arrives as its own run in the same chat, the same way any queued Web UI follow-up arrives. If the recovery also stalls, the existing notice is sent once. - The recovery keeps its normal tools, except that Skill Workshop can't write to the skill library during a recovery. It answers "send a fresh message" instead. - Group-thread participant turns keep the notice. That is now the only exception, and it's stated in the docs. ## Why This Change Was Made openclaw#161069 kept the notice for Web UI turns because the recovery run had no owner that would deliver its answer ([maintainer decision](openclaw#161069 (comment))). Provenance of that owner: - openclaw#116649 binds every queued `chat.send` reply to its originating Gateway admission, so a late answer never goes out through a later same-session dispatcher. - openclaw#129001 added `createSourceRetry`, which gives a front-requeued run of the same source a fresh owner, and the `pending` state: a source that never handed its request to the queue keeps its own terminal, so a finished run gets no duplicate or late reply. - The recovery run inherited the stalled turn's still-`pending` owner, so its answer was dropped (`terminal-not-recorded`). The fix: - **The stalled turn hands its request to the recovery through the source's existing `createSourceRetry`.** A `pending` source that hands off is settled, so the original can never deliver once the retry exists, and the recovery owns the only delivery. The relaxed `pending` case is reachable only through the stall continuation, which runs after the stale watchdog aborted the source before any output. `createSourceRetry` has two callers: - the follow-up source retry in `followup-delivery.ts`, which only sees owners that already queued (`deliver`/`drop`); - the stall continuation. - **The openclaw#161069 early return is narrowed.** Only a source that explicitly declares no owner (`drop`) keeps the notice. - **Library authoring is not carried into the recovery.** Every authenticated Web UI human turn mints a library-authoring grant (`prepareGatewaySkillAuthoring`), and every run binds it at admission. By design (openclaw#134068) the grant refuses a replacement run, and the recovery is a new run, so it doesn't inherit the grant. Before this change the recovery failed with "Personal authoring cannot move to a replacement run" instead of answering. - Rule: a recovery run never inherits skill-library authoring. Whatever the original grant's target, the recovery gets an expired personal grant. The Workshop tool can't fall back to the workspace tool (`createSkillWorkshopTool`), and every call returns `AUTHORITY_EXPIRED` asking for a fresh message. All other tools stay available, and no access is widened. - Alternatives considered: - The existing per-run `conversationToolPolicy` replaces the configured group policy instead of adding to it, so using it as a deny list could widen access in group sessions. - Minting a fresh grant would relax openclaw#134068's replacement-run guard. Hermes (sibling framework) returns its timeout result through each turn's own reply path on every surface. This PR follows that idea of one reply owner per source. Hermes has no auto-continuation to borrow. ### Group threads: left for a follow-up Group-thread participant turns keep the notice. Participant reply options set `onQueuedFollowupReplyBatch: undefined` (openclaw#141411), which openclaw#116649's `in` check turns into a `drop` owner, so every queued participant reply is dropped. Omitting that key makes the recovery reach the group: in a qa-channel run the group got `STALLED-TURN-RECOVERED-OK` instead of the notice. The same run showed a second group message, arriving while the recovery ran, ending `skipped:reply-operation-active` with no reply. Participant reply options also clear `turnAdoptionLifecycle`, so a participant turn on a busy session never reaches queue policy (`allowGatewayQueueResolution` in `dispatch-from-config.lifecycle.ts`). Fixing that needs its own change to participant admission, so this PR doesn't enable group recovery. ## Bounded cost - **Recovery runs at most once per stalled turn.** `continueStalledTurn` is armed only for direct turns and called once from the aborted-dispatch finisher. The recovery runs on the follow-up runner, which never arms it, so if the recovery also stalls the existing notice is sent and nothing else starts. Tested: "sends the Web UI notice, not a second recovery, when the recovery also stalls" (2 model turns total, empty queue). - **One delivery per handed-off source.** After `createSourceRetry` from `pending`, the original owner is settled and refuses both delivery and further retries. Tested: "gives a pending source's only delivery to the retry it hands off to". - **No recovery where its answer would be dropped.** Tested: "leaves the notice with a group-thread participant whose source declares no reply owner". - **No wider tool access.** Tested: "never lets a personal/workspace-target recovery author skills while keeping its other tools". No tools are disabled. ## Evidence - **Real Gateway `chat.send`.** A QA Gateway child, mock-openai with the stalled-turn fixture, `QA_DIAGNOSTIC_STUCK_SESSION_ABORT_MS=30000`, and an operator `GatewayClient` (TUI pattern) recording `chat` broadcasts: - Before (`80290b4`): `+56.4s state=error "⚠️ This turn was interrupted because it stopped making progress. Please try again."`, then `aborted`. 5 mock requests, none guided. - After: `+58.6s aborted` for the stalled run, then `+59.5s state=final` under the recovery's own run id with the recovered answer. 6 mock requests: 5 stalled, 1 guided success. The answer is persisted in `chat.history`. - An intermediate run without the authoring change: the recovery was delivered through the new owner but failed with the authoring error. That run is what found the issue. - **Unit tests:** - The two Web UI tests in `agent-runner.stalled-turn.test.ts` fail on `main` (`continueStalledTurn` returned `false`) and pass now. - The owner, drop and authoring tests pass. - Wall times: `agent-runner.stalled-turn.test.ts` + `followup-delivery.test.ts`: 51 s (75 tests; plus `skill-workshop-tool.test.ts` 19 tests). `chat-send-late-followup.test.ts`: 2 s (6 tests). - `node scripts/check-changed.mjs` passes (typecheck, lint, guards). - **Head `c1bca05` (delivery path unchanged since):** the stalled run ends `aborted` at +59.1s, then `state=final` with the recovered answer under the recovery's run id at +60.1s. 6 mock requests, 1 guided. The answer is persisted in `chat.history`. LOC vs `origin/main`: production +36/−6, tests +130/−5, docs +1/−1. Co-authored-by: Ayaan Zaidi <[email protected]>
…#162713) ## What Problem This Solves Fixes: when a Web UI (`chat.send`) turn stalls, and the automatic recovery from openclaw#162490 also stalls, the user gets neither an answer nor the "stopped making progress" notice. The chat just shows the run as aborted. ## User Impact In that double-stall case, Web UI users see the same "⚠️ This turn was interrupted because it stopped making progress. Please try again." error they got before openclaw#162490. A user's own cancel stays silent, and channel delivery is unchanged. ## Why This Change Was Made openclaw#161069 and openclaw#162490 promise one last-resort notice if the recovery run also stalls. `followup-delivery.ts` builds that notice payload. The follow-up runner, though, reported the watchdog-aborted run to its source owner as `completion: aborted`, the same as a user cancel. The `chat.send` finalizer (`chat-send-source-finalization.ts`) correctly hides final payloads for aborted runs and emits a bare `aborted` event, so the notice was dropped. The openclaw#162490 test missed this because it mocked the finalizer as "delivered". The follow-up runner owns the completion it reports, so the fix is there. A stall-recovery run whose operation the watchdog stalled before any output now completes as `failed`, with the notice as its error. The Gateway already sends that through its terminal error contract (`state: "error"`), the same way the original stalled turn did before openclaw#162490. Other aborted follow-ups, including user cancels (`aborted_by_user`), still classify as `aborted` and stay silent. This change adds no new message: it restores the existing notice on the one surface that lost it. Hermes (sibling framework) handles an inactivity timeout the same way: it returns a failed run result with diagnostic text through the turn's own reply path, never a silent cancel. ## Bounded cost No new model calls or runs. This only changes how an already-finished recovery run is classified. Recovery still happens at most once per stalled turn; the existing test covers this (2 model turns, empty queue). ## Evidence - `agent-runner.stalled-turn.test.ts` "sends the Web UI notice, not a second recovery, when the recovery also stalls" now drives the real `createChatSendLateReplyFinalizer`, with a real Gateway request context, and asserts the `chat` event it broadcasts. - On `main` it fails: `state: "aborted"`, no notice. - With the fix it passes: one `state: "error"` event whose `errorMessage` is the notice. - **Live model, real Gateway `chat.send` client.** A local proxy sits in front of the real OpenAI API (`gpt-6-astra`), and an operator WebSocket client (the TUI's `GatewayClient`) sends "What is 17*23? Reply with just the number." and records the `chat` events. A live model can't be made to stall, so the proxy reproduces the stall shape for the question's requests (4 failing requests, then held open until the abort) for both the original turn and its recovery. QA stuck-session bound: 30 s. - **Before (`origin/main` 02f46a6):** two stuck aborts (ages 48 s and 59 s). The client receives `aborted` for the original run at +56.7 s, then `aborted` for the recovery run at +116.8 s. No notice and no answer. - **After (head `823a966`):** same two stuck aborts (ages 49 s and 59 s). The client receives `aborted` for the original run at +56.7 s, then `state: "error"` with "⚠️ This turn was interrupted because it stopped making progress. Please try again." for the recovery run at +116.7 s. - Telegram isn't affected: channel follow-ups route the notice payload directly, and this change only alters the completion reported to a source owner. - Wall time: `pnpm test src/auto-reply/reply/agent-runner.stalled-turn.test.ts --maxWorkers=1` takes 39.6 s real, 36.0 s Vitest duration (60% transform, 30% tests) for 12 tests. The file's whole suite runs the real `runReplyAgent` with a SQLite transcript. This defect only shows at the boundary between the follow-up runner's completion and the chat.send finalizer, so a cheaper unit test of either side alone (the old mocked finalizer) missed it. - Sibling suites pass: `followup-runner`, `followup-delivery`, `chat-send-late-followup`, and `server.chat-queued-followup` (real Gateway WebSocket), 104 tests. - `node scripts/check-changed.mjs` passes. Optional cleanup of the expired-personal-grant stub was skipped; it would grow the diff. No new user-visible messages: this restores the existing notice on the one surface that lost it, and user cancels stay silent. LOC vs `origin/main`: production +11/−1, tests +26/−10. No overlap with Pash/Sarah changes on the touched files. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: Web UI (⚠️ This turn was interrupted because it stopped making progress. Please try again." instead of the automatic recovery that channel DMs get since #161069.
chat.send) turns that stall before replying still end with "User Impact
Why This Change Was Made
#161069 kept the notice for Web UI turns because the recovery run had no owner that would deliver its answer (maintainer decision). Provenance of that owner:
chat.sendreply to its originating Gateway admission, so a late answer never goes out through a later same-session dispatcher.createSourceRetry, which gives a front-requeued run of the same source a fresh owner, and thependingstate: a source that never handed its request to the queue keeps its own terminal, so a finished run gets no duplicate or late reply.pendingowner, so its answer was dropped (terminal-not-recorded).The fix:
createSourceRetry. Apendingsource that hands off is settled, so the original can never deliver once the retry exists, and the recovery owns the only delivery. The relaxedpendingcase is reachable only through the stall continuation, which runs after the stale watchdog aborted the source before any output.createSourceRetryhas two callers:followup-delivery.ts, which only sees owners that already queued (deliver/drop);drop) keeps the notice.prepareGatewaySkillAuthoring), and every run binds it at admission. By design (feat(skills): add personal libraries for shared Gateways #134068) the grant refuses a replacement run, and the recovery is a new run, so it doesn't inherit the grant. Before this change the recovery failed with "Personal authoring cannot move to a replacement run" instead of answering.createSkillWorkshopTool), and every call returnsAUTHORITY_EXPIREDasking for a fresh message. All other tools stay available, and no access is widened.conversationToolPolicyreplaces the configured group policy instead of adding to it, so using it as a deny list could widen access in group sessions.Group threads: left for a follow-up
Group-thread participant turns keep the notice. Participant reply options set
onQueuedFollowupReplyBatch: undefined(#141411), which #116649'sincheck turns into adropowner, so every queued participant reply is dropped. Omitting that key makes the recovery reach the group: in a qa-channel run the group gotSTALLED-TURN-RECOVERED-OKinstead of the notice. The same run showed a second group message, arriving while the recovery ran, endingskipped:reply-operation-activewith no reply. Participant reply options also clearturnAdoptionLifecycle, so a participant turn on a busy session never reaches queue policy (allowGatewayQueueResolutionindispatch-from-config.lifecycle.ts). Fixing that needs its own change to participant admission, so this PR doesn't enable group recovery.Bounded cost
continueStalledTurnis armed only for direct turns and called once from the aborted-dispatch finisher. The recovery runs on the follow-up runner, which never arms it, so if the recovery also stalls the existing notice is sent and nothing else starts. Tested: "sends the Web UI notice, not a second recovery, when the recovery also stalls" (2 model turns total, empty queue).createSourceRetryfrompending, the original owner is settled and refuses both delivery and further retries. Tested: "gives a pending source's only delivery to the retry it hands off to".Evidence
chat.send. A QA Gateway child, mock-openai with the stalled-turn fixture,QA_DIAGNOSTIC_STUCK_SESSION_ABORT_MS=30000, and an operatorGatewayClient(TUI pattern) recordingchatbroadcasts:f525f46):+56.4s state=error "⚠️ This turn was interrupted because it stopped making progress. Please try again.", thenaborted. 5 mock requests, none guided.+58.6s abortedfor the stalled run, then+59.5s state=finalunder the recovery's own run id with the recovered answer. 6 mock requests: 5 stalled, 1 guided success. The answer is persisted inchat.history.agent-runner.stalled-turn.test.tsfail onmain(continueStalledTurnreturnedfalse) and pass now.agent-runner.stalled-turn.test.ts+followup-delivery.test.ts: 51 s (75 tests; plusskill-workshop-tool.test.ts19 tests).chat-send-late-followup.test.ts: 2 s (6 tests).node scripts/check-changed.mjspasses (typecheck, lint, guards).c1bca05(delivery path unchanged since): the stalled run endsabortedat +59.1s, thenstate=finalwith the recovered answer under the recovery's run id at +60.1s. 6 mock requests, 1 guided. The answer is persisted inchat.history.LOC vs
origin/main: production +36/−6, tests +130/−5, docs +1/−1.