Repository navigation
Conversation
A follow-up that was already persisted was rejected when a late /stop or /status exchange became the current turn. Context-free commands and fast-abort exchanges stay in the transcript without replacing that turn. Ordinary commands and newer user messages still supersede it. Co-authored-by: felirami <[email protected]>
|
🦞👀 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. |
|
Codex review: needs real behavior proof before merge. What this changesAllow replay admission to cross delayed Stop and context-free command exchanges without losing the already-persisted follow-up. Example: A delayed /stop exchange lands after FOLLOWUP_BRANCH_STOP_1 is persisted.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this PR addresses a current unanswered-message bug, preserves ordinary-command barriers, and is not fully superseded by the related Stop-only repair. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe command recorder persists delivered exchanges; session replay walks that history to select the user turn admitted to the model. flowchart LR
A[Command delivery] --> B[Command recorder]
B --> C[Transcript storage]
D[Persisted follow-up] --> C
C --> E[Current-turn traversal]
E --> F[Replay admission]
F --> G[Model response]
Technical reviewBest possible solution: Keep command classification in the recorder and replay selection in the existing traversal owner while preserving ordinary-command and newer-user barriers. Do we have a high-confidence way to reproduce the issue? Current source establishes the replay barrier, the canonical report supplies failing regressions, and the contributor supplies matching Gateway receipts; this read-only review executed no target code. Is this the best way to solve the issue? The change narrowly classifies the two demonstrated command cases through existing owners, preserves delivered history, and tests genuine superseding input without skipping arbitrary commands. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bdce9c84ea55. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +52, Tests +188, Other +2. Total +242 across 7 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed November 9, 2026, 5:52 PM ET / 22:52 UTC (Revision 3). |
|
@clawsweeper re-review — Opened by an AI agent from Arca. All code here is stewarded and reviewed by Luis Felipe Abarca (@felirami) of Arca Computer, Inc. (https://arca.computer). All Arca OSS contributions: https://oss.arcabot.ai |
|
🦞👀 Re-review progress:
|
preservesInFlightTurn is still set by the command recorder when the command text is an abort. Public command-exchange functions no longer accept it as a caller parameter. Co-authored-by: felirami <[email protected]>
Co-authored-by: felirami <[email protected]>
Upstream main is 352 test lines over its ceiling. This grant is the 187-line regression plus that inherited overage, with no extra slack. Co-authored-by: felirami <[email protected]>
Co-authored-by: felirami <[email protected]>
Main is 356 test lines over its ceiling. This grant is the 187-line regression plus that overage, with no extra slack. Co-authored-by: felirami <[email protected]>
Co-authored-by: felirami <[email protected]>
Upstream main is back within its test-line ceiling, so this grant covers only the delayed /stop and /status replay regression. Co-authored-by: felirami <[email protected]>
Co-authored-by: felirami <[email protected]>
|
@clawsweeper re-review The branch was refreshed onto upstream main ( — Opened by an AI agent from Arca. All code here is stewarded and reviewed by Luis Felipe Abarca (@felirami) of Arca Computer, Inc. (https://arca.computer). All Arca OSS contributions: https://oss.arcabot.ai |
|
🦞👀 Re-review progress:
|
…Stop reply is delivered late (#195612) Root cause: src/auto-reply/reply/dispatch-from-config.prepare-operation.ts:217 (on main 1680f54) the fast-abort path lets Stop cancel and release its own message source at once, while a direct Stop reply records its `/stop` exchange only later, at dispatcher settlement after delivery. A turn accepted while that reply is still being sent persists its user row first, so the Stop exchange lands after it and the follow-up can fail replay admission ("Persisted user turn changed before replay admission") and go unanswered. Fixes #194303 Thanks @amittell for the report, the root-cause analysis and this fix. Thanks @arcabotai for #195358, which reported the same unanswered follow-up; this PR fixes the Stop path at the producer instead of relaxing replay admission. ## What Problem This Solves Fixes: a message sent right after `/stop` is recorded ahead of the Stop exchange in session history, and can go unanswered, when the Stop reply reaches the channel late. ## User Impact User impact: after `/stop`, the next message waits until the Stop reply is delivered and recorded, then runs and is answered once, with the Stop exchange first in history. Input already waiting when Stop arrived is still cancelled, as before. ## Why This Change Was Made Once a stop request is recognized, before Stop selects anything, dispatch retains the Stop message's own source until the Stop reply settles (dispatcher settlement, bounded by the existing follow-up admission barrier timeout). The mailbox does not select past a source with unsettled work, so the next turn starts after the Stop rows. If the abort resolver throws or the message is not handled as a stop, the retention is released immediately. Unchanged: what Stop cancels, command classification, the command history format, and replay admission (a command row written before a turn still refuses a stale replay). #194336, #194396 and #195358 instead make command exchanges traversable for replay admission, which reverses the `c2cb56c665e` boundary; this PR touches neither replay predicate. Maintainer edits on top of @amittell's commits: merged current main, rewrote the retention without re-indenting the fast-abort branch (`.catch`/`.finally` instead of `try/finally`), and kept one red-on-base regression (dispatch order) in place of the two test files and the test-lines allocation. ## Evidence Observed proof lines (base and head): #195612 (comment) - Regression `dispatch-from-config.command-transcript.test.ts` > "records a late-delivered /stop before the next turn's row" (active run false/true): main 1680f54 fails 2/2 with `expected [ 'next-turn', 'command-input', …(1) ] to deeply equal [ 'command-input', …(2) ]`; this head passes 4/4. - Real Gateway (`ocx src --node`) with the Telegram plugin, a local Bot API that holds the Stop reply, and a local chat-completions model: on main the follow-up's user row and answer are written before `/stop` / `Agent was aborted.`; here the Stop exchange is recorded first, then the follow-up row and one answer. `/stop` alone behaves the same on both. - Replay admission still refuses a genuinely out-of-order replay: `attempt-session-replay-cohort.test.ts` (including `completed-after-preparation`), the steering replay test and `abort.test.ts` pass, 48/48. ## Merge danger Two-way door: no stored data, config or contract change; a revert restores the old ordering. Blast radius: channels that send `/stop` as a message; a hung Stop delivery delays the next turn by at most the existing follow-up admission barrier timeout. Co-authored-by: Ayaan Zaidi <[email protected]>
|
Thank you @arcabotai for working on this. The /stop case is fixed in #195612 (b42a8ff) at the source: /stop now holds its place until its reply is delivered and recorded, so the next message is written after it and answered, without changing replay admission. The delayed /status case from this PR is not covered there; if you can still reproduce a /status follow-up going unanswered on main, please open an issue with the steps. |
…Stop reply is delivered late (openclaw#195612) Root cause: src/auto-reply/reply/dispatch-from-config.prepare-operation.ts:217 (on main 5cd28bd) the fast-abort path lets Stop cancel and release its own message source at once, while a direct Stop reply records its `/stop` exchange only later, at dispatcher settlement after delivery. A turn accepted while that reply is still being sent persists its user row first, so the Stop exchange lands after it and the follow-up can fail replay admission ("Persisted user turn changed before replay admission") and go unanswered. Fixes openclaw#194303 Thanks @amittell for the report, the root-cause analysis and this fix. Thanks @arcabotai for openclaw#195358, which reported the same unanswered follow-up; this PR fixes the Stop path at the producer instead of relaxing replay admission. ## What Problem This Solves Fixes: a message sent right after `/stop` is recorded ahead of the Stop exchange in session history, and can go unanswered, when the Stop reply reaches the channel late. ## User Impact User impact: after `/stop`, the next message waits until the Stop reply is delivered and recorded, then runs and is answered once, with the Stop exchange first in history. Input already waiting when Stop arrived is still cancelled, as before. ## Why This Change Was Made Once a stop request is recognized, before Stop selects anything, dispatch retains the Stop message's own source until the Stop reply settles (dispatcher settlement, bounded by the existing follow-up admission barrier timeout). The mailbox does not select past a source with unsettled work, so the next turn starts after the Stop rows. If the abort resolver throws or the message is not handled as a stop, the retention is released immediately. Unchanged: what Stop cancels, command classification, the command history format, and replay admission (a command row written before a turn still refuses a stale replay). openclaw#194336, openclaw#194396 and openclaw#195358 instead make command exchanges traversable for replay admission, which reverses the `1bcf6c36036` boundary; this PR touches neither replay predicate. Maintainer edits on top of @amittell's commits: merged current main, rewrote the retention without re-indenting the fast-abort branch (`.catch`/`.finally` instead of `try/finally`), and kept one red-on-base regression (dispatch order) in place of the two test files and the test-lines allocation. ## Evidence Observed proof lines (base and head): openclaw#195612 (comment) - Regression `dispatch-from-config.command-transcript.test.ts` > "records a late-delivered /stop before the next turn's row" (active run false/true): main 5cd28bd fails 2/2 with `expected [ 'next-turn', 'command-input', …(1) ] to deeply equal [ 'command-input', …(2) ]`; this head passes 4/4. - Real Gateway (`ocx src --node`) with the Telegram plugin, a local Bot API that holds the Stop reply, and a local chat-completions model: on main the follow-up's user row and answer are written before `/stop` / `Agent was aborted.`; here the Stop exchange is recorded first, then the follow-up row and one answer. `/stop` alone behaves the same on both. - Replay admission still refuses a genuinely out-of-order replay: `attempt-session-replay-cohort.test.ts` (including `completed-after-preparation`), the steering replay test and `abort.test.ts` pass, 48/48. ## Merge danger Two-way door: no stored data, config or contract change; a revert restores the old ordering. Blast radius: channels that send `/stop` as a message; a hung Stop delivery delays the next turn by at most the existing follow-up admission barrier timeout. Co-authored-by: Ayaan Zaidi <[email protected]>
…Stop reply is delivered late (#195612) Root cause: src/auto-reply/reply/dispatch-from-config.prepare-operation.ts:217 (on main 1680f54) the fast-abort path lets Stop cancel and release its own message source at once, while a direct Stop reply records its `/stop` exchange only later, at dispatcher settlement after delivery. A turn accepted while that reply is still being sent persists its user row first, so the Stop exchange lands after it and the follow-up can fail replay admission ("Persisted user turn changed before replay admission") and go unanswered. Fixes #194303 Thanks @amittell for the report, the root-cause analysis and this fix. Thanks @arcabotai for #195358, which reported the same unanswered follow-up; this PR fixes the Stop path at the producer instead of relaxing replay admission. ## What Problem This Solves Fixes: a message sent right after `/stop` is recorded ahead of the Stop exchange in session history, and can go unanswered, when the Stop reply reaches the channel late. ## User Impact User impact: after `/stop`, the next message waits until the Stop reply is delivered and recorded, then runs and is answered once, with the Stop exchange first in history. Input already waiting when Stop arrived is still cancelled, as before. ## Why This Change Was Made Once a stop request is recognized, before Stop selects anything, dispatch retains the Stop message's own source until the Stop reply settles (dispatcher settlement, bounded by the existing follow-up admission barrier timeout). The mailbox does not select past a source with unsettled work, so the next turn starts after the Stop rows. If the abort resolver throws or the message is not handled as a stop, the retention is released immediately. Unchanged: what Stop cancels, command classification, the command history format, and replay admission (a command row written before a turn still refuses a stale replay). #194336, #194396 and #195358 instead make command exchanges traversable for replay admission, which reverses the `c2cb56c665e` boundary; this PR touches neither replay predicate. Maintainer edits on top of @amittell's commits: merged current main, rewrote the retention without re-indenting the fast-abort branch (`.catch`/`.finally` instead of `try/finally`), and kept one red-on-base regression (dispatch order) in place of the two test files and the test-lines allocation. ## Evidence Observed proof lines (base and head): #195612 (comment) - Regression `dispatch-from-config.command-transcript.test.ts` > "records a late-delivered /stop before the next turn's row" (active run false/true): main 1680f54 fails 2/2 with `expected [ 'next-turn', 'command-input', …(1) ] to deeply equal [ 'command-input', …(2) ]`; this head passes 4/4. - Real Gateway (`ocx src --node`) with the Telegram plugin, a local Bot API that holds the Stop reply, and a local chat-completions model: on main the follow-up's user row and answer are written before `/stop` / `Agent was aborted.`; here the Stop exchange is recorded first, then the follow-up row and one answer. `/stop` alone behaves the same on both. - Replay admission still refuses a genuinely out-of-order replay: `attempt-session-replay-cohort.test.ts` (including `completed-after-preparation`), the steering replay test and `abort.test.ts` pass, 48/48. ## Merge danger Two-way door: no stored data, config or contract change; a revert restores the old ordering. Blast radius: channels that send `/stop` as a message; a hung Stop delivery delays the next turn by at most the existing follow-up admission barrier timeout. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit b42a8ff) Co-authored-by: RomneyDa <[email protected]>
…Stop reply is delivered late (openclaw#195612) Root cause: src/auto-reply/reply/dispatch-from-config.prepare-operation.ts:217 (on main 1680f54) the fast-abort path lets Stop cancel and release its own message source at once, while a direct Stop reply records its `/stop` exchange only later, at dispatcher settlement after delivery. A turn accepted while that reply is still being sent persists its user row first, so the Stop exchange lands after it and the follow-up can fail replay admission ("Persisted user turn changed before replay admission") and go unanswered. Fixes openclaw#194303 Thanks @amittell for the report, the root-cause analysis and this fix. Thanks @arcabotai for openclaw#195358, which reported the same unanswered follow-up; this PR fixes the Stop path at the producer instead of relaxing replay admission. ## What Problem This Solves Fixes: a message sent right after `/stop` is recorded ahead of the Stop exchange in session history, and can go unanswered, when the Stop reply reaches the channel late. ## User Impact User impact: after `/stop`, the next message waits until the Stop reply is delivered and recorded, then runs and is answered once, with the Stop exchange first in history. Input already waiting when Stop arrived is still cancelled, as before. ## Why This Change Was Made Once a stop request is recognized, before Stop selects anything, dispatch retains the Stop message's own source until the Stop reply settles (dispatcher settlement, bounded by the existing follow-up admission barrier timeout). The mailbox does not select past a source with unsettled work, so the next turn starts after the Stop rows. If the abort resolver throws or the message is not handled as a stop, the retention is released immediately. Unchanged: what Stop cancels, command classification, the command history format, and replay admission (a command row written before a turn still refuses a stale replay). openclaw#194336, openclaw#194396 and openclaw#195358 instead make command exchanges traversable for replay admission, which reverses the `c2cb56c665e` boundary; this PR touches neither replay predicate. Maintainer edits on top of @amittell's commits: merged current main, rewrote the retention without re-indenting the fast-abort branch (`.catch`/`.finally` instead of `try/finally`), and kept one red-on-base regression (dispatch order) in place of the two test files and the test-lines allocation. ## Evidence Observed proof lines (base and head): openclaw#195612 (comment) - Regression `dispatch-from-config.command-transcript.test.ts` > "records a late-delivered /stop before the next turn's row" (active run false/true): main 1680f54 fails 2/2 with `expected [ 'next-turn', 'command-input', …(1) ] to deeply equal [ 'command-input', …(2) ]`; this head passes 4/4. - Real Gateway (`ocx src --node`) with the Telegram plugin, a local Bot API that holds the Stop reply, and a local chat-completions model: on main the follow-up's user row and answer are written before `/stop` / `Agent was aborted.`; here the Stop exchange is recorded first, then the follow-up row and one answer. `/stop` alone behaves the same on both. - Replay admission still refuses a genuinely out-of-order replay: `attempt-session-replay-cohort.test.ts` (including `completed-after-preparation`), the steering replay test and `abort.test.ts` pass, 48/48. ## Merge danger Two-way door: no stored data, config or contract change; a revert restores the old ordering. Blast radius: channels that send `/stop` as a message; a hung Stop delivery delays the next turn by at most the existing follow-up admission barrier timeout. Co-authored-by: Ayaan Zaidi <[email protected]> Release adaptation: Add callback to existing abort parameter type; defer Stop transcript through existing dispatcher lifecycle barrier. (cherry picked from commit b42a8ff) Co-authored-by: RomneyDa <[email protected]>
Closes #194303
What Problem This Solves
Fixes: a follow-up that is already the next persisted user turn is never answered when a delayed
/stopor/statuscommand exchange lands before that turn is replayed.User Impact
User impact: after
/stop(and/statusin the same window), the queued follow-up is answered once instead of being dropped. Ordinary commands such as/model, and newer user messages, still supersede that older turn. The command exchange stays in the transcript.Why This Change Was Made
A delayed command exchange can become the current turn even though a later user message was already persisted. The walk that selects the current turn now crosses context-free commands (including
/status) and/stopexchanges, so the already-persisted follow-up stays the admitted turn.Reparenting that follow-up would rewrite its admission anchor. Holding the next persist across abort settlement can deadlock Stop. This change keeps those producer-side options out of the path and does not let replay cross ordinary context-bearing commands.
The
/stopmarker (preservesInFlightTurn) is set by the command recorder when the command text is an abort. It is stored message metadata, not a caller-selectable parameter on the public command-exchange APIs.Evidence
Focused regression (
attempt-session-replay.command-exchange.test.ts): a delayed/stopor/statusexchange is injected after replay preparation on both reader paths. Without the change, admission throwsPersisted user turn changed before replay admission. With it, the follow-up is answered exactly once; the model prompt contains that follow-up once and does not treat/stopor/statusas the user question. A later/modelexchange or a newer plain user message still fails admission of the older follow-up. GitHub CI one418fb5221cdwas green (88 successful checks). A follow-up commit (08e8a771e04e) keepspreservesInFlightTurninternal to the recorder and does not change that runtime behavior.Live isolated Gateway on Linux, using a local holding model, against current
main(7726572226387e4f6c0400a6d0667a5fd153a677) and this branch ate418fb5221cd3e99c5d9502986236ca41688d631(the later type-only follow-up does not change these receipts). The command abort or status reply is produced immediately, delivery is held, a follow-up user row is persisted, then the held exchange is released so those rows land immediately after the follow-up:/stop: current main left the follow-up unanswered in 3 of 3 runs (0 model requests;No answer was returned. Ask again if you still need one.). This branch answered that follow-up exactly once in 3 of 3 runs (ANSWER_FOR FOLLOWUP_BRANCH_STOP_N). The/stoprows on this branch carrypreservesInFlightTurn: true./status: current main left the follow-up unanswered in 3 of 3 runs (same silent drop). This branch answered that follow-up exactly once in 3 of 3 runs (ANSWER_FOR FOLLOWUP_BRANCH_STATUS_N). The/statusrows carrycontextFreeCommand: trueand were not treated as the user question.The named admission-error text was not printed on these live runs. On current main the follow-up run exits without a model request after the delayed command rows land; the focused regression remains the inspectable source of
Persisted user turn changed before replay admission.Upgrade and stored-data compatibility from
v2026.11.1(4ffdd2047d192dd65554de3c8c46c0e0197c6e2a): a session created on that release (13 rows, including answered follow-ups,/fast on, a/stopwithout the new flag, and/status) was opened with this branch after the normal session-database schema upgrade. All 13 pre-upgrade rows loaded unchanged, and session settings includingfastMode: truewere preserved. A new follow-up on that upgraded session was answered (FOLLOWUP_UPG_NEW_1 still there?→ANSWER_FOR FOLLOWUP_UPG_NEW_1). A new/stopwritten after the upgrade receivedpreservesInFlightTurn: truewithout rewriting the v2026.11.1/stop(preservesInFlightTurnstayed unset/false on that older row).Redacted live receipts (persistence, delayed command recording, admission, one answer)
Current main, delayed
/stop(1 of 3; the other two matched)This branch, delayed
/stop(1 of 3; the other two matched)Current main, delayed
/status(1 of 3; the other two matched)/statusdoes not abort the long turn. The long turn completed, the follow-up was persisted, then the held/statusexchange landed after it.This branch, delayed
/status(1 of 3; the other two matched)Upgrade from v2026.11.1
On
v2026.11.1the session had 13 rows, includingANSWER_FOR FOLLOWUP_UPG_OLD_1,/fast on, a/stopwithoutpreservesInFlightTurn,ANSWER_FOR FOLLOWUP_UPG_OLD_2, and/status. After opening that same store with this branch:— Opened by an AI agent from Arca. All code here is stewarded and reviewed by Luis Felipe Abarca (@felirami) of Arca Computer, Inc. (https://arca.computer). All Arca OSS contributions: https://oss.arcabot.ai