Repository navigation
fix(outbound): avoid duplicate replies after queued delivery failures - #139388
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 maintainer review before merge. Reviewed September 6, 2026, 4:54 AM ET / 08:54 UTC. ClawSweeper reviewWhat this changesThe PR keeps queued replies with their recovery owner and carries pending delivery separately from confirmed receipt through private commands, agent replies, and channel delivery. Merge readiness✅ Ready for maintainer review This repair remains useful: current main and the latest release retain the duplicate-fallback path. The prior private-route finding is resolved, and no new blocking defect was identified. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s outbound pipeline turns agent replies and command results into channel messages. Its durable queue coordinates transport attempts and recovery, while delivery receipts determine whether callers may send a fallback. flowchart TD
A[Agent replies and command results] --> B[Prepare channel payload]
B --> C[Durable delivery owner]
C --> D[Channel transport]
D --> E{Delivery outcome}
E -->|Confirmed| F[Receipt and completion]
E -->|Pending or ambiguous| G[Recovery or reconciliation]
E -->|Proven unsent and released| H[Eligible fallback]
G --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +165, Tests +2507, Docs +11, Other -1. Total +2682 across 63 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain one recovery owner per queued reply, preserve unqueued retries, and keep independent text and audio obligations distinct from confirmed delivery. Do we have a high-confidence way to reproduce the issue? Yes: an admitted route failure can retain its queue row while current main sends a native fallback, allowing recovery to send another copy. Source inspection and the recorded Matrix replay establish the path; this review did not execute it. Is this the best way to solve the issue? Yes: carrying custody from the queue owner addresses the competing retry paths directly, while optional dispatcher fields preserve existing implementations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7b481f3e2e38. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
Carry exact pending state through native, ACP and private-command fallback. Keep queue custody distinct from ambiguous or partial sends and confirmed visibility. Preserve independent text/audio obligations and confirmed output when a turn is cancelled. Keep durable Signal finals with outbound recovery without replaying the model turn or an earlier visible block. Preserve direct-send ingress retry. Carry preparation through dispatcher wrappers so channel transforms run before TTS. Honor intentional text suppression before and after admission while preserving independent audio/text delivery. Remove duplicate private routing, diagnostics forwarding, sender conversions, queue type copies, preparation registry and transcript accumulators.
|
@clawsweeper re-review The private-route finding and rank-up move are fixed in 78324e3: pending or identityless acceptance stops alternate-recipient fallback without claiming delivery. The rewrite also carries custody through native/ACP consumers, preserves canonical transcripts and independent text/audio obligations, and honors preparation and terminal retry decisions. All 320 final owner tests pass, the changed-code gates are green, and the independent P2 review returned no findings across nine sections. The PR body records the full scope and production/test LOC split. Final committed build, Matrix replay and exact-head CI are in progress before landing. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Ready to land at 98b7c4f. The reported merge conflicts are resolved while retaining main's shared command helpers and ACP input persistence. The integrated tree passed 437 focused cases, the complete changed-code gate, a 14-section independent review, a fresh private-QA build, and exact-head CI. Native preparation verified the same remote tree without rewriting the head. The fresh Gateway/Matrix replay reproduced the startup-abort queue row, then observed one accepted transaction, one visible reply, no native fallback and retirement of that same row. The additional 15-second observation and all process/port cleanup passed. Source hashes were unchanged. The test uses the normal plugin against a local protocol server and mock model. Review dispositions: retain the recommended additive dispatcher contract, including optional preparation and existing custom-dispatcher and spread/abort wrapper behavior. Those paths have passing coverage; independently distributed plugins were not exercised. Telegram's group acknowledgement plus owner DM remains the concrete integration-proof gap disclosed in the body: authenticated Convex/broker access is absent, and the existing trusted CI lane does not accept this PR ref or provide that dual-chat scenario. No trust-gate bypass or substitute hello test is claimed. The prior private-route finding and final-source replay request are addressed; no actionable code finding remains. |
|
Merged via squash.
|
…openclaw#139388) * fix(outbound): preserve queue custody and reply obligations * fix(delivery): preserve pending replies and canonical transcripts Carry exact pending state through native, ACP and private-command fallback. Keep queue custody distinct from ambiguous or partial sends and confirmed visibility. Preserve independent text/audio obligations and confirmed output when a turn is cancelled. Keep durable Signal finals with outbound recovery without replaying the model turn or an earlier visible block. Preserve direct-send ingress retry. Carry preparation through dispatcher wrappers so channel transforms run before TTS. Honor intentional text suppression before and after admission while preserving independent audio/text delivery. Remove duplicate private routing, diagnostics forwarding, sender conversions, queue type copies, preparation registry and transcript accumulators. * test(mcp): declare both private routing fixtures
A reply that remains queued, has no platform identity, or may have been partially sent must not trigger another automatic copy. During Matrix CLI testing, a followup inherited a closed monitor context, retained its outbound queue row, and triggered a native fallback; recovery later sent the original again.
Queued delivery now has one owner from admission through claim, lease, execution, acknowledgement and retirement. Consumers carry pending delivery separately from confirmed visibility. Private command selection stops before another recipient and reports delivered, pending, suppressed or failed honestly. Native and ACP finalization preserve pending text while still delivering uncovered content or independent audio. Durable Signal finals stay with outbound recovery; replaying ingress does not regenerate the model turn or resend an earlier visible block. Direct, unqueued failures retain ingress retry.
ACP keeps generated history separate from delivery-only fallback fragments. Preparation survives dispatcher wrappers so channel transforms run once before TTS. One helper covers the actual answer-text snapshot across preparation, pending delivery, confirmation and intentional suppression. Settled fallback decisions reuse the canonical dispatcher retry policy: permanently rejected captions do not reappear as plaintext, while media-only suppression preserves separately deferred text. Cancellation retains confirmed output. Existing custom dispatcher and settled-count contracts remain supported. The new preparation method is optional; this retains the additive dispatcher contract recommended by review, with the legacy custom-dispatcher path and spread/abort wrappers tested. Independently distributed plugins have not been exercised.
The refactor removes duplicate private-recipient loops, redundant sender conversions, duplicate queue type definitions, the preparation registry and duplicate transcript accumulators. Integration with main retains its shared command approval/formatting helpers and ACP input persistence before runtime execution. No configuration option, database schema, stored format or protocol version changes.
Validation on integrated commit 98b7c4f: 437 distinct focused cases pass, covering ACP delivery/cancellation, private command routing and exports, assembled channel turns, Signal recovery and outbound custody. Regressions failed before repair, including private identityless fallback, wrapper preparation, Signal final recovery, selective transcript loss, caption suppression/permanent rejection, and deferred text after media-only suppression. The complete changed-code gate passes with the pinned dependencies: typechecks, lint, dead-export scans, SDK/storage guards and import-cycle checks. Independent P2 review passed all 14 sections with no actionable findings. The reviewed, tested and committed source trees match exactly.
An earlier CI run exposed a fixture timeout: the Telegram preparation-failure case omitted its Signal fallback plugin and synchronously loaded the real plugin. A five-line test-only correction declares both fixtures, preserving all assertions and the timeout. The exact 17-file CI group then passed all 313 tests, its changed gate and independent review passed, and CI passed on that revision. Integrated-head CI passed with all 125 jobs completed and no failures.
Production LOC relative to integrated main: +1,089/-924 (net +165). Tests and support: +2,897/-390 (net +2,507). Main independently landed some overlapping cleanup, so those deletions are not counted again. The remaining production growth records exact queue custody, per-enqueue pending receipts and independent text/audio/transcript obligations after removing connected duplicate paths.
The private-QA build passed on the integrated commit. Its fresh replay used a real isolated Gateway and the normal Matrix plugin against a local Crabline protocol server and mock model. CLI add, disable, restore and delete passed. After the original startup-abort condition, the restored reply produced one accepted deterministic transaction and one visible timeline event, zero native fallback, and retirement of the same queue row. The recorder observed another 15 seconds. All owned processes and ports stopped with no cleanup errors, and all 63 source hashes remained unchanged. This is protocol-server proof, not an external Matrix-account or live-model claim.
Telegram Test Server proof is unavailable in this execution environment: no authenticated Convex CLI or broker pair is present. The existing credentialed CI lane accepts main/release refs for manual dispatch, rejects this unmerged PR, and has no scenario observing both the private-command group acknowledgement and owner DM. No authentication setup or trust-gate bypass was attempted. Telegram-facing command text and wrapper behavior are covered by owner tests; a generic Telegram hello would not cover the changed claim. This is an explicit remaining integration-proof gap.
The ClawSweeper private-route finding is addressed in the shared routing owner and covered by identityless first acceptance with a second valid recipient available. Final-source replay evidence is recorded above. No actionable review finding is being skipped.
Follow-up: separate confirmed visibility from terminal retry suppression in the existing public dispatch receipts. This PR preserves their shipped count/phase semantics and uses exact pending and confirmation facts where needed; changing those public semantics is outside this repair.