Repository navigation
Conversation
On message_tool_only turns the final text is private and the visible answer is a message(action=send) call. Once a call of a sequential batch had started, a waiting steer skipped that unstarted send, so the earlier message never got its reply. The sequential launch checkpoint now asks an internal, OpenClaw-owned classifier whether the call about to launch delivers the turn's visible reply. If it does, steering stays queued and applies after that call's result. The message-tool terminal hook installs the classifier on message_tool_only turns for sends that address the current conversation. Parallel batches, running tools, and later calls keep their behavior. Fixes openclaw#176028
|
🦞👀 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 Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesPreserves current-conversation message-tool replies when a follow-up arrives during sequential tool execution. Example: Input B arrives while input A runs [lookup, message(send A), tail] in message_tool_only mode.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current reply-loss bug, has sufficient Gateway behavior evidence, and has no blocking findings. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe built-in agent loop schedules model-requested tools and queued steering; the message-tool terminal owner identifies current-conversation replies that must launch before steering is consumed. flowchart TD
A[Model tool calls] --> B[Sequential launch checkpoint]
C[Queued follow-up] --> B
D[Current-source reply classifier] --> B
B --> E[Message tool delivery]
E --> F[Tool results and reply history]
F --> G[Apply follow-up]
Technical reviewBest possible solution: Use the existing steering checkpoint and message-delivery owner to preserve current-source answers while retaining ordinary tail replanning. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the skipped-send path, and the author supplies a matching Gateway capture and failing neutralized-check control; no target code was executed during this review. Is this the best way to solve the issue? The patch fixes the owning scheduling decision with a private classifier, reuses routing helpers, and preserves cancellation, admission, and the existing skipped-prefix contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 066c207b69e8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +77, Tests +342, Docs +3. Total +422 across 16 files. Added test files: 0. View PR surface stats
Review metrics
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:
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 October 18, 2026, 5:58 AM ET / 09:58 UTC (Revision 3). |
Adds a Gateway e2e case for openclaw#176028: a message_tool_only webchat turn answers with [held sequential tool, message(send), ordinary tail] while a second message steers in. The send launches and its answer reaches chat history before the steered answer, and the ordinary tail is still skipped. With the agent-core check neutralized, the case fails on the send's "Skipped to process an incoming message." result.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@claude is this still needed |
|
@codex is this still needed |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #176028
What Problem This Solves
Fixes: on turns whose visible reply must go through the
messagetool (message_tool_only), a message that arrives while the agent is working can make steering skip themessage(action=send)that carries the finished answer, so the earlier message never gets its reply.User Impact
User impact: a reply the agent already wrote is delivered even when the user sends another message mid-turn. The newer message is still handled right after, in order, as the steering docs promise. Users who type follow-ups while the agent works no longer see answers silently disappear.
Why This Change Was Made
Since #163852, steering skips the unstarted tail of a sequential tool batch once one call has started. That is the right call for work the model may want to replan, but on
message_tool_onlyturns the final text is private and the answer is itself a tool call. Any sequential sibling (bundled MCP tools are sequential by default) made the answer skippable.The steering checkpoint in agent-core now asks an internal, OpenClaw-owned classifier whether the call about to launch delivers the turn's visible reply, and does not skip it when it does. The steer stays queued and is applied after that call's result. The classification lives with the existing message-tool terminal hook, which already owns "a current-source send is this turn's reply" after delivery; it now answers the same question before launch, reusing the same route helpers:
messagesend actions, only onmessage_tool_onlyturns;Running tools, parallel batches, and later calls in the batch keep their current behavior. If steering already skipped an earlier call in the same batch, the send is skipped with the rest of the batch: that answer was composed assuming the skipped call would run, so the model replans with both skips visible. Docs updated in
concepts/queue-steering,concepts/queue, andconcepts/agent.Accepted edge case: classification reads the call's arguments as the model sent them, before
before_tool_callhooks or preparers can rewrite them, and adryRunorfinal: falseprogress send to the current conversation also counts. In either case the only effect is that the call launches one step before the steer applies.Evidence
Gateway proof (real Gateway process from the built runtime, real plugin loading,
chat.sendover the Gateway protocol, session transcript read back withchat.history; only the model is scripted). New case intest/gateway-steer-fifo.e2e.test.ts: amessage_tool_onlywebchat turn answers input A with[steering_gate (sequential, held), message(send A), steering_tail]; input B steers in while the gate is held; the model then answers B withmessage(send B). The case asserts:steering_tailcall is still skipped, the steer follows the tool results, and the tail tool never executes;chat.historyshows answer A, then answer B.Captured from one run of that case with this change: the scripted provider's second request (what the Gateway sent back after the first batch), the fixture plugin's execution trace, and
chat.historyfor the session as the WebChat user sees it. The capture was a temporary local dump in the test, not committed. Redaction: user entries are trimmed to the message text (sender metadata and timestamps removed); nothing else was edited.{ "modelRequestCount": 2, "secondModelRequestInput": [ { "role": "user", "text": "INITIAL_HELD_TURN" }, { "call": "steering_gate", "call_id": "call_steering_gate", "arguments": "{}" }, { "call": "message", "call_id": "call_reply_a", "arguments": "{\"action\":\"send\",\"message\":\"ANSWER_FOR_HELD_TURN\"}" }, { "call": "steering_tail", "call_id": "call_steering_tail", "arguments": "{}" }, { "result_for": "call_steering_gate", "output": "steering gate completed" }, { "result_for": "call_reply_a", "output": "Sent visible reply to the current source conversation via internal-ui." }, { "result_for": "call_steering_tail", "output": "Skipped to process an incoming message." }, { "role": "user", "text": "STEER_BEHIND_MESSAGE_TOOL_REPLY" } ], "pluginToolTrace": [ "gate-execute-start", "gate-execute-end" ], "chatHistory": [ { "role": "user", "parts": [ "INITIAL_HELD_TURN" ] }, { "role": "assistant", "parts": [ "[toolCall steering_gate {}]", "[toolCall message {\"action\":\"send\",\"message\":\"ANSWER_FOR_HELD_TURN\"}]", "[toolCall steering_tail {}]" ] }, { "role": "toolResult", "parts": [ "steering gate completed" ] }, { "role": "assistant", "parts": [ "ANSWER_FOR_HELD_TURN" ] }, { "role": "toolResult", "parts": [ "Sent visible reply to the current source conversation via internal-ui." ] }, { "role": "toolResult", "parts": [ "Skipped to process an incoming message." ] }, { "role": "user", "parts": [ "STEER_BEHIND_MESSAGE_TOOL_REPLY" ] }, { "role": "assistant", "parts": [ "[toolCall message {\"action\":\"send\",\"message\":\"ANSWER_FOR_STEER\"}]" ] }, { "role": "assistant", "parts": [ "ANSWER_FOR_STEER" ] }, { "role": "toolResult", "parts": [ "Sent visible reply to the current source conversation via internal-ui." ] } ] }Reading it: the send launched while the steer waited (
Sent visible reply ...), the ordinarysteering_tailwas still skipped and never executed (trace has notail-executed), the steer follows the tool results, and the transcript showsANSWER_FOR_HELD_TURNbeforeANSWER_FOR_STEER. The case passes (pnpm test:e2e:gateway test/gateway-steer-fifo.e2e.test.ts -t "message-tool-only answer").Same command with the new agent-core check neutralized (equivalent to
mainfor this path):The case takes about 10 s; the wall time is dominated by the one-time runtime build of the e2e setup (about 13 min cold on the 16 GB macOS machine used). Not covered: a live Telegram run (needs Telegram Test Server userbot credentials).
Agent, realmessagetool on the WebChat internal sink, terminal hook inmessage_tool_onlymode): the model answers input A with[sequential lookup, message(send)]while input B arrives. Fails onmainwithsent: [answer B],deliveries: 1; passes with this change with both answers delivered in order and the steer after the first answer's result.pnpm teston touched suites,--maxWorkers=1(warm):packages/agent-core/src/agent-loop.steering.test.ts2.1 s wall (0.7 s Vitest),src/agents/embedded-agent-runner/run/message-tool-terminal.loop.test.ts15.2 s wall (11.2 s Vitest, mostly transforming the message-tool runtime the file already imported; the new case runs in under 10 ms),src/agents/embedded-agent-runner/run/message-tool-terminal.test.ts11.2 s wall (9.1 s Vitest). Also green:agent-loop.test.ts,stream-steering.test.ts,agent-loop.async-tools.test.ts,message-tool-terminal.tool-authored.test.ts.pnpm tsgo:core; tsgo on theagents-other,packagesandtest-root-othertest graphs; type-aware oxlint on touched files; oxfmt check;pnpm check:line-cap-ratchet(no growth in the grandfatheredagent-loop.ts);pnpm format:docs:check;git diff --check.Agentand the installer has one call site), and a line-growth concern foragent-loop.tswas a false positive (the ratchet skips comments and passes). One gap was closed: a test now pins that the send is skipped with the tail once steering already skipped an earlier call.checks-node-changed-extensions-bundle-1failed inextensions/codex/src/app-server/compact.test.ts("keeps later compactions behind an active request after a queued waiter cancels", Bun shard: got the generic "The operation was aborted." instead of the waiting-to-start abort reason), and the twoci-gatechecks aggregate it. That test does not reach the steering checkpoint; it ran only because agent-core changes select the changed-extension lanes. It passed 3/3 locally,pnpm test:ci-failed 176084classifies it[unknown](no matching job onmain), and no existing report was found. Treated as an inherited flake; not rerun just for green. On the current head every check passes, including that test.pnpm check:max-lines-ratchetreports threeui/src/pagesfiles whose suppressions are missing fromconfig/max-lines-baseline.txtat the fork point, andpnpm docs:check-links:anchorsreports five broken fragments in unrelated pages.Production +92/-15, tests +350/-8 (including the Gateway e2e case), docs +8/-5 against the merge base. No new state, config, or public SDK surface; the duplicated pending-send extraction in the terminal hook became one helper shared by the pre-launch and post-delivery checks.