Repository navigation
Conversation
|
🦞👀 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: blocked before merge. Reviewed October 7, 2026, 11:41 PM ET / October 8, 2026, 03:41 UTC (Revision 8). ClawSweeper reviewWhat this changesThe branch binds each queued reply’s immutable tool-permission snapshot during admission and adds Gateway, real Claude CLI, and admission regression coverage. Example: Send a second chat message while a Claude CLI reply is running
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain The original missing-snapshot failure is repaired on current main, but this PR retains useful real-CLI regression coverage and proposes a different snapshot-capture boundary. The historical proof remains valid; the conflicting branch needs reconciliation with main’s existing binding before merge. Priority: P2 Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherOpenClaw queues messages that arrive while their conversation is busy, then admits each follow-up into the shared agent execution pipeline. A turn-owned permission snapshot controls model-route binding and whether later input may steer that turn. flowchart TD
A[Message arrives during a reply] --> B[Conversation follow-up queue]
B --> C[Admit a fresh reply turn]
C --> D[Capture immutable tool permissions]
D --> E[Prepare conversation and compaction]
E --> F[Bind model route and execute]
F --> G[Deliver queued reply]
Technical reviewBest possible solution: Preserve main’s single execution-owned snapshot binding and adapt the useful real-CLI regression coverage; pursue earlier capture only for a demonstrated remaining preflight defect. Do we have a high-confidence way to reproduce the issue? No current-main reproduction of the original missing-bind defect was established: main now binds before execution. The supplied real Gateway/CLI trace establishes the failure and recovery on the pinned older base. Is this the best way to solve the issue? No for current main as written: another snapshot binding already exists. Keeping its owner and porting the useful runtime coverage is the narrower path unless earlier capture solves a demonstrated remaining defect. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f0fff3ce7b88. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: shipped entry point. Added test files: 4. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +15, Tests +499. Total +514 across 7 files. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 HistoryReview history (7 earlier review cycles)
|
|
@clawsweeper re-review — Added the requested runtime proof: a live Gateway e2e test ( |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d45a638 to
c06860b
Compare
#140018) * fix(ci): keep preflight job outputs under GitHub's 1 MiB cap Pull requests that need the full canonical Node test plan failed preflight with "Job outputs exceed 1,048,576 bytes", which made ci-gate report every lane as selected=missing. The compact plan lists 7,749 striped test files explicitly, and GitHub measures job outputs in UTF-16, so the effective cap for all preflight outputs is 524,288 characters. The manifest reached ~522K characters on the github profile as the tracked test inventory grew. Emit each Node matrix row's groups as gzip+base64 JSON at the manifest boundary and unpack them in the shard runner. On current main this takes the github-profile manifest from 522,522 to 195,410 characters and the blacksmith profile from 450,639 to 158,571, with identical jobs and group membership. The manifest imports the codec through the existing target-plan seam, the trusted runner checkout lists it, and plain OPENCLAW_NODE_TEST_GROUPS_JSON remains for the Vitest cache warmer. Related to #139929 and #136820. * fix(ci): load the Node test groups codec only for grouped rows The manifest imported scripts/lib/ci-node-test-groups-codec.mts unconditionally through importTargetPlan. An ordinary manual workflow_dispatch whose target_ref predates the codec is not a compatibility target, so the import threw before planning even though such targets emit an ungrouped plan and never call the encoder. Import the codec only when the emitted Node rows carry groups, and keep the clear failure when a grouped plan comes from a target without it. The workflow-guard fixture can now omit the codec so a codec-free manual target runs the real manifest step. * fix(ci): preserve grouped historical test plans Negotiate the packed group codec against the selected target and fall back to the same five-field legacy projection when the codec is unavailable. Five-field projection adapted from #140036. Co-authored-by: Peter Steinberger <[email protected]> --------- Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
a39e4b2 to
d6d1cdd
Compare
|
#140018 is on |
…authority snapshot" A chat message that arrives while a reply run is active is queued and, once the active run ends, starts as its own run. Since 2026.9.2 that queued run failed before any provider request with "Reply operation has no active tool authority snapshot" and the message was lost. Foreground admission binds the reply operation's tool authority snapshot (agent-runner-run.ts), but queued follow-up admission obtains its own operation and never did. CLI backends bind the concrete route through that snapshot and threw; embedded runs fell back to direct authority and could not be steered while the queued turn ran. Bind the admitted queued turn's snapshot at the same point foreground admission does, after the admitted session facts are final and before any backend can consume the operation. Closes openclaw#139847
…tive run Boots a child Gateway with the mock provider, sends a message that starts a held reply run, then sends a second message while that run is active. Proves the queued follow-up runs as its own turn and its reply is delivered, with no "no active tool authority snapshot" error. Adds a dedicated stall prompt to the QA mock so the first turn stays active while the follow-up is admitted. Refs openclaw#139847
…kend Add a live-gated Gateway test that runs the reported sequence on the bundled claude-cli backend: a second chat.send arrives while the first CLI turn is running, is admitted as a queued follow-up, and after the first turn completes runs as its own CLI execution with its reply delivered. Against a dist built from main the queued turn dies at route binding with "Reply operation has no active tool authority snapshot". Switch the mock-provider e2e test to chat.send as well: the qa-channel poller hands inbound messages to the Gateway one at a time and waits for each reply, so its second message never reached the reply pipeline mid-run and the queued path was not exercised.
openclaw#140018) * fix(ci): keep preflight job outputs under GitHub's 1 MiB cap Pull requests that need the full canonical Node test plan failed preflight with "Job outputs exceed 1,048,576 bytes", which made ci-gate report every lane as selected=missing. The compact plan lists 7,749 striped test files explicitly, and GitHub measures job outputs in UTF-16, so the effective cap for all preflight outputs is 524,288 characters. The manifest reached ~522K characters on the github profile as the tracked test inventory grew. Emit each Node matrix row's groups as gzip+base64 JSON at the manifest boundary and unpack them in the shard runner. On current main this takes the github-profile manifest from 522,522 to 195,410 characters and the blacksmith profile from 450,639 to 158,571, with identical jobs and group membership. The manifest imports the codec through the existing target-plan seam, the trusted runner checkout lists it, and plain OPENCLAW_NODE_TEST_GROUPS_JSON remains for the Vitest cache warmer. Related to openclaw#139929 and openclaw#136820. * fix(ci): load the Node test groups codec only for grouped rows The manifest imported scripts/lib/ci-node-test-groups-codec.mts unconditionally through importTargetPlan. An ordinary manual workflow_dispatch whose target_ref predates the codec is not a compatibility target, so the import threw before planning even though such targets emit an ungrouped plan and never call the encoder. Import the codec only when the emitted Node rows carry groups, and keep the clear failure when a grouped plan comes from a target without it. The workflow-guard fixture can now omit the codec so a codec-free manual target runs the real manifest step. * fix(ci): preserve grouped historical test plans Negotiate the packed group codec against the selected target and fall back to the same five-field legacy projection when the codec is unavailable. Five-field projection adapted from openclaw#140036. Co-authored-by: Peter Steinberger <[email protected]> --------- Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Field validation on 2026.9.4: this one-line change fixes the lost-message case in productionEnvironment. OpenClaw 2026.9.4 (3a9d69d), npm global install, Ubuntu / Linux 6.8.0-139-generic x64, Node 26.9.0, single gateway, single agent. Runtime Before the patch (natural trigger, 2026-09-19). Run A was a 5.5-minute Same shape on this host on Sep 12, 13 and 18. Which clause. In the published 2026.9.4 What we applied. The PR's single line, verbatim, into the 2026.9.4 dist chunk: Offline RED/GREEN against the real dist modules (
Live after gateway restart (2026-09-19T23:35Z).
Not done here. We did not run the PR's vitest suites (no monorepo checkout with +1 for merging. Prepared with AI assistance (the OpenClaw agent on this host did the analysis and testing); reviewed and posted by the operator. |
Runtime data point: on a main-based build this change loses the queued follow-up (double bind with #143661)We carried this PR's head ( Environment
Test
Result
Gateway log, with this PR (run 1): Control, same shape (run 1): Why
On Why the field validations above still saw a fixThey are on the 2026.9.4 release, which does not contain #143661 ( SuggestionBind at admission only when the operation has no snapshot yet, or take the approach #142306's current head uses (move the bind to admission and remove the execution-time call) so there is exactly one production bind on the follow-up path. I can re-run the same red/green on a revised head. |
Independent field validation on 2026.9.4 (production, Telegram lane) — repro confirmed + timeline dataAdding independent production data from a second deployment, since the thread currently has conflicting field results (aspalagin's 9.4 validation vs kiranvk-2011's main-build loss via #143661). Environment: OpenClaw 2026.9.4 (3a9d69d), npm global, Ubuntu (kernel 7.0.0-34), Node 24.21.0, single gateway, single agent, Telegram direct chat with topics. No companion app / no browser Control UI session involved. Repro (deterministic on our install): send a Telegram message while an active turn is >1 min into tool work. When the first turn completes, the queued turn dies in 10–56 ms, before any model call: Two user instructions were eaten this way 16 minutes apart today (each as a 12-line journal burst). Recovery practice we now use: the inbound survives in session history and is re-run on a fresh turn. Timeline data point (latent race, not a version-change trigger): 2026.9.4 installed 2026-09-11; zero occurrences Sep 11–26; first occurrence Sep 27 21:02; then 48 lines Sep 28, 30 lines Sep 29. Gateway process and install unchanged throughout — the race sat dormant until our traffic pattern shifted to long multi-minute tool turns with mid-turn follow-ups. Worth noting for triage: this can look like "it started yesterday" to users without any config or version change. Static check on 2026.9.6 (latest, 2026-09-23): the Stacked defect worth keeping in scope (cross-link #148789): in the same burst, this pre-model invariant failure is classified as a model-candidate failure and burns the entire fallback chain (4 candidates, $0 tokens, identical deterministic failure each time). Whatever lands for the bind race, invariant/operational errors of this class should be non-retryable so the fallback chain isn't wasted re-running an operation that cannot succeed. Happy to provide raw journal excerpts if useful. |
|
Trigger refinement (follow-up to our field validation above): the race correlates with primary-model meter exhaustion. Journal from the same deployment shows every "no active tool authority snapshot" burst is immediately preceded by the primary model returning a billing/meter failure: Timeline correlation: our 2026.9.4 install ran error-free Sep 11–26 and the Grok meter (Build usage balance) exhausted around Sep 27 21:02 — the exact timestamp of our first-ever occurrence of this error. Every burst since has a preceding 402. Suggested handling that falls out of this: (1) billing/meter 402 on the primary already forces the fallback path — the queued-turn bind race appears to be reachable chiefly on that path, so it's a good repro wedge; (2) again cross-linking #148789 — when the authority throw fires mid-chain, it poisons the remaining candidates, and a user with an exhausted primary meter loses the message entirely instead of cleanly falling back. |
|
Design invariant this bug violates: model fallback must never be destructive to active or queued work. A meter/billing limit on the primary model is a routine, expected runtime event — any user on any metered plan will hit it. The correct degradation is boring: queued messages continue on the fallback model, unaffected. Current behavior on 2026.9.4 is the opposite: the 402 triggers the fallback path, the authority-bind race fires there, and the result is maximally destructive — the queued user message is lost, the remaining fallback candidates are burned retrying a deterministic operational failure (cross-link #148789), and the user is told to start a new session when the lane is healthy. Two concrete acceptance criteria that would close this class:
|
|
Thanks @ylcn91 for investigating this and providing the detailed CLI reproduction. Closing as already fixed by #143661 (bffda1f). On current main, Verified on main 1a2eb9f: 38 queued-execution/tool-authority tests passed, including rejection of changed operator/tool permissions. The real Gateway product regression also passed: a second |
Closes #139847
What Problem This Solves
Fixes an issue where users who sent a chat message while the agent was still working on their previous message would, on 2026.9.2, get
⚠️ Something went wrong while processing your request.as soon as the queued message started, and the message was lost rather than requeued. Gateway logs showed:The failure fired at model-route binding, before any provider request, so every fallback candidate that runs through a CLI backend died the same way. Reported on Telegram direct chats; the queued path is shared by every channel and by
chat.send.Why This Change Was Made
Root cause. #134003 (commit e3ce08c, shipped in v2026.9.2) introduced
bindToolAuthoritySnapshot/bindToolAuthorityRouteon the reply operation and bound the snapshot for foreground runs right after admission (src/auto-reply/reply/agent-runner-run.ts:543). Queued follow-up admission (admitFollowupTurninsrc/auto-reply/reply/followup-turn-admission.ts) obtains its own fresh operation fromadmitReplyTurnand was never given the same binding. Two consumers then see an operation with no snapshot:src/auto-reply/reply/agent-runner-cli-candidate.ts:141callsbindToolAuthorityRouteunconditionally, and the registry throws the reported error for every CLI-backed candidate. This is the user-visible drop.src/auto-reply/reply/agent-runner-embedded-candidate.ts:220passesreplyOperation.toolAuthorityFingerprint, which isundefined, so embedded candidates fall back to direct attempt authority and still run (which matches the reporter's log, where one hosted fallback made a real request).Fix. In
admitFollowupTurn, bindprepareReplyToolAuthority(queued)to the admitted operation immediately after the admittedrunfacts (session id, session file, model lock, fallback probe) are final and before the turn object is built. This is the same call and the same point in the lifecycle as foreground admission. The operation is fresh per admitted queued turn, so the once-only binding contract holds; session rotation after binding (preflight compaction, role-ordering reset) behaves exactly as it already does for foreground runs.Relation to #139925. That PR (opened while this one was being validated) binds the same snapshot one stage later, in
executeFollowupTurnright beforeexecuteAgentTurn. Binding at admission instead keeps the queued operation's authority known for its whole active lifetime, including preflight compaction, mirrors the foreground runner one-to-one, and is the repair boundary the ClawSweeper review identified.Non-goals. No change to the guard itself, no retry of failed turns, no change to the embedded direct-authority fallback, no config or store changes. Production delta: +5 lines in one file.
User Impact
Typing a follow-up while the agent is still working now behaves as documented in
docs/concepts/queue.md: the queued message runs after the active turn finishes, on CLI and embedded backends alike, instead of being dropped with a generic error.Evidence
Live Claude CLI backend proof, before and after (RED/GREEN)
New
extensions/qa-lab/src/gateway-queued-followup-send.claude-cli.live.test.ts(live-gated:OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_CLI_BACKEND=1, needs a logged-in Claude Code executable) boots a child Gateway with the bundledclaude-clibackend (claude-cli/claude-opus-5, subscription login, queuemode: "followup"). It sends message 1 overchat.send, waits until the Gateway log shows the CLI process launched (cli exec: provider=claude-cli), sends message 2 to the same session while that CLI turn is still running, and asserts both replies arrive as two separate CLI executions with no snapshot error.Why
chat.sendand not a qa-channel message: the qa-channel poller hands inbound messages to the Gateway one at a time and waits for each reply (extensions/qa-channel/src/gateway.ts,enqueueInbound), so a channel message can never reach the reply pipeline mid-run in this harness.chat.sendenters the same pipeline (dispatchInboundMessage-> reply runner ->enqueueFollowupRun->admitFollowupTurn) without that serialization. The Gateway log confirms the overlap directly (queueDepth=2 sessionState=processingwhile the firstcli execis in flight).Before (RED). Same test against a dist built from the unmodified
origin/maincopy offollowup-turn-admission.ts. Message 2 was admitted mid-run, and the moment the first turn completed, the queued turn died at route binding and the user got the generic error:Test result:
1 failed(Error: ⚠️ Something went wrong while processing your request…).After (GREEN). Same test on this branch. Message 2 was admitted mid-run, and after the first turn completed, the queued turn ran as its own CLI execution (second
cli exec,useResume=true) and its reply was delivered:Test result:
Test Files 1 passed (1) · Tests 1 passed (1)(~22s per run; final run on the rebuilt branch dist 54.6s including Gateway boot).grep "no active tool authority snapshot"on the Gateway log: 0 matches.Boundary regression (RED/GREEN, unit)
src/auto-reply/reply/followup-turn-admission.queued-handoff.test.tsreplays the issue's sequence through the unmocked admission path and reply-run registry: message 1 admitted as a visible run with its authority bound, message 2 admitted asqueued_followupwhile message 1 is active, message 1 completes, message 2 admitted with a fresh operation, andbindToolAuthorityRouteon that operation succeeds.followup-turn-admission.test.tsalso asserts the snapshot is bound once and fingerprints the admitted generation.Before (tests on unmodified
origin/main):After (this branch):
followup-turn-admission*.test.ts39 passed; owner and sibling suites (followup-turn-execution,followup-runner,reply-run-registry,reply-turn-admission) 240 passed.Mock-provider Gateway e2e (embedded runtime)
extensions/qa-lab/src/gateway-queued-followup-send.e2e.test.tsboots a child Gateway with the mock provider and queuemode: "followup", holds the first reply for ~15s, sends a second message mid-run, and asserts both replies are delivered in order. This revision switches its two sends from qa-channel inbound messages tochat.sendfor the reason above; the earlier revision's second message was only delivered to the Gateway after the first turn had finished, so it did not exercise the queued path. The embedded runtime tolerates a missing snapshot (direct attempt authority), so this test is a regression guard for the queued flow itself, not the RED/GREEN boundary; the CLI live test above is.Result:
Test Files 1 passed (1) · Tests 1 passed (1)(47.2s), run against a dist rebuilt from this branch.Checks
followup-turn-admission*.test.ts: 39 passed (rebased head). Owner/sibling suites: 240 passed (previous head; production file unchanged since).extensions/qa-lab/src/gateway-queued-followup-send.e2e.test.ts(chat.send revision): 1 passed (47.2s).extensions/qa-lab/src/gateway-queued-followup-send.claude-cli.live.test.ts: RED on main-built dist (fails with the reported error), GREEN on this branch (1 passed, 54.6s).tsgoextensions lane (tsconfig.extensions.json): clean.oxfmt --checkandoxlinton both touched test files: clean.git diff --check: clean.node scripts/check-changed.mjs: 40 of its lanes green at push time (tsgo core/ui/test shards, dead-export scan, ratchets); the type-aware lint lane was still running and will be reported in a follow-up comment if it flags anything.Rebase onto
main(427abe8)#140018 landed, so the two cherry-picked CI commits are dropped and the branch is the three fix/proof commits rebased as
d6d1cdd, with no conflicts and no content changes. Locally on the rebased head:followup-turn-admissionandfollowup-turn-admission.queued-handoffpass (39 tests); the qa-lab Gateway e2e and the live CLI proof run in CI.