Repository navigation
refactor(delivery): prevent duplicate and lost scheduled deliveries - #114479
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 6:13 AM ET / 10:13 UTC. ClawSweeper reviewWhat this changesThis PR moves scheduled cron delivery ownership, retries, provider-attempt fencing, attachment custody, and completion receipts into the existing SQLite outbound queue to prevent duplicate, lost, and falsely acknowledged sends. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain Keep this PR open. The durable scheduled-delivery work remains necessary, but the supplied validation is tied to reviewed head Priority: P1 Review scores
Verification
How this fits togetherScheduled cron runs produce outbound messages and attachments that are routed through OpenClaw’s durable outbound queue before a channel provider sends them. The queue’s persisted intent and recovery state feed retry/restart handling, while cron awareness and transcript mirrors remain downstream projections. flowchart LR
Cron[Scheduled cron run] --> Intent[Durable delivery intent]
Intent --> Queue[SQLite outbound queue]
Queue --> Fence[Producer and provider fence]
Fence --> Provider[Channel provider send]
Provider --> Receipt[Durable completion receipt]
Queue --> Recovery[Restart and retry recovery]
Receipt --> Mirrors[Cron awareness and transcript mirrors]
Decision needed
Why: The change intentionally redefines recovery and ownership behavior across cron, outbound delivery, and persisted queue rows; the protected maintainer label and absent final-head runtime proof make this an explicit risk-acceptance decision rather than an automated cleanup decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +837, Tests +1970. Total +2807 across 22 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the existing SQLite-only ownership design, rebase or refresh against current Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction was established in this review. The supplied diff and tests make the race/restart paths source-reproducible, but the environment could not run read-only inspection or a real provider scenario and the PR has not attached such evidence for its current head. Is this the best way to solve the issue? Unclear. Making the existing SQLite queue the single owner is consistent with the repository’s durable-state policy, but the final head needs refreshed runtime and merge-result proof before this can be judged the best safe repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 847906373e97. LabelsLabel justifications:
EvidenceWhat 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)
|
|
Maintainer decision for reviewed head ab0eacb: the existing SQLite delivery queue is the canonical lifecycle owner; this change does not add a SQLite schema/version, configuration surface, provider contract, or gateway protocol. The previous ClawSweeper review covered a superseded head; its runtime import cycle, Madge cycle, three max-lines failures, and type-aware lint findings were fixed and rechecked on this exact head. Proof includes the actual registered Matrix outbound/recovery adapter, original staged attachment bytes, explicit UUID-fenced producer ownership, same-millisecond and cross-process claims, disabled-account admission, ambiguous provider outcomes, permanent receipt compatibility, and restart/retry regressions; 108 focused corrected-head tests, both native TypeScript lanes, formatting and database guards, and a fresh clean high-reasoning commit autoreview. A credentialed external production-provider smoke could not be run: the approved Blacksmith Testbox returned HTTP 429 and the direct AWS coordinator returned HTTP 401. I accept the real adapter-path regression coverage in lieu of that optional external smoke. The exact-head hosted architecture, guards, build, dead-code, and CI gate still must succeed before protected landing. |
|
Merged via squash.
|
…penclaw#114479) * refactor(delivery): make cron delivery durable and recoverable * fix(delivery): preserve immutable staged media during stable reuse * fix(delivery): fence platform attempt settlement and ambiguous batches * fix(delivery): preserve legacy queues and fence bounded terminal states * fix(delivery): retain ambiguous partial abort and rejection evidence * fix(delivery): never impersonate active bounded delivery owners * fix(delivery): narrow optional durable queue custody * fix(delivery): enforce admission and stable-owner recovery fences * fix(delivery): fence explicitly reusable permanent producer intents * refactor(delivery): split durable queue owners and remove cycle * fix(delivery): fence permanent recovery and in-flight producer leases * fix(delivery): limit active recovery leases to explicit producers
What Problem This Solves
Resolves a problem where scheduled announcements could be duplicated, silently lost, or falsely reported as delivered when a gateway restarted, two producers raced, a provider returned no message identity, or a temporary attachment disappeared.
Why This Change Was Made
Makes the existing SQLite outbound queue the sole owner of a bounded scheduled-delivery intent and its recipient-visible completion receipt. Synchronous producer and platform-attempt fences protect initial ownership, retries, reconciliation, terminal transitions, and queued attachments without changing SQLite schemas, schema versions, configuration, environment, dependencies, or gateway protocols. Explicitly reusable permanent intents carry a JSON-only producer-ownership fact; shipped ordinary and permanent restart-sentinel retry contracts remain unchanged. Cron policy, awareness, and dispatch remain in their current separate owner modules.
Transcript and awareness mirrors intentionally remain best-effort projections: a recipient delivery receipt must not fabricate conversation-state custody.
User Impact
Scheduled messages and attachments are sent at most once across live-producer races and gateway restarts. Ambiguous, partial, cancelled, rejected, and identityless provider sends cannot create a false success receipt or erase another producer’s queued attachment. Existing restart recovery, permanent sentinels, channels, and plugin contracts continue to work.
Evidence
ab0eacb85b448f980ca835e8cf2fab9037c159ec.openclaw/ci-gate, packaged build, all Node test shards, Windows tests, all four QA smoke profiles, production and test typechecking, import/topology architecture, max-lines, security, boundary, dependency, lint, and database guards.git diff --checkpassed on the final head.autoreview --mode commit --commit HEADon the final head: clean; no accepted or actionable findings. TruffleHog clean.