Repository navigation
fix(a2a): avoid duplicate source replies after message delivery - #137923
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 1:39 AM ET / 05:39 UTC. ClawSweeper reviewWhat this changesThe PR replaces same-session A2A transcript-history inference with a run-owned receipt that records final source-conversation delivery. Merge readiness⛔ Blocked before merge - 4 items remain Keep open: the prior P1 remains unfixed. Confirmed current-source Priority: P1 Review scores
Verification
How this fits togetherA flowchart LR
Requester[Requester session] --> Send[sessions_send]
Send --> Run[Target agent run]
Run --> Tool[Message tool]
Tool --> Receipt[Terminal delivery receipt]
Receipt --> Decide[A2A announcement decision]
Decide --> Reply[Requester-visible reply]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -145, Tests -59, Docs +15, Other +26. Total -163 across 52 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Project confirmed reply-type action delivery through the existing source-route predicates, set the final receipt only for settled non-partial delivery, and retain receipt-only A2A suppression. Do we have a high-confidence way to reproduce the issue? Yes. The source proves that reply actions use Is this the best way to solve the issue? No. Run-owned delivery evidence is the right solution, but the producer must cover established reply-type action results instead of only send results. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d147f591b93a. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Record confirmed final external source delivery in the run terminal receipt and consume it with the terminal reply. Remove history snapshots, fingerprints, and mirror inference from A2A; preserve internal forwarding and delivery facts through Pi, Codex, CLI, and nested tools.
Use the existing action-specific route predicates and settled plugin results for final source-delivery receipts. Add regressions for duplicate announcements, other targets, progress, partial sends, and dry runs. Recheck QA native target matching without scenario retries.
497eae2 to
16fc7bf
Compare
|
Merged via squash.
|
…claw#137923) * fix(a2a): avoid duplicate source replies after message delivery Record confirmed final external source delivery in the run terminal receipt and consume it with the terminal reply. Remove history snapshots, fingerprints, and mirror inference from A2A; preserve internal forwarding and delivery facts through Pi, Codex, CLI, and nested tools. * test(a2a): align delivery harnesses with settled receipts * fix(agents): retain source delivery for replies and polls Use the existing action-specific route predicates and settled plugin results for final source-delivery receipts. Add regressions for duplicate announcements, other targets, progress, partial sends, and dry runs. Recheck QA native target matching without scenario retries. * test(agents): reuse direct harness fixtures
Answer the detached reply and announce steps with the file's existing REPLY_SKIP/ANNOUNCE_SKIP idiom so each agent-targeting row settles after the single turn it asserts on. Drops the QA scenario changes superseded by #137923.
…37731) * test(sessions): make cross-agent send rows and mirror scenario deterministic The `sessions_send agent targeting` rows mocked every target turn with the same reply, so the detached announce tail ran the full five-turn ping-pong after each row and overran the row budget under host load. Only the first target turn now returns the awaited reply; later mocked turns answer REPLY_SKIP, which the announce flow already treats as "stop", so the tail ends after one step. The a2a-message-tool-mirror-dedupe qa-lab scenario retried a duplicate marker away on a loaded host. It now runs with retryCount 0 so a duplicate fails the run, and the assertion message carries a duplicateAttribution snapshot (outbound ids, timing, reply linkage, projected history rows with mirror flags, mock requests) so the next occurrence is attributable instead of retried. Follow-up to #136755. No production code changes. * test(gateway): end the detached A2A tail in cross-agent send rows Answer the detached reply and announce steps with the file's existing REPLY_SKIP/ANNOUNCE_SKIP idiom so each agent-targeting row settles after the single turn it asserts on. Drops the QA scenario changes superseded by #137923.
…enclaw#137731) * test(sessions): make cross-agent send rows and mirror scenario deterministic The `sessions_send agent targeting` rows mocked every target turn with the same reply, so the detached announce tail ran the full five-turn ping-pong after each row and overran the row budget under host load. Only the first target turn now returns the awaited reply; later mocked turns answer REPLY_SKIP, which the announce flow already treats as "stop", so the tail ends after one step. The a2a-message-tool-mirror-dedupe qa-lab scenario retried a duplicate marker away on a loaded host. It now runs with retryCount 0 so a duplicate fails the run, and the assertion message carries a duplicateAttribution snapshot (outbound ids, timing, reply linkage, projected history rows with mirror flags, mock requests) so the next occurrence is attributable instead of retried. Follow-up to openclaw#136755. No production code changes. * test(gateway): end the detached A2A tail in cross-agent send rows Answer the detached reply and announce steps with the file's existing REPLY_SKIP/ANNOUNCE_SKIP idiom so each agent-targeting row settles after the single turn it asserts on. Drops the QA scenario changes superseded by openclaw#137923.
What Problem This Solves
A same-session
sessions_sendtarget can deliver through the message tool and then have A2A announce its reply again. The regression produces two requester-visible markers when the completed run reports source delivery but display history lacks the successful tool-result row.Why This Change Was Made
The message tool now records confirmed final delivery to its resolved external source route. Pi, Codex, CLI, and nested-tool collectors preserve that fact before result middleware and carry it into the existing terminal receipt. A2A consumes the receipt and canonical terminal reply, deleting history baselines, fingerprints, mirror-boundary inference, and fallback reads.
The existing display marker cannot supply this fact: A2A enters through webchat and can resolve its external source inside the message tool. The producer therefore compares the completed delivery with the prepared source route while preserving authorization and display-marker semantics. The historical host-load trace does not establish a wait-before-write race; the demonstrated defect is deciding whether to repeat a side effect from a lossy display projection.
User Impact
Already delivered source replies are not announced again, including webchat requesters and supported
reply,thread-reply, and poll actions. Progress, partial, dry-run, internal-UI, and other-destination operations do not claim final external delivery. Cross-session announcements and internal-UI forwarding remain available. A failure after delivery remains visible without recommending a resend.Evidence
createSessionsSendToolregression fails on pre-fixc86d5b2d270with two markers and passes with the repair. Nested-tool regressions establish receipt capture before output transformation or rejection.OPENCLAW_BUILD_PRIVATE_QA=1 pnpm buildpassed. The rebased QA runtime build also passed.pnpm check:changedpassed with isolatedOPENCLAW_STATE_DIR, including typechecks, lint, all three dead-export scans, and runtime-cycle checks. The final test-only cleanup passed another isolated check and 104 focused tests.sourceReplyDelivered=truereceipt and exactly one marker throughout the unchanged eight-second window. Retries are disabled. Default/disabled/allowlist A2A policy scenarios also passed. A fresh live-providergroup-visible-reply-toolrun passed on the same rebased production build; the A2A scenario itself uses a deterministic mock provider.The additional native-thread scenario exposed a QA-channel target mismatch. Three new matcher cases failed before the correction, and all 37 QA-channel tests passed afterward. Main independently received the owner correction in #137964; this PR retains the negative cases and disables scenario retries without duplicating that production fix. The rebased native-thread scenario passed first attempt, suppressing fallback while preserving a distinct later final reply. Main's canonical CLI terminal outcome is retained.
CI initially exposed two test-harness mismatches, corrected with 90 passing focused tests. After rebase, the test file exceeded its size limit; consolidating 12 identical harness fixtures removed 40 lines without deleting cases or assertions. A separate CI plugin-reload test completed its assertions but timed out in teardown; the stalled cleanup owner remains unproven. An unchanged local diagnostic was interrupted after prolonged module initialization without reaching case results; it is inconclusive, not a pass. Exact-head CI 33849203084 passed on
bfa70f4047e, including that shard; all 137 applicable checks pass. The earlier teardown stall remains unexplained.No database schema, configuration, protocol-version change, retry, or timeout increase is added. ClawSweeper's stored-data warning refers to QA YAML, not runtime persistence; no migration is involved.
Named follow-ups: identify the plugin-reload teardown stall observed in CI run 33846850552; extend the QA transcript summary's
currentSourceToolDeliveriesprojection to nested code-mode activity. The native-thread failure used a flat result, so that summary gap did not cause it.Final real-Gateway verdict JSON (mock provider; unmodified step results)
[ { "run": 1, "status": "pass", "steps": [ { "name": "delivers target message-tool reply once without mirror re-announce", "status": "pass", "details": "outbound=group:qa-a2a-mirror-room:QA-A2A-MESSAGE-TOOL-MIRROR-OK; sourceTool={\"sessionKey\":\"agent:qa:qa-channel:group:group:qa-a2a-mirror-room\",\"message\":\"qa group visible reply tool check. Use the visible room reply path. exact marker: `QA-A2A-MESSAGE-TOOL-MIRROR-OK`\",\"timeoutSeconds\":0}; targetTool={\"action\":\"send\",\"message\":\"QA-A2A-MESSAGE-TOOL-MIRROR-OK\"}; targetRunId=534da996-5670-4b77-afe1-6a37d681e17a; sourceReplyDelivered=true; terminalReplyDisposition=empty; duplicateWindowMs=8000" } ] }, { "run": 2, "status": "pass", "steps": [ { "name": "delivers target message-tool reply once without mirror re-announce", "status": "pass", "details": "outbound=group:qa-a2a-mirror-room:QA-A2A-MESSAGE-TOOL-MIRROR-OK; sourceTool={\"sessionKey\":\"agent:qa:qa-channel:group:group:qa-a2a-mirror-room\",\"message\":\"qa group visible reply tool check. Use the visible room reply path. exact marker: `QA-A2A-MESSAGE-TOOL-MIRROR-OK`\",\"timeoutSeconds\":0}; targetTool={\"action\":\"send\",\"message\":\"QA-A2A-MESSAGE-TOOL-MIRROR-OK\"}; targetRunId=19e6b2d8-759a-4748-a1f3-c64ccf5412bd; sourceReplyDelivered=true; terminalReplyDisposition=empty; duplicateWindowMs=8000" } ] }, { "run": 3, "status": "pass", "steps": [ { "name": "delivers target message-tool reply once without mirror re-announce", "status": "pass", "details": "outbound=group:qa-a2a-mirror-room:QA-A2A-MESSAGE-TOOL-MIRROR-OK; sourceTool={\"sessionKey\":\"agent:qa:qa-channel:group:group:qa-a2a-mirror-room\",\"message\":\"qa group visible reply tool check. Use the visible room reply path. exact marker: `QA-A2A-MESSAGE-TOOL-MIRROR-OK`\",\"timeoutSeconds\":0}; targetTool={\"action\":\"send\",\"message\":\"QA-A2A-MESSAGE-TOOL-MIRROR-OK\"}; targetRunId=583078c1-abf5-4004-b235-f8d6fad98a53; sourceReplyDelivered=true; terminalReplyDisposition=empty; duplicateWindowMs=8000" } ] } ]