Repository navigation
fix(cron): prevent duplicate one-shot delivery after restart - #159873
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: blocked before merge. Reviewed September 30, 2026, 9:15 PM ET / October 1, 2026, 01:15 UTC (Revision 27). ClawSweeper reviewWhat this changesThe branch records delivery attempts in Cron's SQLite run receipts and carries that fence through message and webhook delivery so restart recovery replays only one-shot runs proven not to have started delivery. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 1 item remains Keep open. Current main still permits startup replay of an interrupted one-shot without a delivery-attempt check, so this PR remains useful. The previously missing schema-19 upgrade witness is now recorded for the reviewed head, and this review found no definite introduced defect. The exact-head CI gate remains failed after an Android test failure outside the changed paths. Priority: P2 Review scores
Verification
How this fits togetherCron schedules jobs and stores run receipts in OpenClaw's shared SQLite state. On restart, those receipts guide whether the Gateway may retry a one-shot job; during execution, the Gateway and outbound dispatch use them before handing off messages or webhooks. flowchart LR
A[Scheduled one-shot] --> B[SQLite run receipt]
B --> C[Delivery-attempt fence]
C --> D[Message or webhook handoff]
B --> E[Restart recovery]
E --> F{Attempt state}
F -->|Not started| G[Recover job]
F -->|Started or unknown| H[Hold for inspection]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the run receipt as the single durable attempt owner, replay only exact never-started one-shots, and present ambiguous interrupted jobs for recipient inspection before any manual retry. Do we have a high-confidence way to reproduce the issue? Yes at the source boundary: current main still replays interrupted one-shots without checking delivery attempts, and the PR records a frozen-main negative control that duplicated delivery. This review did not execute a current-main live-recipient reproduction. Is this the best way to solve the issue? Yes. Recording a monotonic attempt fact in the existing receipt and checking it at recovery and handoff is a coherent single-owner repair; the conservative Unknown outcome matches the accepted storage decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b1b1f19f7d3a. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (26 earlier review cycles; latest 8 shown)
|
bf00fbc to
b168e7b
Compare
|
P-04 accepted storage decision — September 27, 2026. This records the campaign lead’s explicit task approval, granted before implementation, for the reviewed durable delivery-attempt fence and its SQLite schema/content-version migration. The lead separately clarified that approval does not cover an OpenClaw release, package, or protocol version bump. This is a record of existing authority, not a new approval or a merge request.
The approval covers the persistence and conservative recovery design above. It does not waive CI, independent review, upgrade-evidence limits, or authorize merge, queue, or automerge. |
|
@clawsweeper re-review Exact product head Product bytes remain unchanged. Qualification harness |
|
🦞👀 Re-review progress:
|
818dd85 to
55a2bc6
Compare
|
@clawsweeper re-review Please review exact head Preserve the accepted published schema18→20/Doctor/two-restart witness 36367832126 at product818dd85 as compatibility evidence: schema, migration, recovery, and fence-owner bytes are unchanged. It was not rerun or relabeled as current-head process execution. GitHub reports MERGEABLE; exact-head CI is running. Review only; no repair, merge, queue, or automerge requested. |
|
🦞👀 Re-review progress:
|
55a2bc6 to
5ec5ddc
Compare
875c597 to
65862a0
Compare
…w#159873) * fix(cron): prevent duplicate one-shot delivery after restart * fix(cron): include delivery migration in PR wrapper closure * fix(cron): reconcile restart tests and delivery execution * fix(cron): scope completion authority to background commits * fix(cron): retain synchronous webhook delivery authority
What Problem This Solves
Prevents duplicate one-shot cron announcements/webhooks after recipient acceptance, a lost acknowledgment, and Gateway restart. Attempted or ambiguous interrupted deliveries remain disabled with Unknown, including delete-after-run jobs. Proven never-started runs recover.
Why This Change Was Made
The existing SQLite cron receipt owns a monotonic attempt fact committed through the worker before delivery. Recovery replays only the exact
not-startedreceipt. Current-session completion carries cron authority explicitly into the background-result commit guard, preserving ordinary child-session admission.This refresh rebased once because GitHub reported CONFLICTING / DIRTY at
875c597535f5acb47ffdc4370fbe358e85ed04a5. Frozen base:3d3a11c401f9817c61531ad0781e7c14c08dd80c; rebased head:8ddd02e038bee1d2e345fa8186ade5c855a2adff; final head:65862a058521a48eb2195e341e0a7cf89e434b68.Conflict provenance, verified against each introducing commit's parent:
run-receipts.tsandtimer-job-runner.ts: 4a6d9aa0eae0 / #161935 moved current receipt checks to the read worker. Preserve that async owner, retained context, and post-await cancellation/liveness checks; compose the delivery-attempt fence before webhook dispatch.timer.test.ts: 0c0faf026cfa / #161661 intentionally retired the command-routing assertion that the prior branch updated. Preserve the retirement; the final file matches this base exactly.server-cron.ts: fb2052a33fd6 / #161007 moved the adjacent reconciler while this branch extracted completion helpers. Preserve main's subsequent watcher simplification from 3044ac325126 / #162010 and orphan-import removal d5e602f0bcf8; neither local helper is restored.Separate repair commit
65862a058521removes the now-async receipt-check fallback from the synchronous webhook final-authority callback. Receipt runs already have the synchronous delivery fence. Main's strict no-send/redirect uncertainty classification remains intact. No later-main drift was incorporated.User Impact
The approved persistence decision adds state schema 19 → 20, migrating legacy receipts to
unknown. Admission before transport can hold an unsent job after a crash; inspect the recipient before retrying. Retention, backup/rollback and older-reader refusal retain their owners. Older backups cannot reconcile later external deliveries. Arbitrary command/file/network effects and heartbeat/system-event handoffs remain outside this guarantee. Agent schema 24 and admission protocol 1 remain unchanged.Evidence
server.chat-command-context.test.tscases pass, including explicit non-mainsessions.create→chat.send→ final event →chat.historyplus model-context verification. Gateway, websocket and storage are real; the agent reply is mocked.git diff --checkpasses. The prior unrelated max-lines baseline failure no longer occurs on this base.scoped-cleanat P0/P1. Unchanged dependency internals were outside the isolated review bundle; the lead separately inspected the composed receipt/transport owners and ran their boundary tests.3d3a11c401f9817c61531ad0781e7c14c08dd80cthrough head65862a058521a48eb2195e341e0a7cf89e434b68: 239 chunks / 107,420 bytes, zero verified or unverified findings, credential verification disabled. The initial all-ref clone hit an unrelated missing promisor object; the supported trusted-local scan completed on the same exact range.65862a058521a48eb2195e341e0a7cf89e434b68. This terminal pass does not replace the cancelled CI lanes below.openclaw/ci-gate.security-fastpassed. This is not a green CI result; cancelled lanes remain unproven. Automatic ClawSweeper revision 22, run 36791215232, published its review on65862a058521a48eb2195e341e0a7cf89e434b68with no code/security findings. That recorded review required a schema-19 upgrade-evidence decision. All three separately authorized attempts are recorded below; attempt 3 now supplies a passing bounded installed-updater survivor cell for automatic exact-head review to reconcile. The Telegram-proof label remains: live recipient/provider proof remains absent, and this conflict-only refresh makes no Telegram-specific or live-delivery claim. No manual ClawSweeper review was requested.Non-attributable hosted failure and remaining CI limitation: Android test-third-party job 110139046107 ran 3,664 tests and failed only
ChatComposerLayoutTest.branchRowsRespectCanonicalOutboxScope:ComposeTimeoutExceptionafter 1,000 ms atapps/android/app/src/test/java/ai/openclaw/app/ui/chat/ChatComposerLayoutTest.kt:2736. This PR changes noapps/androidfiles.openclaw/ci-gateis only the downstream cascade of this Android failure. The test report artifact records thatsessions.branches.switchandchat.historyhad returned while switching remained active. This usesNodeRuntimeMode.ScreenshotFixtureand does not execute the cron/Gateway TypeScript path. The tested merge9fa1edc3dda91755d8cea3e1e345c3fe780dfa1bhas main parent6f91eda9c72d6b4c2640cb76b5a753e64089f6f2; its entire Android tree (24ccd43d160b9e755f8a6e174ea146ac126b01f0), CI workflow, actions and Android scripts match that parent. The failed test blob also matches this branch. The timeout's underlying cause remains unresolved; local same-order/standalone reproduction is unavailable because this host has no Java runtime. No Testbox/updater cell, CI rerun, re-push or timeout/assertion change was used to investigate the Android failure. The fail-fast monitor recordedfailure-cancelled; seven Node shards and five native/screenshot jobs were cancelled. No failure was attributed to the conflict repair. Current GitHub state at this exact head is open, ready for review and conflict-free (mergeable: true,mergeable_state: blocked); automerge is disabled. The blocked status is retained without changing the branch or claiming cancelled coverage passed.The previous exact head
875c597535f5acb47ffdc4370fbe358e85ed04a5passed CI run 36693460647 in 25m41s. Its ClawSweeper revision 20 history found no confirmed introduced code defect and retained the upgrade-evidence decision. These are prior-head evidence, not current-head passes. The prior branch's repaired spawn/heartbeat/requester-yield failures, historical negative control, broader focused cases and prior type checks remain recorded below.Attempt 1 — scratch-harness failure before product execution (retained): One authorized Testbox lease and one remote proof invocation were used; exit 1, with no retry or second cell. The task-owned
remote.shincorrectly requiredgit rev-parse HEADto equal the candidate SHA. The maintained receiver intentionally uses carrier commit749a259fb59d2ee69a09499ba98b30e80028a9c7as HEAD and separately verified source65862a058521a48eb2195e341e0a7cf89e434b68, tree558c8f94238de33c9e4d30aae43365f7503c1d33, before handing off. The wrapper's incompatible guard caused the failure; this is not a product failure or evidence of incorrect synchronized source.blacksmith-testbox, profileopenclaw-check, Linux; leasetbx_01m3tcnn4m749w794706yepe0a; run 36794676517. Managed Crabbox 0.67.0 / Blacksmith 0.4.62. Hydration workflow SHA33ae32bfc1d533d1cdcd6b3dc7cbd2605c423e0a; selected maintained tooling SHA7db2084787edbc63b585badc8fe41beaa0d03d89.65862a058521a48eb2195e341e0a7cf89e434b68, manifest version2026.9.7; no candidate tarball was built. Published baseline registry metadata:[email protected], tarball, integritysha512-/8N2LnfTFQPvnZizi8qKSFfnLQaPvSG3Cb4xo1YV7b4JhYiUc43ZNRpXJ01bWghLK0Ezk3HVeo/DGHcIRQwRWA==. The published package was not installed during this attempt.OPENCLAW_CRABBOX_WRAPPER_IGNORE_REPO_BINARY=1 node scripts/crabbox-wrapper.mjs run --id tbx_01m3tcnn4m749w794706yepe0a --keep --timing-json -- bash -c <hash-bound scratch transport>. Warmup 7.799 s; source preparation 32.913 s; delegated command 60.874 s, delegated total 61.197 s, wrapper elapsed 66.614 s. These are preparation/command timings, not updater-cell timings.5ffe45a47184c2f932ee8073cf054153e87be7f959d1a2d71c1605b4abeccec6. It contains the command wrappers, receipt helper, maintained runner prefix/source hash, result, and observed receiver/timing lines.remote.shSHA-256668e74bc266b2ee4295e95ebd1aa931059ffc98c7c2e11eb2301ffa066a4c1e9;cell.shSHA-256823bf8a00c8418549bca9f82bc7cfa379f08b843f827a3c1cf0ae5a6d987a9c1. The broker download link expires October 8, 2026 at 00:17 UTC.Attempt 2 — authorized corrected rerun; partial product proof, terminal harness failure (retained): Exactly one new configured-provider lease and one cell ran. Exit 1 at
preserved-after-doctor; no retry. The published updater successfully installed the exact candidate, schema 19 → 20 and installed payload identity passed, and standalone Doctor completed. The scratch helper then used strict deep equality on a freshnode:sqlitenull-prototype column row versus its JSON-restored ordinary-object snapshot (receipts.mjs:213). The retained assertion reports identical schema, job and receipt values; only the column object's prototype differs. This is a task-owned harness assertion defect, not a demonstrated product or infrastructure failure. The cell remains failed.blacksmith-testbox/openclaw-check, Linux; leasetbx_01m3tdvafnxc9am2gm0qmn1r92; run 36796432375. Crabbox 0.67.0 / Blacksmith 0.4.62. Hydration workflow SHA588b5d7d50b78250148110f070d9deb55f4ace1d; maintained tooling SHA7db2084787edbc63b585badc8fe41beaa0d03d89. Receiver and corrected guard agreed on candidate65862a058521a48eb2195e341e0a7cf89e434b68, tree558c8f94238de33c9e4d30aae43365f7503c1d33, carrierc26746ea3813c165296da6f74737f1dbc9cc6872.remote.sh's invalid HEAD guard and its checksum changed; local syntax and carrier/wrong-tree/wrong-ref probes passed before allocation. Correctedremote.shSHA-2565a96badd56f8e7390345a4a0261d413024b2c74462d6fe7588b21da9a3fa5ae7; unchanged cell SHA-256823bf8a00c8418549bca9f82bc7cfa379f08b843f827a3c1cf0ae5a6d987a9c1. The launch environment supplies the maintained packer's supportedGIT_COMMIT=65862a058521a48eb2195e341e0a7cf89e434b68input; package and installed-file identity checks confirm that candidate. The restored collector's historical lease constant is explicitly distinguished from this execution in the outer evidence envelope.[email protected]tarball/integrity listed above was downloaded, verified and installed; baseline build commitc074824a27c96d3983043f9eeb33823cd1772d8c, tarball SHA-2561b4746d9dfe1768e73da849e824172140f1a71b6edde3f7625f70477a73f83f7. Its Doctor created genuine schema 19 withoutdelivery_attempt_state; two legacy announce/webhook receipts were seeded. Its shipped updater used the maintained local registry to install candidate version2026.9.7, tarball SHA-256e78739f73bed593920f6b7a155b344cfe1ab789a5571b6ef00d0a05af541a2fa, integritysha512-mVZ54IfgHwboPfwi3v7Pz8LAGASuGTcGEpJce0/7279SFTBYwXhZLPDl1yNY/8vexgz040msuhCjhq9CF3KVsg==. Both original receipts survived withdelivery_attempt_state=unknown; schema metadata/column checks passed. Post-Doctor assertion data still show those same two receipts/jobs; jobs remain enabled/running at this pre-recovery stage.OPENCLAW_CRABBOX_WRAPPER_IGNORE_REPO_BINARY=1 node scripts/crabbox-wrapper.mjs run --id tbx_01m3tdvafnxc9am2gm0qmn1r92 --keep --timing-json -- bash -c <hash-bound transport.sh>. Warmup 7.582 s, package 466 s, cell 201 s, installed updater 167.332 s, standalone Doctor 8.327 s, wrapper 785.666 s, launch wall 796.969 s (2026-10-01 00:29:37–00:42:54 UTC).7a1b19f174b62b300b6c70e26c56aa48c6c331c423de94215b00c849ac5e00ad; link expires 2026-10-08T00:45:27Z. It includes both attempts, exact source delta/hashes, preflight, phases, package identities, sanitized updater result, full synthetic assertion, and read-only prototype diagnosis. All evidence downloads completed; one native stop call completed and lease status is completed, with no runner IP. Task-owned local scenario/tooling scratch, downloaded raw logs, and this attempt’s local capture were removed after publication and download/hash verification; prior campaign evidence remains preserved. Product checkout and protected Mainframe Gateway remain unchanged.Attempt 3 — full bounded schema-19 installed-updater survivor cell PASS: Exit 0, exactly one newly authorized lease and one full cell, with no retry. The unchanged published
[email protected]updater installed exact candidate65862a058521a48eb2195e341e0a7cf89e434b68; genuine schema 19 → 20, standalone Doctor, both isolated Gateway starts, and all receipt/job assertions passed.7a1b19f174b62b300b6c70e26c56aa48c6c331c423de94215b00c849ac5e00ad. The observed SQLite column row is spread into ordinary value data before strict comparison, retaining schema-19nulland every field/value. Onlyreceipts.mjsand its owned checksum changed; all other scenario files and the launcher are byte-identical to attempt 2. Helper SHA-256fd156031b7e25ca139ca315dca896f5316fd839a0ebac307ebafbdc57970da3d. Before allocation, the original prototype-only comparison failed as expected, normalized equality passed, and changed receipt state, delivery-attempt state, job value, schema value, and column value all failed. Independent inspection confirmed no weakened assertions or production seam.blacksmith-testbox/openclaw-check, Linux; leasetbx_01m3tf0qrzb6s5bzdh2nqmsfa4; run 36798116956. Crabbox 0.67.0 / Blacksmith 0.4.62. Hydration workflow SHA0338bb3adbafa24f8887e169634169ae60d690af; maintained tooling SHA7db2084787edbc63b585badc8fe41beaa0d03d89. Receiver and unchanged carrier-aware guard independently agreed on candidate65862a058521a48eb2195e341e0a7cf89e434b68, tree558c8f94238de33c9e4d30aae43365f7503c1d33, carrier91caaf581013aef25afb5b5a3af1725d3220256d. The unchanged launch environment retains the maintainedGIT_COMMITcandidate binding; candidate and installed application payload identities match.[email protected], tarball, integritysha512-/8N2LnfTFQPvnZizi8qKSFfnLQaPvSG3Cb4xo1YV7b4JhYiUc43ZNRpXJ01bWghLK0Ezk3HVeo/DGHcIRQwRWA==, SHA-2561b4746d9dfe1768e73da849e824172140f1a71b6edde3f7625f70477a73f83f7, build commitc074824a27c96d3983043f9eeb33823cd1772d8c. Exact-candidate package version2026.9.7, SHA-25644f03343b9b239856516e26052a095810201fb1f033a5a50ac2f31080991dfac, integritysha512-2HFLGLtsmmQ9Vn1L5Tf5YO32Ooodl0n+VXftuMTwpeA8EhHbcMPBd1ICpN3b3WRCxygPNH7s6HTEwRLsZmu3Zw==, build ID2026.9.7-65862a058521-2026-10-01T00-52-24.413Z.unknown; standalone Doctor preserved the migrated snapshot exactly. Two candidate-nativestartedannounce/webhook fixtures and one eligiblenot-startedsystem-event control were then added under schema 20. Across two distinct Gateway start/probe/recovery/stop sequences, all four held jobs stayed disabled with Unknown,lastDelivered=false, and exactly their original interrupted receipts—no replacement receipt or duplicate recovery delivery. The eligible control produced exactly one successful replacement receipt and became disabled withnot-requesteddelivery. Final state: 5 jobs / 6 receipts; the first and second settled snapshots are exactly equal.OPENCLAW_CRABBOX_WRAPPER_IGNORE_REPO_BINARY=1 node scripts/crabbox-wrapper.mjs run --id tbx_01m3tf0qrzb6s5bzdh2nqmsfa4 --keep --timing-json -- bash -c <hash-bound transport.sh>. Warmup 7.161 s, package 489 s, full cell 223 s, installed updater 174.152 s, standalone Doctor 8.978 s; first/second Gateway start phases 4.673 / 4.679 s. Wrapper 851.671 s, launch wall 862.784 s (2026-10-01 00:50:14–01:04:36 UTC).6b4b6aa766937d714c0c59fd7ebe4cb729b253c943be1cb4e00ce80a269c73c2; link expires 2026-10-08T01:06:05Z. It contains all three attempts, exact source delta/hashes, pre-allocation positive/negative probes, phase records, package identities, final receipt/job snapshots, and sanitized updater output. The restored collector's historical lease constant is explicitly distinguished from this run in the outer envelope. One native stop call completed; lease status is completed, with no runner IP. Task-owned scenario, transport, downloaded raw evidence, and publication scratch were removed after download/hash verification; this successful invocation left no local wrapper capture. Prior campaign evidence remains preserved. Product checkout and protected Mainframe Gateway remain unchanged. These are synthetic destinations: no live recipient/provider delivery is claimed. The started/not-started controls were deliberately added after migration because schema 19 lacks their new column.Historical upgrade witness: Package Acceptance run 36367832126, survivor lane 249 s (workflow 20m11s), product
818dd85ae1892e4d63cd431ee00d3baff8e66be2, harness6615bbd751b238de2a4bdc1b9f2662244f372987. Published[email protected]created schema 18; its unchanged installed updater migrated preserved announce/webhook receipts to 20/unknown. Doctor and two isolated Gateway starts retained disabled Unknown jobs without replacement receipts. Sanitized artifact.The migration, recovery kernel, receipt-delivery and delivery-fence source files remain byte-identical to that tested product. This is historical compatibility evidence, not current-head whole-product/process or live recipient/provider qualification. Current evidence status: the requested published v2026.9.7/schema-19 installed-updater → exact-candidate/schema-20, Doctor, and two-start survivor cell now passes. Attempts 1 and 2 retain their actual harness failures above; neither is relabeled a pass. Automatic exact-head review can reconcile the new immutable evidence without a manual ClawSweeper request. Live recipient/provider evidence remains absent; the non-attributable Android failure and cancelled CI coverage retain their stated limits. No branch push, merge, queue, or automerge action was taken.
Retained prior-head validation details
sessions.create→chat.send→ final event →chat.historyverifies the persisted exchange. Gateway, websocket and storage are real; the agent reply is mocked.0a0a2e048902/ test(core,plugins): remove low-value tests (batch d108) #161689 shortened the test and removed its suppression. Checker/helper/baseline/test blobs exactly match this pinned base (20.22 s). The earlier vision-test baseline was fixed upstream by1087139f5fb.