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: needs real behavior proof before merge. Reviewed September 10, 2026, 7:55 AM ET / 11:55 UTC (Revision 14). ClawSweeper reviewWhat this changesRecords completed message-tool delivery on queued messages and changes follow-up instructions to acknowledge the earlier answer. Merge readiness⛔ Blocked before merge - 12 items remain Keep open: the reported problem remains actionable, but the five prior findings remain unresolved. The overlapping implementation is still open and is not a verified replacement. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw queues incoming messages while an agent is busy, then assembles each successor's model input. Delivery evidence from the preceding turn should inform that input without changing the new request or its transcript. flowchart TD
A[Incoming messages] --> B[Follow-up queue]
C[Completed agent turn] --> D[Source reply delivery evidence]
D --> B
B --> E[Individual or collected successor]
E --> F[Runtime delivery instructions]
F --> G[Model handles new request]
G --> H[Visible message-tool reply]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +104, Tests +587. Total +691 across 21 files. 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. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Carry one correctly scoped completion fact through successor admission, render it in runtime context, and preserve current requests, transcript bytes, and existing SDK hint behavior. Do we have a high-confidence way to reproduce the issue? Yes, at source level: normal message-tool-only inbound assembly stores the directive outside the field this patch amends. The historical Telegram run corroborates the symptom, but no current-head runtime reproduction was executed. Is this the best way to solve the issue? No. Recording delivery before empty-payload returns is useful, but the consumer targets the wrong prompt field and the handoff does not cover late admission, queued completion, or overflow copies. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b9d6923d505b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (13 earlier review cycles; latest 8 shown)
|
|
CI note (check-lint + checks-node-compact-small-12 red): both failing jobs are CI-infrastructure failures, not code failures. Evidence (run 32586656845):
Local verification on this branch: oxlint ( |
|
@clawsweeper re-review — all 8 items addressed at head
Also note: Test results: drain.identity-guard 3/3, queue/state 11/11, followup-runner 11/11, prompt-prelude 13/13, strip-inbound-meta 51/51, message-tool 234/234, queue/cleanup 2/2; |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…analysis files (#128124) * fix(mantis): enforce verdict-expectation coherence and publish agent analysis files Mantis run 32619081130 on #127989 published an overall `pass` while its own manifest recorded that the candidate expectation was not observed: per-lane `status` was mechanical capture success and the agent's judgment lived only in `expected` prose, so nothing reconciled the two before publication. - `mantis-evidence.json` schemaVersion 2: each comparison lane carries a required boolean `expectationMet`. The desktop agent sets it in the same manifest edit as `expected`; mechanical producers (Telegram live, web UI, Slack, Discord) derive it from lane status. - `scripts/mantis/publish-pr-evidence.mjs` is the single enforcement owner: it requires the booleans, recomputes `pass`/`outcome`, downgrades a contradictory pass claim to `fail`, and renders a visible "verdict downgraded" note. The desktop workflow invokes it with `--validate-only` before upload or comment. - Agent top-level `*.json`/`*.md` analysis files (assertions, comparisons, recipe suggestion) now survive the quarantine rebuild and upload, so cited evidence actually exists in the artifact. * fix(mantis): derive expectations from trusted lane facts
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop queued-follow-up evidence with Convex-leased Telegram credentials. Both lanes sent Q1, then Q2 while Q1 was active; provider request 3 contained Q2. Baseline preserved the old message-tool delivery hint. Candidate also preserved the old hint and did not include the delivered-reply acknowledgement phrase.
Motion-trimmed clips: |
|
@openclaw-mantis — root cause found and fixed. The live capture pinned the gap precisely. Why the candidate missed live: the delivery-fact stamp lived at the very end of Fix (head Regression: Unrelated: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…analysis files (openclaw#128124) * fix(mantis): enforce verdict-expectation coherence and publish agent analysis files Mantis run 32619081130 on openclaw#127989 published an overall `pass` while its own manifest recorded that the candidate expectation was not observed: per-lane `status` was mechanical capture success and the agent's judgment lived only in `expected` prose, so nothing reconciled the two before publication. - `mantis-evidence.json` schemaVersion 2: each comparison lane carries a required boolean `expectationMet`. The desktop agent sets it in the same manifest edit as `expected`; mechanical producers (Telegram live, web UI, Slack, Discord) derive it from lane status. - `scripts/mantis/publish-pr-evidence.mjs` is the single enforcement owner: it requires the booleans, recomputes `pass`/`outcome`, downgrades a contradictory pass claim to `fail`, and renders a visible "verdict downgraded" note. The desktop workflow invokes it with `--validate-only` before upload or comment. - Agent top-level `*.json`/`*.md` analysis files (assertions, comparisons, recipe suggestion) now survive the quarantine rebuild and upload, so cited evidence actually exists in the artifact. * fix(mantis): derive expectations from trusted lane facts
…e.js mock factories (openclaw#126813)
…collect and overflow runs (openclaw#126813)
…h returns (openclaw#126813) Mantis live verification found the queued peer re-invocation still carries the bare answer-expected hint. Root cause: a message-tool-only delivery can settle with delivery evidence (didDeliverSourceReplyViaMessageTool / sent targets) but an empty runResult.payloads array, so prepareReplyAgentPayloads early-returns before completeReplyAgentRun, and the delivery fact was never stamped on the queue. The drain then re-invoked the agent without the delivered-reply acknowledgment. Move the recording point to finalizeReplyAgentRun, the single boundary every settled turn passes before any payload-branch return and before the queue drain runs. completeReplyAgentRun no longer owns the mark. Regression: agent-runner.queued-peer-reinvoke.test.ts drives the real gateway admission (two runReplyAgent calls), real queue state, real drain and real followup runner, asserting the provider-bound prompt acknowledges the delivered reply. Both live shapes covered (source-reply mirror payloads and evidence-only empty payloads); the evidence-only case fails on pre-fix code.
abbb7ef to
ede13b4
Compare
|
CI note (
Why it is not this PR: the diff touches only ( |
|
Parking this one for now — not a quality call.
The branch is untouched: |




What Problem This Solves
In multi-agent rooms (
allowBots: true,requireMention: false, unmentionedinbound classed
user_request, message-tool-only delivery), a peer-bot messagethat arrives while an agent's turn is in flight is queued and later re-invokes
that agent. The re-invocation prompt carries the bare
MESSAGE_TOOL_ONLY_DELIVERY_HINT("Final assistant text is not automaticallydelivered… Use the
messagetool to send the final user-visible answer"), withno acknowledgment that the immediately preceding turn already delivered its
answer seconds earlier. The model reads the hint as "an answer is expected
and none was delivered" and answers the same question a second time,
rephrased, 30–60 s after the first answer.
Closes #126813
Why This Change Was Made
Root cause: the re-invocation prompt is composed at queue time (when the
peer message arrives mid-turn), at which point the current turn has not
delivered yet — so the directive cannot know about the delivery. The
completion pipeline (
src/auto-reply/reply/agent-runner-result-complete.ts)does know:
completedSourceReplyDeliveryis computed from the settled run'sdelivery evidence there, and the queue drain runs after the reply operation
clears (same process, in-memory queue).
Architectural owner: the queued-run registry owns pending runs
(
src/auto-reply/reply/queue/state.ts); the delivery directive owns promptwording (
src/auto-reply/reply/prompt-prelude.ts). The fix records thecompleted turn's delivery fact on the queue owner and lets drain-time prompt
composition acknowledge it — no consumer-side heuristics.
Canonical fix
MESSAGE_TOOL_ONLY_DELIVERY_HINT_AFTER_DELIVERED_REPLYinsrc/plugin-sdk/message-tool-delivery-hints.ts(added toMESSAGE_TOOL_DELIVERY_HINTSso inbound-meta stripping recognizes it):"…your reply to the earlier message was already sent. Treat this as a
follow-up: send another message with the
messagetool only if this newmessage genuinely warrants one; otherwise no reply is needed."
FollowupRun.precedingTurnDeliveredViaSourceReplyflag(
src/auto-reply/reply/queue/types.ts) +markFollowupQueuePrecedingDelivery(
src/auto-reply/reply/queue/state.ts) that stamps every pending item(items, summary sources, elided sources) with the completed turn's delivery
outcome; the last completing non-heartbeat turn wins.
agent-runner-result-complete.tsstamps the queue right before the drain(heartbeats excluded — they do not answer and must not overwrite the fact).
followup-turn-execution.tsamends the model-visiblecommandBodyviaacknowledgePrecedingDeliveryInPrompt(prompt-prelude.ts): replaces thebaked answer-expected hint with the delivered-reply variant; no-op when the
hint is absent (non-message-tool-only runs are unaffected).
Production LOC delta: +91 across 7 production files. Justification against
the bug-fix net-≤0 default: the fix adds a new delivery-acknowledgment
capability (a wording constant plus a queue fact plus a drain-time amendment) —
each piece is the minimal expression of its role; the comments document the
contract each protects.
User Impact
Agents in multi-agent rooms no longer answer the same question twice when a
queued peer message drains right after their delivered reply. Behavior for
queued runs whose preceding turn did not deliver is unchanged (the original
hint remains); prompts without the hint are byte-identical.
Evidence
Regression tests (both verified failing on pre-fix code — the function and
the queue field did not exist — then green):
src/auto-reply/reply/prompt-prelude.test.ts:acknowledgePrecedingDeliveryInPromptreplaces the answer-expected hint withthe delivered-reply variant and preserves surrounding prompt text; no-op
without the hint.
src/auto-reply/reply/queue/state.test.ts:markFollowupQueuePrecedingDeliverystamps pending, summarized, and elidedruns; a later non-delivering turn wins (clears the fact).
Test results:
pnpm test src/auto-reply/reply/prompt-prelude.test.ts→ 13/13pnpm test src/auto-reply/reply/queue/state.test.ts→ 11/11pnpm test src/auto-reply/reply/strip-inbound-meta.test.ts→ 51/51pnpm test src/auto-reply/reply/followup-runner.test.ts→ 11/11pnpm test src/agents/tools/message-tool.test.ts→ 234/234pnpm test src/auto-reply/reply/queue/cleanup.test.ts→ 2/2pnpm tsgo→ cleanLive-verify note: reproducing requires a real multi-agent room with two bot
participants and a >1-minute turn; no such room is available from this fork PR.
The change is a deterministic prompt-wording amendment guarded by a recorded
delivery fact — unit tests pin both the fact propagation and the amendment.
Evidence update after ClawSweeper review (head
25047cef)[P1] Delivery fact now propagates into synthesized queued turns
src/auto-reply/reply/queue/drain.tshad two synthetic FollowupRun constructorsthat dropped
precedingTurnDeliveredViaSourceReply:drainGroup/effectiveRunFollowup), andrunSyntheticOverflowSummary).Both now inherit the fact from their source group via one shared helper
resolveSynthesizedPrecedingDelivery(sources)— a single canonical flow, nota new delivery-policy path — so aggregated peer re-invocations receive the
same delivered-reply acknowledgment as single queued runs.
Production-boundary trace (offline, redacted)
Live-verify is not feasible from this fork: reproducing requires a real
multi-agent room with two bot participants, an authenticated channel, and a
turn longer than the peer message's queue window; no such room, channel, or
credential is available to the author — stated here as the concrete blocker.
The strongest production-boundary proof available runs the real queue
machinery (
enqueueFollowupRun→scheduleFollowupDrainin collect mode,real
FollowupRunsynthesis, real prompt composition) plus the exactexecution-time amendment
executeFollowupTurnapplies:delivered (
precedingTurnDeliveredViaSourceReply = trueon both items).acknowledgePrecedingDeliveryInPrompt— the same functionfollowup-turn-execution.tscalls — amends the model-visible prompt:the bare
MESSAGE_TOOL_ONLY_DELIVERY_HINTis replaced byMESSAGE_TOOL_ONLY_DELIVERY_HINT_AFTER_DELIVERED_REPLY("…your reply tothe earlier message was already sent…"), and the merged peer texts are
preserved.
Asserted in
src/auto-reply/reply/queue/drain.identity-guard.test.ts(
collect drain delivery fact propagationdescribe): fact propagation, thenthe amended final prompt containing the delivered-reply directive and not the
bare hint. Verified failing on pre-fix code (fact undefined → bare hint
retained) and green after.
Stored data model
The
serialized state/unknown-data-model-changeflags onqueue/state.tsand its test are analyzer false positives: the new field isan in-memory queue-entry marker stamped at drain time; nothing is persisted,
no migration applies, and upgrade compatibility is unaffected.
Test results at
25047cefdrain.identity-guard.test.ts3/3 (incl. both synthetic-path tests)queue/state.test.ts11/11 ·followup-runner.test.ts11/11prompt-prelude.test.ts13/13 ·strip-inbound-meta.test.ts51/51message-tool.test.ts234/234 ·queue/cleanup.test.ts2/2pnpm tsgo:test:srcclean