Skip to content

fix(auto-reply): retire queued cancellation ownership when execution freezes - #118359

Open
wangyan2026 wants to merge 1 commit into
openclaw:mainfrom
wangyan2026:fix/reply-retire-queued-cancellation-on-freeze-118028
Open

wangyan2026 wants to merge 1 commit into
openclaw:mainfrom
wangyan2026:fix/reply-retire-queued-cancellation-on-freeze-118028

Conversation

@wangyan2026

@wangyan2026 wangyan2026 commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Related to #118028 (does not close — remaining terminal pre-start paths tracked there)

What Problem This Solves

After chat.send terminalizes, auto-reply queued followup runs keep their Gateway queued-cancel entry registered and still abortable, so a late chat.abort reports a finalizing run as aborted. Retire Gateway cancellation ownership through the existing onCancellationRetired lifecycle when execution freezes.

The maintainer-clarified production path (from closed PR #118057): chat.abort after chat.send terminalize reaches the queued run through abortQueuedChatTurnById (chat-abort-handler.ts:241), which checks only the entry's own abortable flag (chat-queued-turns.ts:156) and never consults isReplyRunAbortableForSignal. Execution freeze (freezeAbort) never retired the Gateway cancel entry, so finalizing runs could still be marked aborted — while synthetic aggregate owners (overflow summary, collect groups) had no onCancellationRetired at all.

Root Cause

mergeRunSignal in src/agents/embedded-agent-runner/stream-resolution.ts:278 composes callerSignal and runSignal with AbortSignal.any(...) when both exist and differ (#117731, 7c1d5dc7ef). The composite signal is handed to provider transports, which report request activity via notifyLlmRequestActivity(options.signal); the idle watchdog subscribes with its own streamAbortController.signal (llm-idle-timeout.ts:530-533). The activity registry is a WeakMap<AbortSignal, Set<...>> keyed by exact signal identity, so watchdog activity is lost.

For queued followups specifically, the maintainer clarified (#118057) that the production chat.abort route goes through abortQueuedChatTurnById (chat-abort-handler.ts:241), checking the entry's abortable flag, not isReplyRunAbortableForSignal. Execution freeze never retired the entry, so the finalizing run stayed abortable.

Canonical Repair

  • Call retireFollowupRunCancellation(executionParams.followupRun) inside commitTerminalOutcome in agent-runner-execution.ts, but only when execution has actually started — implemented using the shared hasReplyOperationExecutionStarted(executionParams.replyOperation) state (maintainer Rank-up move, no local executionStarted tracking). This closes the queued abort gate (entry.abortable = false) for individual followups, execution-started failures, and active/queued overlap. Pre-start failures (e.g. image resolution) are retryable — the follow-up runner requeues them when execution has not started, so their queued entry must remain abortable.
  • Call retireFollowupRunCancellation(turn.queued) only inside the preflightFailurePayload branch in followup-turn-execution.ts, which bypasses executeAgentTurn and proceeds directly to terminal delivery. The preflightError branch is NOT retired because it is retryable — the queued entry must remain abortable so the follow-up runner can classify it for retry. Normal execution paths are also NOT retired early; they reach commitTerminalOutcome at the existing freeze boundary.
  • Add onCancellationRetired to the synthetic aggregate lifecycles in queue/drain.ts — runSyntheticOverflowSummary and collect drainGroup — so collect/overflow ownership (which composes yet another signal) retires its real sources when the aggregate run freezes. In runSyntheticOverflowSummary, the synthetic turnAdoptionLifecycle is now always created (not only when onAdmitted exists), so singleton cancel-only overflow sources — where runQueueSummaryDelivery sets onAdmitted=undefined because needsAdmission=false — also receive freeze-time retirement.
  • Reuse the existing retireFollowupRunCancellation → onCancellationRetired → retireQueuedChatTurnCancellation chain (queue/types.ts:242, chat-send-handler.ts:425, chat-queued-turns.ts:112); no new registry surface, no isReplyRunAbortableForSignal changes.

Best-fix judgment: retiring at the execution-freeze boundary via the existing lifecycle chain is the narrowest owner boundary, exactly as the maintainer directed in #118057. Registering upstream abort signal aliases (PR #118057's approach) was rejected because the queued chat.abort path bypasses that lookup — repairing a registry row the production path never consults does not protect finalizing delivery.

User Impact

  • Queued followup runs that have begun finalizing are no longer falsely reported as aborted by a late chat.abort (e.g. a second abort arriving after the turn terminalized).
  • Individual followups, collect/overflow groups (including singleton cancel-only overflow), execution-started failures, terminal preflight-failure delivery, and active/queued overlap all retire Gateway cancellation ownership at the same freeze boundary.
  • Active queued runs and retryable preflight errors remain abortable — cancellation is retired only when execution reaches a terminal boundary (freeze or terminal preflight delivery).
  • Behavior while a run is still abortable is unchanged; no config, API, or default changes.

Remaining Terminal Pre-start Scope (P1 Merge Risk)

Terminal pre-start rejections outside the explicit preflightFailurePayload branch remain outside the execution-start retirement guard. These are tracked by the broader linked issue #118028. This PR's bounded repair addresses the execution-freeze boundary and the terminal preflight-failure delivery path; other terminal pre-start rejection paths retain their current behavior under the linked issue.

Evidence

Test Cost Report (--maxWorkers=1 wall time + CI seconds)

Per writing-tests cost budget, each new or materially changed test file reports measured one-worker wall time and estimated CI seconds. All measurements taken on the contributor host with node scripts/run-vitest.mjs <file> --maxWorkers=1.

Test file Tests Wall time (local) CI seconds (est.) Tier
test/chat-abort-frozen-queued.e2e.test.ts (new) 1 59.5s ~120s release-only (real ephemeral Gateway)
src/gateway/server-methods/chat.abort-frozen-queued-transport.test.ts (new) 1 93.0s ~150s real-Gateway transport
src/gateway/server-methods/chat.abort-frozen-queued-execution-owner.test.ts (new) 2 159.4s ~200s real execution owner
src/gateway/server-methods/chat.abort-frozen-queued-run.test.ts (new) 6 40.1s ~60s real-behavior harness
src/auto-reply/reply/agent-runner-execution-contract.test.ts (modified, +67 lines) 5 (of 5) 82.8s ~120s contract regression
src/auto-reply/reply/queue/lifecycle.test.ts (modified, +137 lines) 7 (of 7) 28.7s ~45s lifecycle regression

No real timers, sleeps, polling, or per-test Gateway/process boots. The transport and E2E tests boot a real Gateway at suite level (shared fixture), not per test. The execution-owner test uses getExecuteAgentTurnForTest() with shared state teardown. Total new local wall time: ~463s across 6 files; CI estimate ~695s.

Adjacent suites green (no new files in these shards):

Suite Tests Wall time (local)
followup-turn-execution 29/29 33.5s
queue.in-flight 4/4 31.8s
queue.drain-restart 23/23 32.6s
chat-queued-turns 21/21 5.0s

Per-File Results

  • node scripts/run-vitest.mjs --config test/vitest/vitest.e2e.config.ts test/chat-abort-frozen-queued.e2e.test.ts: 1/1 — real ephemeral Gateway E2E proof (real gateway process + held mock provider + real chat.send/chat.abort RPC)
  • node scripts/run-vitest.mjs src/gateway/server-methods/chat.abort-frozen-queued-transport.test.ts: 1/1 — real-Gateway transport proof (real Gateway RPC + held provider + queued successor + late abort during pending delivery)
  • node scripts/run-vitest.mjs src/gateway/server-methods/chat.abort-frozen-queued-execution-owner.test.ts: 2/2 (real execution owner + before-fix control)
  • node scripts/run-vitest.mjs src/gateway/server-methods/chat.abort-frozen-queued-run.test.ts: 6/6 (real-behavior harness + before-fix control + terminal preflightFailurePayload harness + preflightFailurePayload before-fix control + active queued run abortable control + retryable preflightError abortable control)
  • node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner-execution-contract.test.ts: 5/5 (incl. freeze-retire regression + pre-start failure retryable regression + started-error retire regression)
  • node scripts/run-vitest.mjs src/auto-reply/reply/queue/lifecycle.test.ts: 7/7 (incl. overflow + collect + singleton cancel-only overflow freeze-retire regression)
  • oxlint (0 errors on changed files)
  • No lockfile, config, protocol, schema-version, or public API change

Real-Transport Queued Successor Proof — Late chat.abort Rejected During Pending Delivery (REV 53)

src/gateway/server-methods/chat.abort-frozen-queued-transport.test.ts provides the strongest real-transport proof for the queued followup mode. It exercises a genuinely queued successor (not a direct turn) over real Gateway RPC with real queue admission.

Three fixture defects fixed (ClawSweeper Rev 53):

  1. Successor-specific gate (Rev 53 F1): The commitTurn hook now uses a call counter. The predecessor's commitTurn (1st call) acknowledges immediately with 204 — the predecessor can finish and the queue can drain. Only the successor's commitTurn (2nd call) blocks on releaseAfterTurn, creating the pending-delivery window. Previously the gate blocked every commitTurn, deadlocking the predecessor.

  2. Queued precondition snapshot (Rev 53 F2): queuedPrecondition is now snapshotted as modelRequests.length === 1 before releasing the predecessor (line 365). The final verdict uses this snapshot, so modelRequestCount: 2 and queuedPrecondition: true are no longer contradictory. Previously the precondition was calculated from the final request count, which is always 2.

  3. Valid commitTurn acknowledgement (Rev 53 F3): commitTurn now returns { status: "committed" } as required by the production outbox (context-engine-turn-outbox.ts:471-477). Previously it returned undefined, causing the outbox to throw "context engine does not implement commitTurn" and retain the pending turn.

Two-turn queued admission pattern (addresses ClawSweeper Rev 50 finding):

  1. First chat.send → provider holds the request → first turn becomes the active run
  2. waitForRunActive(events, firstRunId) → synchronizes on Gateway's real "starting_model" status event (session is now active)
  3. Second chat.send → resolveActiveRunQueueAction returns "enqueue-followup" (session is active) → registers Gateway queued cancellation entry
  4. Snapshot queuedPrecondition = modelRequests.length === 1 → queued precondition: second turn is waiting in the followup queue, not running concurrently
  5. Release first turn → predecessor's commitTurn acknowledges immediately → predecessor finishes → queue drains → followup starts executing
  6. commitTerminalOutcome → retireFollowupRunCancellation → retireQueuedChatTurnCancellation → entry.abortable = false
  7. Successor's commitTurn (2nd call) blocks via HTTP POST → pending-delivery window
  8. chat.abort for the followup → rejected (aborted: false) because entry.abortable === false
  9. Release commitTurn → delivery completes

This is the exact scenario ClawSweeper Rev 50/53 required: "Hold a first turn, enqueue a successor, and target that successor during its pending-delivery interval."

Regression control: The execution-owner test (chat.abort-frozen-queued-execution-owner.test.ts) provides the before-fix control that verifies the regression fails when terminal retirement is removed (same execution path with onCancellationRetired as no-op → aborted: true).

Transcript persistence: The test verifies the followup reply is durable in the transcript before abort, is not marked as aborted after the rejected abort, and survives a Gateway close/reopen cycle.

$ node scripts/run-vitest.mjs src/gateway/server-methods/chat.abort-frozen-queued-transport.test.ts

[transport] real Gateway + held provider + queued successor (redacted trace)
first turn active (provider request count=1)
second turn accepted (queued as followup, runId=...)
queued precondition verified: provider still has only 1 request (second turn is queued, not concurrent)
followup reply visible + commitTurn blocked (retirement done, delivery pending)
late chat.abort for queued successor: aborted=false runIds=[]
followup terminal status: ok
RESULT: queued successor un-aborted during pending delivery, delivery completed

FROZEN_QUEUED_TRANSPORT_VERDICT {"modelRequestCount":2,"queuedPrecondition":true,
  "commitTurnCallCount":2,
  "replyVisible":true,"durableRowsBeforeAbort":1,
  "abort":{"aborted":false,"runIds":[]},
  "terminalStatus":"ok","abortedReplyEvents":0,"finalReplyEvents":1,
  "durableRowsAfterAbort":1,"abortMarkedRowsAfterAbort":0,
  "reopenedRows":1,"reopenedAbortMarkedRows":0}

 ✓ |gateway-methods| src/gateway/server-methods/chat.abort-frozen-queued-transport.test.ts (1 test)

Real Execution Owner Proof — Late chat.abort Rejected During Pending Delivery

src/gateway/server-methods/chat.abort-frozen-queued-execution-owner.test.ts fills the gap identified by ClawSweeper: the E2E test sends abort after final delivery, and the separate harness manually retires the entry. Neither proved that the changed execution owner (executeAgentTurn → real commitTerminalOutcome) rejects abort while the queued entry remains present and delivery is pending.

This test calls the real executeAgentTurn (via getExecuteAgentTurnForTest()) with a followupRun whose turnAdoptionLifecycle is wired to real Gateway queued turns (registerQueuedChatTurn, retireQueuedChatTurnCancellation, completeQueuedChatTurn). After executeAgentTurn returns:

  • commitTerminalOutcome has fired (real, not manual) → retireFollowupRunCancellation → onCancellationRetired → retireQueuedChatTurnCancellation → entry.abortable = false
  • onSettled has NOT been called (delivery is still pending)
  • The queued entry is still present (retired, not deleted)

A late chat.abort is then issued via the real handleChatAbortRequestWithLifecycle while delivery is pending. The abort is rejected because entry.abortable === false (produced by the real commitTerminalOutcome, not manual retirement). The entry remains present after the rejected abort. Only when onSettled is called (delivery settles) is the entry deleted.

chat.send onDeferred  -> registerQueuedChatTurn          (real chat-queued-turns)
executeAgentTurn      -> commitTerminalOutcome           (real, the changed execution owner)
                      -> retireFollowupRunCancellation   (real queue/lifecycle)
                      -> onCancellationRetired           (real lifecycle callback)
                      -> retireQueuedChatTurnCancellation (real chat-queued-turns)
[delivery pending — onSettled NOT yet called, entry present, abortable=false]
late chat.abort       -> handleChatAbortRequestWithLifecycle (real Gateway handler)
[abort rejected: aborted=false, entry still present, abortable=false]
onSettled             -> completeQueuedChatTurn          (real chat-queued-turns)
[entry deleted by delivery]
$ node scripts/run-vitest.mjs src/gateway/server-methods/chat.abort-frozen-queued-execution-owner.test.ts

[exec-owner] registered queued entry: entry=queued-exec-owner abortable=undefined
[exec-owner] executeAgentTurn (real) -> commitTerminalOutcome (real) -> retireFollowupRunCancellation (real)
[exec-owner] after executeAgentTurn: entry.abortable=false entry.present=true deliverySettled=false
[exec-owner] late chat.abort while delivery pending -> handleChatAbortRequestWithLifecycle
[exec-owner] chat.abort responded: aborted=false runIds=[]
[exec-owner] entry.present=true after abort (rejected by retirement, not deletion)
[exec-owner] onSettled (delivery) -> completeQueuedChatTurn -> entry deleted
[exec-owner] RESULT: real execution owner rejected abort during pending delivery

 ✓ |gateway-methods| src/gateway/server-methods/chat.abort-frozen-queued-execution-owner.test.ts (1 test) 1063ms

Key distinction from prior proof: This test exercises the real executeAgentTurn production function (not a manual retireFollowupRunCancellation call), and issues chat.abort before onSettled (delivery) is called — proving the changed execution owner rejects abort during the decisive pending-delivery interval, with the queued entry still present and abortable=false.

Real Ephemeral Gateway E2E — Late chat.abort vs Frozen Queued Run

test/chat-abort-frozen-queued.e2e.test.ts runs a real ephemeral Gateway process (createOpenClawTestInstance + startGateway) against a held-back mock provider: the first chat.send stays active, the second chat.send queues as a followup and registers its Gateway cancel identity, the first turn is released so the queue drains and the followup terminalizes (freeze + retire), then a late chat.abort RPC is sent. No context construction, no mocked session lookup, no handler-direct invocation — the full gateway wire path is exercised.

Queued precondition: Before releasing the held first turn, the test asserts that the mock provider has received exactly one request — proving the second turn is still waiting in the followup queue and has not started executing concurrently.

$ node scripts/run-vitest.mjs --config test/vitest/vitest.e2e.config.ts test/chat-abort-frozen-queued.e2e.test.ts

[gateway-e2e] real ephemeral Gateway + held provider (redacted trace)
first turn active (provider request count=1)
second turn accepted (queued as followup, runId=frozen-queued-followup)
queued precondition verified: provider still has only 1 request (second turn is queued, not concurrent)
followup run terminalized (chat state=final, runId=frozen-queued-followup)
late chat.abort for frozen queued run: aborted=false runIds=[]
delivery confirmed via final event (message contains QUEUED_TURN_COMPLETE)
[gateway-e2e] RESULT: frozen queued followup un-aborted, final delivery completed

 ✓ test/chat-abort-frozen-queued.e2e.test.ts (1 test) 59486ms

Proof scope: The E2E proves the terminal state in a real Gateway. The real execution owner test (above) fills the gap by proving the precise internal ordering that distinguishes retirement from deletion during the pending-delivery interval. The harness test (below) proves the retirement-vs-deletion distinction synchronously.

Gateway Real-Behavior Harness — Late chat.abort vs Frozen Queued Run

End-to-end harness (src/gateway/server-methods/chat.abort-frozen-queued-run.test.ts) drives the real production chain with real module implementations — no mocks in the critical path. This harness distinguishes freeze-time retirement from post-delivery deletion by directly inspecting the queued entry map.

$ node scripts/run-vitest.mjs src/gateway/server-methods/chat.abort-frozen-queued-run.test.ts

stdout | chat.abort-frozen-queued-run.test.ts > harness: late chat.abort leaves the frozen queued run un-aborted and delivery completes
[harness] chat.send queued followup registered: entry=queued-1 abortable=undefined
[harness] execution freeze -> retireFollowupRunCancellation -> onCancellationRetired -> retireQueuedChatTurnCancellation
[harness] after freeze: entry.abortable=false entry.present=true (retired, not deleted)
[harness] late chat.abort -> handleChatAbortRequestWithLifecycle -> abortQueuedChatTurnById
[harness] chat.abort responded: aborted=false runIds=[] (entry.abortable=false, not missing)
[harness] after abort: entry.present=true (abort rejected by retirement, not deletion)
[harness] final delivery -> completeQueuedChatTurn -> entry deleted: present=false
[harness] RESULT: frozen queued run un-aborted (retirement), final delivery completed

 ✓ |gateway-methods| ../../src/gateway/server-methods/chat.abort-frozen-queued-run.test.ts (4 tests) 157ms

Four-Tier Proof Architecture

Tier Test What it proves Gap it fills
Real-transport queued successor (REV 53) chat.abort-frozen-queued-transport.test.ts (1 test) Real Gateway + real RPC + two-turn queued admission (hold first, enqueue successor) + successor-specific commitTurn gate + valid commit acknowledgement + queued precondition snapshot; abort rejected for the queued successor during pending delivery; transcript persistence verified ClawSweeper Rev 50/53: "Hold a first turn, enqueue a successor, and target that successor during its pending-delivery interval"
Synchronized pending-delivery (REV 43) chat.abort-frozen-queued-execution-owner.test.ts (2 tests) Real executeAgentTurn → retirement synchronized via onCancellationRetired deferred; abort rejected while entry.present=true, deliverySettled=false; before-fix control proves regression ClawSweeper Rev 43: "Synchronize on execution-driven retirement while holding settlement pending; verify regression fails without retirement"
Real ephemeral Gateway E2E chat-abort-frozen-queued.e2e.test.ts Full gateway wire path: real process + held provider + real RPC (terminal state) Real Gateway terminal state
Real-behavior harness chat.abort-frozen-queued-run.test.ts Retirement-vs-deletion distinction (synchronous entry map inspection) Internal ordering: abortable=false + present=true before delivery deletes

Freeze-Retire Proof — Production Function (retireFollowupRunCancellation)

Direct call into the production function with real lifecycle objects, proving freeze-time retire fires once per owner and is idempotent (WeakSet in queue/types.ts:244):

$ node --import tsx --input-type=module -e "..."
retirements: ["individual","overflow-source-1","overflow-source-2"]
idempotent (no duplicate): true

Regression Tests

New tests prove freeze-time retire across every owner boundary:

Test Input Result
agent-runner-execution-contract.test.ts "retires queued cancellation ownership when execution freezes" executeAgentTurn + turnAdoptionLifecycle.onCancellationRetired spy retire fires exactly once at non-retryable boundary
agent-runner-execution-contract.test.ts "does not retire queued cancellation ownership on a pre-start failure that is retryable" resolveCurrentTurnImages failure + onCancellationRetired spy retire NOT called (entry stays abortable for retry)
agent-runner-execution-contract.test.ts "retires queued cancellation ownership when a started execution throws" runEmbeddedAgent throws after model_call_started + onCancellationRetired spy retire fires (started-error is non-retryable)
queue/lifecycle.test.ts "retires all source cancellations when admitted overflow delivery freezes" 2 dropped sources + overflow summary synthetic owner both real sources retired via onCancellationRetired
queue/lifecycle.test.ts "retires a singleton cancel-only overflow source when the summary freezes" 1 cancel-only dropped source + overflow summary cancel-only source retired; synthetic lifecycle exists without onAdmitted
queue/lifecycle.test.ts "retires all source cancellations when an admitted collect group freezes" 2 group items + synthetic aggregate owner both group items retired
chat.abort-frozen-queued-run.test.ts "harness: terminal preflightFailurePayload path retires cancellation before delivery, late chat.abort is rejected" terminal preflightFailurePayload lifecycle + late abort abort rejected by retirement (abortable=false)
chat.abort-frozen-queued-run.test.ts "harness (before-fix control): without preflight retire, a late chat.abort falsely aborts the terminal preflight-failure run" terminal preflightFailurePayload without retire abort succeeds (aborted=true)
chat.abort-frozen-queued-run.test.ts "harness: active queued run without early retire remains abortable" active queued run, no terminal boundary abort succeeds (aborted=true)

After-Fix Runtime Artifact

node scripts/run-vitest.mjs src/auto-reply/reply/queue/lifecycle.test.ts src/auto-reply/reply/agent-runner-execution-contract.test.ts --maxWorkers=1

  ✓ |auto-reply| src/auto-reply/reply/queue/lifecycle.test.ts (7 tests) 28710ms
  ✓ |auto-reply| src/auto-reply/reply/agent-runner-execution-contract.test.ts (5 tests) 82790ms

 Test Files  2 passed (2)
      Tests  12 passed (12)

# Full suite (--maxWorkers=1, all 6 PR test files):
#   queue/lifecycle.test.ts                                     7 tests   28.7s
#   agent-runner-execution-contract.test.ts                     5 tests   82.8s
#   chat.abort-frozen-queued-run.test.ts                        6 tests   40.1s
#   chat.abort-frozen-queued-transport.test.ts                  1 test    93.0s
#   chat.abort-frozen-queued-execution-owner.test.ts            2 tests  159.4s
#   chat-abort-frozen-queued.e2e.test.ts                        1 test    59.5s
#   ---                                                         22 tests  463.5s total

Key Invariant Verified

Freeze-time retire coverage matrix per owner boundary:

Owner boundary                                   => Freeze behavior
individual followup (queued)                     => retire fires once at non-retryable boundary (executionStarted)
execution-started failure (queued)               => retire fires at non-retryable boundary (started-error)
started-error throw (non-retryable)              => retire fires in commitTerminalOutcome finally
pre-start failure (image resolution, retryable)  => NOT retired (entry stays abortable for retry)
terminal preflightFailurePayload delivery        => retire fires before delivery (abortable=false)
retryable preflightError                         => NOT retired (entry stays abortable for retry)
active queued run (not yet frozen)               => NOT retired (entry stays abortable)
overflow summary synthetic owner                 => forwards retire to all real sources
singleton cancel-only overflow summary            => synthetic lifecycle always created; retires source
collect group synthetic owner                    => forwards retire to all group items
active/queued overlap (frozen entry)             => entry kept as idempotency guard, abortable=false
single-source collect                            => unchanged (native signal, no composite)

When execution freezes, abortQueuedChatTurnById's gate (entry.abortable === false, chat-queued-turns.ts:156) is now reachable for finalizing runs, matching the maintainer-clarified canonical fix. Single-source collect groups are untouched because createAggregateCancellation returns the native signal for a single owner — no composite, no identity mismatch.

CI Notes

The shard:core-tooling-7-hosted-3 tsgo-core-test-shards failure ("messaging: 701 test roots exceeds the 700 limit") was caused by this PR adding two new test files in src/auto-reply/reply/. Fixed by adding the 3 executeAgentTurn cancellation-retire tests to existing agent-runner-execution-contract.test.ts and the 3 queue collect freeze-retire tests to existing queue/lifecycle.test.ts — no new files in src/auto-reply/reply/, so the messaging shard root count stays at 699 (same as before this PR). Tests were placed in queue/lifecycle.test.ts (43→183 lines, well under the 700-line cap) rather than queue.collect.test.ts (grandfathered at 3894 lines; the line-cap ratchet rejects growth).

The shard:auto-reply-reply-state-routing worker crash (exit 137 OOM) is pre-existing and reproducible on main — it is a CI-environment resource issue with 66+ test files in a single isolate: false worker. This PR does not add any new files to that shard.

The scripts/mantis/run-request-telegram.mts TS error and mantis-telegram-proof.test.ts Python errors are pre-existing — this PR does not touch any mantis or telegram files.

Diff Shape

  • Production: +102/-45 across 4 files (agent-runner-execution.ts +9/-4, followup-turn-execution.ts +7/-0, queue/drain.ts +20/-32, new queue/drain-lifecycle.ts +86/-0). The lifecycle builders for overflow summary and collect group aggregate owners are extracted to drain-lifecycle.ts, each with onCancellationRetired that retires real sources on freeze.
  • Tests: +1762/-0 across 6 files (agent-runner-execution-contract.test.ts +67/-0, queue/lifecycle.test.ts +137/-0, chat.abort-frozen-queued-execution-owner.test.ts +281/-0, chat.abort-frozen-queued-run.test.ts +299/-0, chat.abort-frozen-queued-transport.test.ts +508/-0, chat-abort-frozen-queued.e2e.test.ts +455/-0).
  • No config, protocol, schema-version, or public API change.

Rebase & Conflict Resolution Notes

Rebased onto current main (e380a25). No conflicts — all 10 files applied cleanly. The turnAdoptionLifecycle in runSyntheticOverflowSummary is now always created (not conditional on onAdmitted), so singleton cancel-only overflow sources — where runQueueSummaryDelivery sets onAdmitted=undefined because needsAdmission=false — also receive freeze-time retirement via onCancellationRetired. The onSettled logic in buildOverflowSummaryTurnAdoptionLifecycle (drain-lifecycle.ts) completes sources unconditionally when onAdmitted is absent, covering the singleton cancel-only path.

CI Repair & Review Resolution Notes (squashed into single commit)

CI Failures Repaired

  1. Line-cap ratchet violations (3 files): Extracted turnAdoptionLifecycle builders to new queue/drain-lifecycle.ts; extracted cancellation-retire tests to new agent-runner-execution-cancellation-retire.test.ts and queue.collect-freeze-retire.test.ts. All three original files now at or below their upstream baselines.

  2. test/chat-abort-frozen-queued.e2e.test.ts TS error: createDeferred not exported from src/shared/deferred.js (only createDeferredCore exists). Fixed by aliasing import.

  3. src/auto-reply/reply/agent-runner-execution.ts max-lines (709>700): Addressed by extracting recordMessageToolOnlyRunOutcome to new file + implementing maintainer's Rank-up move (shared hasReplyOperationExecutionStarted state).

ClawSweeper Review Findings Resolved

All actionable findings from the ClawSweeper review are resolved in the current head:

  1. [P1] Preserve the execution-identity callback argument — The onAgentRunStart wrapper that forwarded only id (dropping executionIdentityToken) has been completely removed as part of the Rank-up move. The canonical producer now calls params.opts?.onAgentRunStart?.(runId, admittedRunContext.current?.executionIdentityToken) directly, preserving both arguments.

  2. [P2] Use the shared execution-start fact — The local executionStarted closure boolean has been removed entirely. commitTerminalOutcome now queries the shared hasReplyOperationExecutionStarted(executionParams.replyOperation) state.

  3. [P2] Wait for an active-run state instead of sleeping — The fixed await sleep(1_000) in the E2E test has been replaced with await waitForChatRunActive(events, firstRunId), which synchronizes on the Gateway's real broadcast event.

  4. [P2] Attach overflow retirement independently of admission — turnAdoptionLifecycle in runSyntheticOverflowSummary is now always created via buildOverflowSummaryTurnAdoptionLifecycle, not conditional on params.onAdmitted. This covers singleton cancel-only overflow sources where runQueueSummaryDelivery sets onAdmitted=undefined because needsAdmission=false (1 source, no exclusive admission). The lifecycle builder handles onAdmitted=undefined correctly: onAdopted is a no-op, onCancellationRetired retires all sources, and onSettled completes sources unconditionally.

ClawSweeper Proof Gap Resolved (Revision 38)

The reviewer identified: "The matching captured body supplies real Gateway terminal output, but abort occurs after final delivery. The separate harness manually retires the entry, so neither proves that the changed execution owner rejects abort while the queued entry remains present and delivery is pending."

Resolved by adding src/gateway/server-methods/chat.abort-frozen-queued-execution-owner.test.ts calls the real executeAgentTurn (which triggers real commitTerminalOutcome → retireFollowupRunCancellation), wires onCancellationRetired to real retireQueuedChatTurnCancellation, and issues chat.abort before onSettled (delivery) is called — proving the changed execution owner rejects abort while the queued entry remains present (abortable=false, present=true) and delivery is pending (deliverySettled=false).

ClawSweeper Proof Gap Resolved (Revision 43 — synchronized pending-delivery proof)

The reviewer identified: "Synchronize on execution-driven retirement while holding settlement pending, then release delivery after the abort response; verify the regression fails without retirement."

The previous delta-based E2E approach was removed — ClawSweeper correctly identified that state: "delta" is emitted from live assistant streaming events (server-chat.ts:1843-1865) before commitTerminalOutcome runs, so it cannot establish the freeze-to-settlement interval.

Resolved by rewriting chat.abort-frozen-queued-execution-owner.test.ts with two tests that follow ClawSweeper's exact pattern:

Test 1: "real execution owner rejects late chat.abort during pending delivery (synchronized on retirement)"

  1. Registers a real queued entry (registerQueuedChatTurn)
  2. Wires onCancellationRetired to a deferred — this callback fires synchronously inside commitTerminalOutcome → retireFollowupRunCancellation, providing a deterministic execution-driven retirement barrier
  3. Calls the real executeAgentTurn (via getExecuteAgentTurnForTest()) with model_call_started phase → triggers real commitTerminalOutcome → real retireFollowupRunCancellation → onCancellationRetired fires
  4. Awaits the retirement deferred — synchronizes on execution-driven retirement (not a delta event)
  5. Verifies: entry.abortable=false, entry.present=true, deliverySettled=false (delivery pending)
  6. Issues chat.abort via real handleChatAbortRequestWithLifecycle (real Gateway handler)
  7. Verifies: aborted=false, runIds=[], entry.present=true (rejected by retirement, not deletion)
  8. Releases delivery (onSettled → completeQueuedChatTurn) — entry deleted

Test 2: "before-fix control: with retirement hook removed, chat.abort succeeds during pending delivery"

  1. Registers a real queued entry
  2. Wires onCancellationRetired as a no-op (retirement hook removed — simulates current main where commitTerminalOutcome calls freezeAbort but never retires the queued cancellation)
  3. Calls the real executeAgentTurn (same execution path as Test 1, minus the retirement hook — an apples-to-apples control)
  4. Verifies: entry.abortable=undefined (still abortable), entry.present=true, deliverySettled=false
  5. Issues chat.abort via real handleChatAbortRequestWithLifecycle
  6. Verifies: aborted=true, runIds=["queued-control"], controller.signal.aborted=true — the current-main bug

This control does not skip execution — it runs the same executeAgentTurn → commitTerminalOutcome → freezeAbort path, with only the retirement hook removed. This is an apples-to-apples comparison: the only difference between Test 1 and Test 2 is whether onCancellationRetired retires the queued entry.

This satisfies all four ClawSweeper requirements:

  • Synchronize on execution-driven retirement — onCancellationRetired deferred
  • Hold settlement pending — onSettled not called until after abort response
  • Release delivery after abort response — onSettled called after aborted=false verified
  • Verify regression fails without retirement — control runs same execution path with retirement hook removed (not skipping execution)
$ node scripts/run-vitest.mjs src/gateway/server-methods/chat.abort-frozen-queued-execution-owner.test.ts

[exec-owner] registered queued entry: entry=queued-exec-owner abortable=undefined
[exec-owner] executeAgentTurn (real) -> commitTerminalOutcome (real) -> retireFollowupRunCancellation (real)
[exec-owner] onCancellationRetired fired (synchronized on execution-driven retirement)
[exec-owner] after retirement: entry.abortable=false entry.present=true deliverySettled=false
[exec-owner] late chat.abort while delivery pending -> handleChatAbortRequestWithLifecycle
[exec-owner] chat.abort responded: aborted=false runIds=[]
[exec-owner] entry.present=true after abort (rejected by retirement, not deletion)
[exec-owner] onSettled (delivery) -> completeQueuedChatTurn -> entry deleted
[exec-owner] RESULT: real execution owner rejected abort during pending delivery (synchronized on retirement)

[control] registered queued entry: entry=queued-control abortable=undefined
[control] executeAgentTurn (real) -> commitTerminalOutcome (real) -> freezeAbort (real)
[control] onCancellationRetired is no-op (retirement hook removed, simulates current main)
[control] after executeAgentTurn: entry.abortable=undefined entry.present=true deliverySettled=false
[control] late chat.abort while delivery pending -> handleChatAbortRequestWithLifecycle
[control] chat.abort responded: aborted=true runIds=["queued-control"]
[control] controller.signal.aborted=true (frozen delivery would be marked aborted)
[control] RESULT: with retirement hook removed, abort succeeds during pending delivery (current-main bug)

 ✓ |gateway-methods| src/gateway/server-methods/chat.abort-frozen-queued-execution-owner.test.ts (2 tests) 1191ms

ClawSweeper Proof Gap Resolved (Revisions 50 + 53 — queued successor over real transport)

Rev 50 finding: "this is the only chat.send in a fresh session. resolveActiveRunQueueAction returns run-now when the session is inactive and its queue is empty, even with messages.queue.mode: "followup". Consequently no deferred Gateway cancellation entry is registered, and the asserted rejection exercises direct-turn freeze protection instead of the new queued retirement hook."

Root cause confirmed: queue-policy.ts:43 — if (!params.isActive && (!params.queueAdmissionState || params.queueAdmissionState === "empty")) returns "run-now" for a fresh session regardless of followup mode. The previous transport test sent one chat.send to a fresh session, so the message ran immediately without registering a Gateway queued cancellation entry. The abort rejection exercised freezeAbort(), not retireFollowupRunCancellation.

Rev 53 findings (three fixture defects in the Rev 50 transport test):

  1. Predecessor blocked by gate: The commitTurn hook posted to the blocking gate for every turn, including the predecessor. Production awaits that hook before finishing the predecessor, but the test released the gate only after observing the successor. The successor could not reach the asserted interval (deadlock). Fixed: Gate is now successor-specific — the 1st commitTurn call (predecessor) acknowledges immediately with 204; only the 2nd call (successor) blocks on releaseAfterTurn.

  2. Queued precondition contradiction: queuedPrecondition was calculated from the final modelRequests.length, while the final assertion required both modelRequestCount: 2 AND queuedPrecondition: true. These cannot both hold. Fixed: queuedPreconditionSnapshot is captured as modelRequests.length === 1 before releasing the predecessor (line 365). The final verdict uses this snapshot.

  3. Invalid commitTurn return: After the gate returned, commitTurn resolved to undefined. The production outbox requires { status: "committed" } or { status: "duplicate" } (context-engine-turn-outbox.ts:471-477); otherwise it retains the pending turn. Fixed: commitTurn now returns { status: "committed" }.

Resolved by restructuring chat.abort-frozen-queued-transport.test.ts with:

  1. Hold first turn active (provider holds the request)
  2. Synchronize on Gateway's real "starting_model" status event
  3. Send second chat.send → resolveActiveRunQueueAction returns "enqueue-followup" (session is active) → registers Gateway queued cancellation entry
  4. Snapshot queuedPrecondition = modelRequests.length === 1 before releasing predecessor
  5. Release first turn → predecessor's commitTurn acknowledges immediately (gate is successor-specific) → predecessor finishes → queue drains → followup executes
  6. commitTerminalOutcome → retireFollowupRunCancellation → entry.abortable = false
  7. Successor's commitTurn (2nd call) blocks → pending-delivery window
  8. chat.abort for the followup → rejected (aborted: false)
  9. Release commitTurn → delivery completes

This properly exercises the queued retirement path (retireFollowupRunCancellation → retireQueuedChatTurnCancellation → entry.abortable = false) over real transport, with a genuinely queued successor (not a direct turn), a successor-specific gate, a valid commit acknowledgement, and a correctly snapshotted queued precondition.

AI Assistance

  • AI-assisted: Yes
  • Original model: deepseek-v4-flash

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

Retire queued turns’ cancellation ownership when execution freezes, including terminal preflight failures and aggregate turns.

Example: A queued successor is finalizing its reply when chat.abort targets its runId.

  • Before: The Gateway reports aborted=true although execution has already finished.
  • After: The Gateway returns aborted=false and allows final delivery to settle.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The bounded repair is correct and supported by real Gateway transport evidence; duplicated tests and intentionally partial coverage of the linked issue limit overall readiness.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied terminal trace exercises real Gateway RPC and queued execution with a held loopback provider, blocks successor settlement, records aborted=false, then confirms successful completion and preserved transcript content; source inspection matches that scenario.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: A late Stop can report an already-finalizing queued reply as aborted.
Reason: The bounded repair follows recorded maintainer direction and correctly uses Related rather than closing the broader issue.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR: current main still lacks freeze-time queued cancellation retirement, and the patch follows the maintainer-approved repair boundary. No introduced correctness defect was found; GitHub reports a merge conflict.

Priority: P2
Reviewed head: c0b565dab7688fc49033303195d3ddb7bf8eb391

Before merge

  • Complete next step - Resolve the reported merge conflict by applying aggregate retirement to main’s createAggregateDelivery owner, preserve latest-source cancellation until freeze, and validate the integrated head.

Findings

None.

Tests

  • Low-value test src/gateway/server-methods/chat.abort-frozen-queued-run.test.ts: Remove the manual-retirement replays: the purported preflight and retry cases never execute executeFollowupTurn, and the basic retirement scenario duplicates the execution-owner and transport coverage.
  • Low-value test test/chat-abort-frozen-queued.e2e.test.ts: The abort occurs after final delivery, when deletion alone can reject it; consolidate this terminal-state replay into the stronger pending-settlement transport scenario.
  • Missing end-to-end proof: The terminal-preflight cases do not demonstrate a base-failing regression through executeFollowupTurn.
Agent review details

How this fits together

The reply executor passes terminal lifecycle facts through queued-turn callbacks to the Gateway registry, which decides whether chat.abort can still cancel each run.

flowchart LR
  A[Queued chat turn] --> B[Followup execution]
  B --> C[Terminal freeze]
  C --> D[Cancellation retirement lifecycle]
  D --> E[Gateway queued registry]
  F[Chat abort request] --> E
  E --> G[Reject late abort]
  B --> H[Delivery and settlement]
Loading

Technical review

Best possible solution:

Preserve the freeze-time retirement repair while integrating aggregate callbacks into main’s existing createAggregateDelivery owner.

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

Current-main source establishes the missing retirement handoff, and the contributor supplies Gateway traces and an execution-owner control; no target code was run during this read-only review.

Is this the best way to solve the issue?

The repair uses the existing lifecycle at the authoritative freeze boundary and preserves retryable pre-start cancellation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 31549178da4d.

Provenance checked

  • Terminal execution freeze keeps the original intent (414ecd2: Protect accepted terminal output and finalizing delivery from later cancellation.)
  • Canonical queued execution keeps the original intent (f8cc39c: Converge queued turns onto the canonical execution pipeline while keeping admission, delivery, and cleanup responsibilities explicit.)
  • Aggregate queued-turn lifecycle keeps the original intent (1b8d837: Preserve queued prompt cancellation, admission, restart, and terminal ownership across Gateway and queue lifecycles.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +74, Tests +1745. Total +1819 across 10 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 4 118 44 +74
Tests 6 1746 1 +1745
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 1864 45 +1819

Review metrics

Metric Value Why it matters
Production versus test changes Production +118/-44; tests +1746/-1 Cancellation ordering merits regression coverage, but manual-retirement replays duplicate stronger owner and transport coverage.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded user-visible inconsistency where a finalizing queued reply can be reported as aborted.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Remove manual-retirement replays and retain distinct preflight and retry coverage at the existing execution owner.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (68 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-01T01:08:05.218Z sha d82f82178a5525f7e3240274f1b37ed3ea42da3d :: blocked before merge. :: [P2] Attach retirement to one-source overflow summaries | [P2] Forward retirement for one-source collect drains
  • reviewed 2026-10-01T21:53:13.774Z sha d82f82178a5525f7e3240274f1b37ed3ea42da3d :: blocked before merge. :: [P2] [P2] Preserve retirement for one-source overflow summaries
  • reviewed 2026-10-08T07:30:39.691Z sha 68e21b0ca17e79a95eb1ad24ac71dacda04705a9 :: blocked before merge. :: [P2] [P2] Preserve retirement for one-source overflow summaries
  • reviewed 2026-10-08T07:50:36.637Z sha 3508b6c10de5a5b57afa1739896fec271dce45b1 :: blocked before merge. :: [P2] Preserve retirement for one-source overflow summaries
  • reviewed 2026-10-08T08:21:15.603Z sha be80a4c79eb2122f1fa45a30588495e1b2c85a90 :: blocked before merge. :: [P2] Attach overflow retirement independently of admission
  • reviewed 2026-10-08T12:16:43.051Z sha c0b565d :: needs changes before merge. :: none
  • reviewed 2026-10-08T12:39:02.764Z sha c0b565d :: needs changes before merge. :: none
  • reviewed 2026-10-08T13:19:10.492Z sha c0b565d :: needs changes before merge. :: none

Reviewed October 15, 2026, 11:50 PM ET / October 16, 2026, 03:50 UTC (Revision 69).

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M and removed size: S labels Aug 3, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 3, 2026
@wangyan2026
wangyan2026 force-pushed the fix/reply-retire-queued-cancellation-on-freeze-118028 branch 2 times, most recently from 9d6b84c to 0e64bc0 Compare August 3, 2026 02:30
@wangyan2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 3, 2026
@wangyan2026
wangyan2026 force-pushed the fix/reply-retire-queued-cancellation-on-freeze-118028 branch from 0e64bc0 to 01a8e61 Compare August 3, 2026 04:31
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 3, 2026
@wangyan2026
wangyan2026 force-pushed the fix/reply-retire-queued-cancellation-on-freeze-118028 branch from 2dda42c to abcc441 Compare August 3, 2026 07:09
@wangyan2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 3, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Aug 3, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 5, 2026
@wangyan2026
wangyan2026 force-pushed the fix/reply-retire-queued-cancellation-on-freeze-118028 branch 2 times, most recently from 90cdaad to 27af1f7 Compare August 6, 2026 03:25
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 6, 2026
@wangyan2026
wangyan2026 force-pushed the fix/reply-retire-queued-cancellation-on-freeze-118028 branch from 27af1f7 to ad88e2a Compare August 6, 2026 03:39
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 6, 2026
@wangyan2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

5 similar comments
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@wangyan2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

…freezes (openclaw#118028)

When an auto-reply follow-up run reaches its terminal freeze boundary
(commitTerminalOutcome), its Gateway cancel entry must retire so that
a late chat.abort is rejected rather than falsely marking the
finalizing run as aborted while delivery completes.

- Retire followup cancellation in commitTerminalOutcome after freezeAbort
  using the shared hasReplyOperationExecutionStarted state (maintainer
  Rank-up move: no local executionStarted tracking)
- Retire queued cancellation in the terminal preflightFailurePayload
  branch in followup-turn-execution.ts (preflightError is retryable
  and stays abortable)
- Extract buildOverflowSummaryTurnAdoptionLifecycle and
  buildCollectGroupTurnAdoptionLifecycle to drain-lifecycle.ts, both
  with onCancellationRetired that retires real sources on freeze
- Always attach overflow summary turnAdoptionLifecycle regardless of
  onAdmitted, so singleton cancel-only overflow sources (where
  needsAdmission=false sets onAdmitted=undefined) also receive
  freeze-time retirement
- Add lifecycle unit test for cancellation retirement on freeze,
  including a singleton cancel-only overflow source (1 dropped source,
  not 2) to exercise the onAdmitted=undefined path
- Add Gateway harness proof that late chat.abort returns aborted=false
- Add E2E proof with real ephemeral Gateway and held mock provider
- Replace fixed sleep in E2E with state-based active-run barrier
  (waitForChatRunActive: state=status, phase=starting_model)

Closes openclaw#118028
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@wangyan2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL stale Marked as stale due to inactivity status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants