Skip to content

fix(auto-reply): acknowledge an already-delivered reply in queued peer re-invocations - #127989

Closed
Finn763 wants to merge 5 commits into
openclaw:mainfrom
Finn763:fix/issue-126813-queued-peer-reinvoke
Closed

Finn763 wants to merge 5 commits into
openclaw:mainfrom
Finn763:fix/issue-126813-queued-peer-reinvoke

Conversation

@Finn763

@Finn763 Finn763 commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

In multi-agent rooms (allowBots: true, requireMention: false, unmentioned
inbound classed user_request, message-tool-only delivery), a peer-bot message
that 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 automatically
delivered… Use the message tool to send the final user-visible answer"), with
no 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: completedSourceReplyDelivery is computed from the settled run's
delivery 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 prompt
wording (src/auto-reply/reply/prompt-prelude.ts). The fix records the
completed turn's delivery fact on the queue owner and lets drain-time prompt
composition acknowledge it — no consumer-side heuristics.

Canonical fix

  • New MESSAGE_TOOL_ONLY_DELIVERY_HINT_AFTER_DELIVERED_REPLY in
    src/plugin-sdk/message-tool-delivery-hints.ts (added to
    MESSAGE_TOOL_DELIVERY_HINTS so 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 message tool only if this new
    message genuinely warrants one; otherwise no reply is needed."
  • FollowupRun.precedingTurnDeliveredViaSourceReply flag
    (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.ts stamps the queue right before the drain
    (heartbeats excluded — they do not answer and must not overwrite the fact).
  • followup-turn-execution.ts amends the model-visible commandBody via
    acknowledgePrecedingDeliveryInPrompt (prompt-prelude.ts): replaces the
    baked 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:
    acknowledgePrecedingDeliveryInPrompt replaces the answer-expected hint with
    the delivered-reply variant and preserves surrounding prompt text; no-op
    without the hint.
  • src/auto-reply/reply/queue/state.test.ts:
    markFollowupQueuePrecedingDelivery stamps pending, summarized, and elided
    runs; a later non-delivering turn wins (clears the fact).

Test results:

  • pnpm test src/auto-reply/reply/prompt-prelude.test.ts → 13/13
  • pnpm test src/auto-reply/reply/queue/state.test.ts → 11/11
  • pnpm test src/auto-reply/reply/strip-inbound-meta.test.ts → 51/51
  • pnpm test src/auto-reply/reply/followup-runner.test.ts → 11/11
  • pnpm test src/agents/tools/message-tool.test.ts → 234/234
  • pnpm test src/auto-reply/reply/queue/cleanup.test.ts → 2/2
  • pnpm tsgo → clean

Live-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.ts had two synthetic FollowupRun constructors
that dropped precedingTurnDeliveredViaSourceReply:

  • the collect drain (drainGroup / effectiveRunFollowup), and
  • the overflow summary (runSyntheticOverflowSummary).

Both now inherit the fact from their source group via one shared helper
resolveSynthesizedPrecedingDelivery(sources) — a single canonical flow, not
a 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 → scheduleFollowupDrain in collect mode,
real FollowupRun synthesis, real prompt composition) plus the exact
execution-time amendment executeFollowupTurn applies:

  1. Two peer messages are queued while the preceding turn is recorded as
    delivered (precedingTurnDeliveredViaSourceReply = true on both items).
  2. The collect drain synthesizes the merged run from the group.
  3. The synthesized run carries the propagated fact (asserted).
  4. acknowledgePrecedingDeliveryInPrompt — the same function
    followup-turn-execution.ts calls — amends the model-visible prompt:
    the bare MESSAGE_TOOL_ONLY_DELIVERY_HINT is replaced by
    MESSAGE_TOOL_ONLY_DELIVERY_HINT_AFTER_DELIVERED_REPLY ("…your reply to
    the 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 propagation describe): fact propagation, then
the 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-change flags on
queue/state.ts and its test are analyzer false positives: the new field is
an in-memory queue-entry marker stamped at drain time; nothing is persisted,
no migration applies, and upgrade compatibility is unaffected.

Test results at 25047cef

  • drain.identity-guard.test.ts 3/3 (incl. both synthetic-path tests)
  • queue/state.test.ts 11/11 · followup-runner.test.ts 11/11
  • prompt-prelude.test.ts 13/13 · strip-inbound-meta.test.ts 51/51
  • message-tool.test.ts 234/234 · queue/cleanup.test.ts 2/2
  • pnpm tsgo:test:src clean

@clawsweeper

clawsweeper Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@Finn763
Finn763 marked this pull request as ready for review August 22, 2026 17:04
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 22, 2026
@clawsweeper

clawsweeper Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 10, 2026, 7:55 AM ET / 11:55 UTC (Revision 14).

ClawSweeper review

What this changes

Records 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
Reviewed head: ede13b4c1e1d37a9bb16d0ba7d1ea76f37ebd3c3

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The repair has useful intent and an improved recording point, but production-path gaps and unsuccessful live proof prevent merge readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the inspected Telegram evidence failed the acknowledgement assertion on an earlier candidate, and subsequent tests use a mocked runner with a manually constructed prompt. No successful after-fix inbound-envelope-to-model-request trace with visible delivery results is supplied. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) 5 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the inspected Telegram evidence failed the acknowledgement assertion on an earlier candidate, and subsequent tests use a mocked runner with a manually constructed prompt. No successful after-fix inbound-envelope-to-model-request trace with visible delivery results is supplied. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 11 items Pinned introduction boundary: The host verified the introduced delta from 60c11c4 to the checkout head. Its verified test merge has the pinned base followed by this exact head as parents; base-only drift was excluded from findings.
Actual prompt boundary: buildReplyPromptEnvelopeBase places the delivery directive in currentInboundContext.text and runtime-instruction fragments. get-reply-run-execute.ts passes that context separately from queuedBody, and agent-runner-embedded-candidate.ts forwards it separately to the runner. The new amendment changes only commandBody.
Incomplete completion handoff: The new marker updates existing entries only. Enqueue does not inherit a retained completion fact, and queued execution uses accountFollowupTurn rather than finalizeReplyAgentRun, leaving later successors with absent or stale evidence.
Findings 5 actionable findings [P1] [P1] Amend the actual inbound delivery context
[P1] [P1] Retain completion evidence for late queued admissions
[P2] [P2] Record delivery when a queued turn completes
Security None None.

How this fits together

OpenClaw 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]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the inspected Telegram evidence failed the acknowledgement assertion on an earlier candidate, and subsequent tests use a mocked runner with a manually constructed prompt. No successful after-fix inbound-envelope-to-model-request trace with visible delivery results is supplied. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • [P1] Amend the actual inbound delivery context (P1) - The previous finding remains. Normal envelope assembly puts the delivery hint in currentInboundContext.text and its runtime-instruction fragments, while queued.prompt contains the message body. This replacement therefore does nothing for the reported production path, and followupRun: turn.queued forwards the original hint unchanged. Amend the runtime context consistently and build the regression input through the real envelope instead of manually inserting the hint into Q2.prompt.
  • [P1] Retain completion evidence for late queued admissions (P1) - The previous finding remains. This function only stamps entries that already exist and discards the fact when no queue exists. After the call, payload preparation still awaits onObservedReplyDelivery, and completion can await diagnostics or post-compaction work while the reply operation remains active. A message enqueued during that interval receives no marker because enqueue has no retained fact to inherit. Retain the outcome through the owning completion-to-admission boundary with explicit cleanup.
  • [P2] Record delivery when a queued turn completes (P2) - The previous finding remains. The only production call to the new marker is this foreground finalizer; queued turns instead execute through createFollowupRunner and accountFollowupTurn. For A→B→C, B's delivery cannot update C, and B's silent completion cannot clear a true marker inherited from A. Feed queued completions through the same outcome owner so C reflects its actual predecessor.
  • [P2] Preserve delivery evidence through overflow retry copies (P2) - The previous finding remains. The patch adds a field that synthetic overflow runs consume, but this explicit copy constructor omits it. releaseQueueSummaryDeliveryForRetry and overflow elision use this constructor, so a marked source becomes unmarked before the next synthesis. Preserve the field in the copy or keep the fact with an owner that survives these transformations.
  • [P3] Remove temporary session stores after each scenario (P3) - The previous finding remains. Each scenario creates a temporary directory and session store, but neither the scenario nor afterEach removes them. Repeated runs accumulate filesystem state. Await the queued work's settlement and clean up the owned directory in a failure-safe teardown.
  • Resolve merge risk (P1) - Whether the new acknowledgement avoids duplicate answers while preserving legitimate follow-ups and explicit repeat requests remains unproven in a real setup.
  • Resolve merge risk (P1) - The added public SDK hint becomes input to existing prompt and memory sanitizers; compatibility across those consumers has not been demonstrated for the current head.
  • Complete next step (P2) - Resolve the five retained findings and provide successful current-head proof through production inbound assembly, queue admission, and model-request context before merge.
  • Improve patch quality - Resolve all five findings, including owner-boundary regressions for real envelope assembly, late admission, A→B→C, and overflow retries.
  • Improve patch quality - Verify the added SDK hint preserves existing consumer behavior and does not enter stored conversation or memory content.
  • Improve patch quality - Add successful current-head Telegram evidence showing acknowledgement and preserved new requests; screenshots or recordings are preferred for chat, with model-request logs or terminal traces also accepted. Redact private data, update the PR body to trigger review, and ask a maintainer for @clawsweeper re-review if needed.

Findings

  • [P1] [P1] Amend the actual inbound delivery context — src/auto-reply/reply/followup-turn-execution.ts:361-365
  • [P1] [P1] Retain completion evidence for late queued admissions — src/auto-reply/reply/queue/state.ts:216-224
  • [P2] [P2] Record delivery when a queued turn completes — src/auto-reply/reply/agent-runner-result.ts:20-27
Agent review details

Security

None.

PR surface

Source +104, Tests +587. Total +691 across 21 files.

View PR surface stats
Area Files Added Removed Net
Source 8 108 4 +104
Tests 13 589 2 +587
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 21 697 6 +691

Review metrics

Metric Value Why it matters
Production versus test growth Production +104 net lines; tests +587 net lines The body justifies completion-fact and prompt growth, but the larger regression harness still bypasses production envelope assembly.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #126813
Summary: This is one of two open candidate fixes for the queued predecessor-acknowledgement issue; neither establishes a merged resolution.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete the handoff and consumer coverage (recommended)
    Repair the production context and lifecycle gaps, preserve existing SDK exports and stripping behavior, and obtain successful current-head chat evidence.
  2. Consolidate after a replacement is proven
    Keep this branch open until fix(auto-reply): hand completed source replies to queued successors #127967 becomes a viable, proven replacement or merges.

Technical review

Best 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:

  • [P1] [P1] Amend the actual inbound delivery context — src/auto-reply/reply/followup-turn-execution.ts:361-365
    The previous finding remains. Normal envelope assembly puts the delivery hint in currentInboundContext.text and its runtime-instruction fragments, while queued.prompt contains the message body. This replacement therefore does nothing for the reported production path, and followupRun: turn.queued forwards the original hint unchanged. Amend the runtime context consistently and build the regression input through the real envelope instead of manually inserting the hint into Q2.prompt.
    Confidence: 0.99
  • [P1] [P1] Retain completion evidence for late queued admissions — src/auto-reply/reply/queue/state.ts:216-224
    The previous finding remains. This function only stamps entries that already exist and discards the fact when no queue exists. After the call, payload preparation still awaits onObservedReplyDelivery, and completion can await diagnostics or post-compaction work while the reply operation remains active. A message enqueued during that interval receives no marker because enqueue has no retained fact to inherit. Retain the outcome through the owning completion-to-admission boundary with explicit cleanup.
    Confidence: 0.97
  • [P2] [P2] Record delivery when a queued turn completes — src/auto-reply/reply/agent-runner-result.ts:20-27
    The previous finding remains. The only production call to the new marker is this foreground finalizer; queued turns instead execute through createFollowupRunner and accountFollowupTurn. For A→B→C, B's delivery cannot update C, and B's silent completion cannot clear a true marker inherited from A. Feed queued completions through the same outcome owner so C reflects its actual predecessor.
    Confidence: 0.99
  • [P2] [P2] Preserve delivery evidence through overflow retry copies — src/auto-reply/reply/queue/drain.ts:1239-1245
    The previous finding remains. The patch adds a field that synthetic overflow runs consume, but this explicit copy constructor omits it. releaseQueueSummaryDeliveryForRetry and overflow elision use this constructor, so a marked source becomes unmarked before the next synthesis. Preserve the field in the copy or keep the fact with an owner that survives these transformations.
    Confidence: 0.98
  • [P3] [P3] Remove temporary session stores after each scenario — src/auto-reply/reply/agent-runner.queued-peer-reinvoke.test.ts:290-298
    The previous finding remains. Each scenario creates a temporary directory and session store, but neither the scenario nor afterEach removes them. Repeated runs accumulate filesystem state. Await the queued work's settlement and clean up the owned directory in a failure-safe teardown.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The linked report documents repeated duplicate answers in an active multi-agent channel workflow.
  • merge-risk: 🚨 message-delivery: Missing or stale predecessor facts can give the model incorrect guidance about whether another visible reply is needed.
  • merge-risk: 🚨 compatibility: The patch extends an exported SDK hint vocabulary used by existing prompt and memory sanitizers.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Needs real behavior proof before merge: the inspected Telegram evidence failed the acknowledgement assertion on an earlier candidate, and subsequent tests use a mocked runner with a manually constructed prompt. No successful after-fix inbound-envelope-to-model-request trace with visible delivery results is supplied. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The intended change affects duplicate visible replies and handling of new Telegram follow-ups.

Evidence

What I checked:

  • Pinned introduction boundary: The host verified the introduced delta from 60c11c4 to the checkout head. Its verified test merge has the pinned base followed by this exact head as parents; base-only drift was excluded from findings. (ede13b4c1e1d)
  • Actual prompt boundary: buildReplyPromptEnvelopeBase places the delivery directive in currentInboundContext.text and runtime-instruction fragments. get-reply-run-execute.ts passes that context separately from queuedBody, and agent-runner-embedded-candidate.ts forwards it separately to the runner. The new amendment changes only commandBody. (src/auto-reply/reply/followup-turn-execution.ts:361, ede13b4c1e1d)
  • Incomplete completion handoff: The new marker updates existing entries only. Enqueue does not inherit a retained completion fact, and queued execution uses accountFollowupTurn rather than finalizeReplyAgentRun, leaving later successors with absent or stale evidence. (src/auto-reply/reply/queue/state.ts:216, ede13b4c1e1d)
  • Overflow copy loses the added field: createOverflowSummaryRetrySource explicitly reconstructs a FollowupRun without precedingTurnDeliveredViaSourceReply. Both overflow elision and failed summary delivery call this constructor. (src/auto-reply/reply/queue/drain.ts:1214, ede13b4c1e1d)
  • Regression coverage bypasses the real envelope: The new integration test manually prefixes Q2.prompt with the hint and captures a mocked embedded runner. It does not build the production inbound envelope, and its temporary session directory has no cleanup. (src/auto-reply/reply/agent-runner.queued-peer-reinvoke.test.ts:325, ede13b4c1e1d)
  • Historical live evidence failed its assertion: The supplied comment at fix(auto-reply): acknowledge an already-delivered reply in queued peer re-invocations #127989 (comment) records zero acknowledgement occurrences on candidate 97b8d53f61fc7f6ce50f2ea318c312793bd73847 and an overall failure. Both downloaded PNGs were inspected: they show first and queued replies, not successful acknowledgement in the model request. The subsequent contributor comment describes the empty-payload repair and mocked regression coverage, not a successful live rerun. (97b8d53f61fc)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-23T09:44:15.519Z sha dcb23a6c7cc19b20433dfe3356c880d8e096f82e :: needs real behavior proof before merge. :: [P3] Clean up temporary session stores
  • reviewed 2026-08-23T10:28:05.798Z sha dcb23a6c7cc19b20433dfe3356c880d8e096f82e :: needs real behavior proof before merge. :: [P1] Replace every queued delivery directive | [P1] Preserve the delivery fact across retry compaction | [P1] Retain delivery state until the queued successor is admitted | [P3] Remove temporary session-store directories
  • reviewed 2026-08-24T14:22:48.353Z sha dcb23a6c7cc19b20433dfe3356c880d8e096f82e :: needs real behavior proof before merge. :: [P1] Preserve delivery state when compacting overflow sources | [P3] Clean up the temporary session stores
  • reviewed August 29, 2026, 2:25 AM ET / 06:25 UTC sha unknown :: needs real behavior proof before merge. :: [P1] Preserve delivery state in overflow retry clones | [P1] Carry completed delivery through late follow-up admission | [P1] Replace every queued delivery directive in collect batches | [P3] Remove temporary session-store directories after the test
  • reviewed 2026-08-29T06:35:34.399Z sha dcb23a6c7cc19b20433dfe3356c880d8e096f82e :: needs real behavior proof before merge. :: [P1] Amend the model-visible inbound delivery directive | [P1] Preserve delivery state in overflow retry clones | [P1] Retain completed delivery for late queued admission | [P3] Clean temporary queue-test state
  • reviewed September 4, 2026, 5:19 AM ET / 09:19 UTC sha unknown :: needs real behavior proof before merge. :: [P1] Carry delivery state into late queued admissions
  • reviewed 2026-09-04T09:19:19.442Z sha dcb23a6c7cc19b20433dfe3356c880d8e096f82e :: needs real behavior proof before merge. :: [P1] Carry delivery state into late queued admissions
  • reviewed 2026-09-06T19:23:50.798Z sha abbb7ef5f83f579fc85e1199ab25157007f901a0 :: needs real behavior proof before merge. :: [P1] [P1] Amend the actual inbound delivery context | [P1] [P1] Retain completion evidence for late queued admissions | [P2] [P2] Record delivery when a queued turn completes | [P2] [P2] Preserve delivery evidence through overflow retry copies | [P3] [P3] Remove temporary session stores after each scenario

@Finn763

Finn763 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

CI note (check-lint + checks-node-compact-small-12 red): both failing jobs are CI-infrastructure failures, not code failures. Evidence (run 32586656845):

  • check-lint (job 97064009314): setup emitted ::error::Invalid cache-mode input, "package manager file not found", ::error::pnpm install failed; the job was then killed mid-run by "The runner has received a shutdown signal" while oxlint was still scanning ([oxlint] FAILED (exit 143)). Zero lint findings were produced.
  • checks-node-compact-small-12 (job 97064010887): died in the same setup stage — "checkout attempt N/5 failed" (×5), ::error::Invalid cache-mode input, "package manager file not found". No tests ever ran.

Local verification on this branch: oxlint (-c .oxlintrc.json) over all nine changed files reports zero violations; pnpm tsgo clean; prompt-prelude 13/13, queue/state 11/11, strip-inbound-meta 51/51, followup-runner 11/11, message-tool 234/234, queue/cleanup 2/2.

@Finn763 Finn763 closed this Aug 23, 2026
@Finn763 Finn763 reopened this Aug 23, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M and removed size: S labels Aug 23, 2026
@Finn763

Finn763 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review — all 8 items addressed at head 25047cef, item by item:

  1. Propagate delivery state into synthesized queued turns [P1] — fixed. Both synthetic constructors in src/auto-reply/reply/queue/drain.ts (collect drain drainGroup and overflow summary runSyntheticOverflowSummary) now inherit precedingTurnDeliveredViaSourceReply from their source group via one shared helper resolveSynthesizedPrecedingDelivery — a single canonical flow reusing the queue-owned fact, not a new delivery-policy path (the review's LOC concern). Covered by boundary regression tests in drain.identity-guard.test.ts asserting the synthesized run carries the fact; both fail pre-fix and pass after.
  2. Add real behavior proof [P1] — a redacted production-boundary trace is now in the PR body: real queue machinery (enqueue → collect drain → real FollowupRun synthesis → real prompt composition) plus the exact execution-time amendment executeFollowupTurn applies, asserting the final model-visible prompt carries the delivered-reply directive and not the bare hint. Live-verify infeasibility stated explicitly (no real multi-agent room, channel, or credentials available from this fork).
  3. Resolve merge risk — duplicate visible answer via aggregation paths — closed by item 1 (both paths now retain the fact; tests pin them).
  4. Resolve merge risk — mock-only evidence — the new trace exercises the real drain/synthesis/amendment chain at the production boundary, not mocks.
  5. Resolve merge risk — +91 production LOC — the propagation adds one helper and two spreads reusing the existing queue-owned fact; no additional delivery-policy path was added.
  6. Complete next step [P2] — the narrow mechanical repair is done; proof is contributor-owned and now attached.
  7. Improve patch quality — flag + boundary test — done (see item 1).
  8. Improve patch quality — redacted after-fix evidence — PR body updated with the trace; this comment requests re-review.

Also note: serialized state / unknown-data-model-change flags on queue/state.ts are analyzer false positives — the new field is an in-memory drain-time marker, nothing persisted (clarified in the body).

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; pnpm tsgo:test:src clean.

@clawsweeper

clawsweeper Bot commented Aug 23, 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 exact_review_queue).
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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 23, 2026
obviyus added a commit that referenced this pull request Aug 23, 2026
…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
@openclaw-mantis

openclaw-mantis Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Mantis Telegram Desktop Proof

Summary: 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.

  • Scenario: telegram-desktop-proof
  • Trigger: workflow_dispatch
  • Run: https://github.com/openclaw/openclaw/actions/runs/32625581773
  • Artifact: https://github.com/openclaw/openclaw/actions/runs/32625581773/artifacts/9489788453
  • Baseline: pass at 352095882e603500be37d85e379084bb79858635 — Baseline should reproduce the old queued prompt: no delivered-reply acknowledgement text appears in provider requests. · facts: 2 sent · 4 bot messages · 1 edit · 2 deletes · 3 provider requests · 12s observed · attempt 4 · sent: MANTIS-Q1 queued-delivery proof: answer once via message tool, MANTIS-Q2 queued-delivery proof: this arrives while Q1 is still active
  • Baseline assertion: providerRequests absent "your reply to the earlier message was already sent" · occurrences: 0 · met
  • Candidate (PR merged onto main): pass at 97b8d53f61fc7f6ce50f2ea318c312793bd73847 — Candidate should amend the drained queued prompt with the delivered-reply acknowledgement text. · facts: 2 sent · 4 bot messages · 1 edit · 2 deletes · 3 provider requests · 14s observed · attempt 3 · sent: MANTIS-Q1 queued-delivery proof: answer once via message tool, MANTIS-Q2 queued-delivery proof: this arrives while Q1 is still active
  • Candidate assertion: providerRequests contains "your reply to the earlier message was already sent" · occurrences: 0 · unmet
  • Differential (trusted facts): no count differences; pass rests on payload facts and the lane judgments
  • Note: verdict downgraded: candidate expectation not met
  • Overall: fail
Main screenshot This PR merged onto main screenshot
Baseline native Telegram Desktop screenshot Candidate native Telegram Desktop screenshot
Main This PR merged onto main
Baseline native Telegram Desktop proof GIF Candidate native Telegram Desktop proof GIF

Motion-trimmed clips:

Raw QA files: https://artifacts.openclaw.ai/mantis/telegram-desktop/pr-127989/run-32625581773-1/index.json

@Finn763

Finn763 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

@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 completeReplyAgentRun, a branch the payload pipeline never reaches for the live shape. In the Telegram run the message-tool delivery settles with delivery evidence (didDeliverSourceReplyViaMessageTool, sent targets with sourceReplyFinal) but an empty runResult.payloads array — so prepareReplyAgentPayloads's early return (payloadArray.length === 0 && !yieldAcknowledgment && !shouldDeliverTerminalFailure && !emptyInteractiveReplyPayload → returnWithQueuedFollowupDrain(undefined)) skips completeReplyAgentRun entirely. The queue drain still runs right after (that is how provider request 3 fired), but precedingTurnDeliveredViaSourceReply was never recorded on the queued run, so executeFollowupTurn passed the bare MESSAGE_TOOL_ONLY_DELIVERY_HINT through unchanged. The recording point and the drain read point were on different reachable paths.

Fix (head dcb23a6c): the stamp moved to finalizeReplyAgentRun (src/auto-reply/reply/agent-runner-result.ts) — the single boundary every settled turn passes before any payload-branch return and before the queue drain is scheduled in cleanup. completeReplyAgentRun no longer owns the mark (one canonical recording point).

Regression: src/auto-reply/reply/agent-runner.queued-peer-reinvoke.test.ts drives the real gateway admission (two runReplyAgent calls — Q2 arrives mid-Q1 through the real enqueue-followup admission path), real queue state, real drain, real followup runner, and asserts the provider-bound prompt (second embedded-runner call) contains MESSAGE_TOOL_ONLY_DELIVERY_HINT_AFTER_DELIVERED_REPLY ("your reply to the earlier message was already sent") and not the bare hint — the same assertion Mantis ran. Two live shapes are covered: source-reply-mirror payloads, and evidence-only/empty-payloads. The evidence-only case fails on pre-fix code (bare hint retained, exactly the live observation) and passes at dcb23a6c.

Unrelated: apply-session-model-selection.test.ts (9), agent-runner.media-paths.test.ts (2), and directive-handling.model.test.ts (7) fail identically on the pre-fix branch head (verified via stash baseline) — not touched by this change.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 23, 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 exact_review_queue).
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 mantis: telegram-visible-proof Mantis should capture Telegram visible proof. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 23, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 24, 2026
…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
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 24, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 4, 2026
Finn763 and others added 5 commits September 10, 2026 19:14
…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.
@Finn763

Finn763 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

CI note (checks-node-compact-large-1) — not caused by this change

  • Failing job: checks-node-compact-large-1
  • Failing test: test/scripts/run-vitest-profile.test.ts > scripts/run-vitest-profile > prints main help for [ '--help', '--help' ] without starting a test server
  • Error: Error: Test timed out in 120000ms.

Why it is not this PR: the diff touches only src/auto-reply/**, src/model-picker/** and src/plugin-sdk/**; the failing test lives in the run-vitest tooling under test/scripts/ and exercises the CLI help path, which this PR does not modify. A bare 120s timeout with no assertion output is a runner-load flake.

(checks-node-compact-small-46 — test/scripts/docs-sync-publish.test.ts locale drift — is a repo-wide failure shared by every PR and is likewise unrelated.)

@Finn763

Finn763 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Parking this one for now — not a quality call.

openclaw-barnacle enforces a hard limit of 20 active PRs per author, and I am at the cap. The limit is a
queue-depth rule, not a rejection of the change, and the bot's own guidance is to close some and reopen later.
This PR is the oldest zero-traction item in my queue (no review activity, no maintainer comment), so it is the
right thing to park rather than let a fresh fix get auto-closed on arrival.

The branch is untouched:fix/issue-126813-queued-peer-reinvoke (head ede13b4c1e1d37a9bb16d0ba7d1ea76f37ebd3c3). Comment here or ping me and I will reopen it verbatim as soon as
a slot frees — nothing is lost, and I will not resubmit it as a new PR.

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

Labels

agents Agent runtime and tooling merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

1 participant