Repository navigation
refactor(cron): hold message authority for remaining transports and delete the native checker (cron 2b/3) - #165129
Conversation
Bind prepared effects to exact receipt facts and the existing Gateway-owned FIFO. Keep repeatable assertions separate from one-shot native initiation, and release exclusion before awaiting the provider response. Allow a use to borrow its own gate for consumption while preserving native publication and settlement. Closing retires unused effects and joins accepted borrowed persistence independently of scheduler cancellation. This additive interface supports the message and standing-grant cutovers; it does not activate either consumer or change schema, retention, or policy.
Recheck standing-grant expiry after receipt publication and retain the caller's live approval scope while persistence settles independently. Permit only guarded consumption of an already-recorded handoff during close. Align fixtures with async database custody and the single Gateway writer, preserve admission identity during receipt-loss injection, and keep generic detached-exec tests from cold-loading an unrelated channel runtime. Receipt semantics, eligibility, schema, ledger, retention, and released SDK signatures remain unchanged. Final-head published-driver update proof is still a merge precondition for #164805.
Merge main to resolve the Gateway close-prelude conflict while retaining cron receipt admission sealing before scheduler cancellation and main's model-account shutdown fence and settlement join. Focused real-close proof: cron receipt publication/finalization and an accepted personal model-account write both pass (2 tests, 521.35s wrapper wall on the loaded local host). Receipt semantics, eligibility, and storage schemas are unchanged.
Wait for the saved dashboard row publication before deliberately closing its database for the durability probe. Retain every close/reopen and live-authority assertion. Full owner file: 34 passed, 241.25s wrapper wall; fresh P2 review clean.
Merge main through 8cabfb2, including the three read-admission fixture fixes proved while investigating this PR's CI. The merge is conflict-free; only worker-access documentation overlaps the cron-specific delta, preserving both sections. The cron receipt-authority delta and package manifests remain unchanged by this integration. The main repair reproduced all three failures five times each, then passed 89 tests, scoped checks, and P2 review. The earlier close-prelude resolution passed both real-close regressions, and the dashboard drain passed its full 34-case owner file. Final-head package/update and standing-grant proof remain required before merge.
…4906) Keep unguarded Discord fetch callbacks on their existing two-argument path. Cancel Telegram's deferred request through its AbortSignal when authority refuses initiation, so unread uploads are cleaned up and the original local-authority error survives retries without being wrapped twice. The real HTTP regression fails before the repair on unread upload cleanup and refusal identity. Focused Discord/Telegram proof passes 108 tests; the suppression inventory passes 4 tests. Extension production/test types, targeted lint, formatting and the raw-channel-fetch guard pass.
Complete the bundled message transport cutover and remove the native current-job checker. Preserve exact receipt authority, release at SDK or CLI initiation, and retain refusal identity. Shared SQL kernels remain worker or Doctor owned.
Keep the Nostr handoff fixture generic without a cast and document the WhatsApp SDK initiation window.
|
🦞👀 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. |
|
@clawsweeper re-review Please review head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review All requested behavior proof is complete for |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…elete the native checker (cron 2b/3) (openclaw#165129) * refactor(cron): publish receipt authority from the Gateway owner * fix(cron): preserve SDK admission factory contracts * fix(cron): settle receipt authority before releasing close custody * refactor(cron): add held receipt authority uses Bind prepared effects to exact receipt facts and the existing Gateway-owned FIFO. Keep repeatable assertions separate from one-shot native initiation, and release exclusion before awaiting the provider response. Allow a use to borrow its own gate for consumption while preserving native publication and settlement. Closing retires unused effects and joins accepted borrowed persistence independently of scheduler cancellation. This additive interface supports the message and standing-grant cutovers; it does not activate either consumer or change schema, retention, or policy. * fix(cron): retain approval authority through publication Recheck standing-grant expiry after receipt publication and retain the caller's live approval scope while persistence settles independently. Permit only guarded consumption of an already-recorded handoff during close. Align fixtures with async database custody and the single Gateway writer, preserve admission identity during receipt-loss injection, and keep generic detached-exec tests from cold-loading an unrelated channel runtime. Receipt semantics, eligibility, schema, ledger, retention, and released SDK signatures remain unchanged. Final-head published-driver update proof is still a merge precondition for openclaw#164805. * test(sessions): drain publication before durability close Wait for the saved dashboard row publication before deliberately closing its database for the durability probe. Retain every close/reopen and live-authority assertion. Full owner file: 34 passed, 241.25s wrapper wall; fresh P2 review clean. * refactor(cron): hold message authority through core transport initiation * refactor(cron): define held-use refusal in a shared error leaf * style(cron): disambiguate authority callback bindings * fix(cron): preserve transport refusal and cancellation semantics (openclaw#164906) Keep unguarded Discord fetch callbacks on their existing two-argument path. Cancel Telegram's deferred request through its AbortSignal when authority refuses initiation, so unread uploads are cleaned up and the original local-authority error survives retries without being wrapped twice. The real HTTP regression fails before the repair on unread upload cleanup and refusal identity. Focused Discord/Telegram proof passes 108 tests; the suppression inventory passes 4 tests. Extension production/test types, targeted lint, formatting and the raw-channel-fetch guard pass. * refactor(cron): hold authority across remaining transport handoffs Complete the bundled message transport cutover and remove the native current-job checker. Preserve exact receipt authority, release at SDK or CLI initiation, and retain refusal identity. Shared SQL kernels remain worker or Doctor owned. * test(cron): preserve generic authority fixtures Keep the Nostr handoff fixture generic without a cast and document the WhatsApp SDK initiation window. * test(cron): normalize transport authority regression fixtures * test(clickclack): isolate authority handoff regressions * test(nostr): observe the production relay handoff * test(cron): keep Synology handoff cases lint-clean * docs(cron): remove superseded native-checker migration note * fix(cron): clear receipt cutover lint and documentation gates Bind the loopback socket writer's call to the original method, retaining the socket receiver, and remove shadowed bindings. Regenerate the assertion baseline after the LINE cleanup removes one assertion. Remove the remaining obsolete statement that final message SQL guards await migration. The IRC owner tests pass (41 tests, 69.26 seconds overall), and the bounded P2 review is clean. The assertion baseline shrinks by exactly one. Local type-aware lint stopped at declaration preparation's 300-second timeout; the Linux full changed check remains required before merge. * test(cron): bind native write faults after socket connection Scope the IRC fault to the real client socket, install it after Node's connect restores write, and preserve the method's boolean return type. Synchronize and restore Node's connection-factory exports around the fixture. Use the canonical Teams channel-result helper when aggregating earlier receipts. Validation: all 22 IRC client tests pass (46.70 seconds overall), all 26 Teams outbound tests pass (131.13 seconds overall), and the bounded P2 review is clean. The full Linux changed check remains required before publication.
What Problem This Solves
Remaining bundled message transports could pass a synchronous cron check, await preparation or a queue, and call their provider outside held authority. The native current-job reader also kept receipt SQL on the Gateway thread. Chunked sends could lose evidence of earlier accepted messages when a later chunk failed or was refused, inviting duplicate delivery on retry.
User Impact
Scheduled message operations retain authority through their SDK, CLI, or native handoff. Twitch and IRC raw batches are admitted before their first send. Transports with required application waits keep live checks per request, and later refusals, transport errors, or delivery-observer failures preserve accepted receipts as partial delivery. The dedicated Zalouser tool exposes that outcome too.
Schemas, stored bytes, retention, durability, force-disabled eligibility, execution revisions, and released synchronous callback signatures are preserved. No migration or new configuration is required. The effect-scope helper is additive. This adds zero
OPENCLAW_*names. Cron writes use the serving Gateway; direct concurrent SQLite mutation is outside the supported contract.Required current-head behavior proof is complete, and GitHub CI is green. Native exact-head review and merge admission remain authoritative.
Why This Change Was Made
Complete the cron 2a held-use cutover across remaining transports. Capture the originating scope before queues, prepare authority after application preparation, invoke the SDK/CLI/native operation synchronously inside the held use, and release before awaiting its response. Twitch and IRC precompute their synchronous batch and admit it once; acquiring multiple retained uses upfront would deadlock the owner's FIFO. Required application waits and retries retain fresh per-request checks.
Delete
createServiceCronRunMessageAuthorityCheckerandreadCronRunReceiptCurrentJob. Synchronous guards consume the receipt owner's published facts; preparation stays with the shared-state worker and physical-store/FIFO owner. Main's standing-grant authority binding is preserved. Refusals keep their original cause and no-dispatch metadata and stay outside provider retry paths. Matrix retains its requiredAbortErroradapter because its SDK converts other fetch errors into retryable connection failures.The initiation boundary remains the provider SDK/CLI handoff. The table in
docs/plugins/sdk-channel-plugins.mdrecords remaining library windows, including Baileys processing, iMessage's spawn broker/bridge, Twurple's limiter, relay connection promises, and Teams token/Axios work. No dependency patches are introduced by this PR.Published head:
4741f40d6f47252ffda483a957679c50f6995f8e. Main integration:5721d8eb0e6cae9b0818675be2b583acd8b81f91, merged without rebasing. Related overlap: #164906, #162433, and #135889. This does not adopt #112375 or expand Gateway skill-trust policy.Production: +703 / −321 / net +382, 1,024 changed lines, within the 1,300-line limit. The 74-file diff contains 38 production files, 31 test files, two docs, and three tooling/baseline files. Mock and assertion baselines remove obsolete allowances; no exception was added.
Retained SQL contracts
At the original lane baseline, T1 decreased 895 → 893, with 2,540 inventoried SQL expressions. The host caller is deleted; two shared kernels remain necessary.
readActiveCronRunReceiptsInDatabaseremains worker-only for current receipt/recovery, admission, and maintenance.loadCronRowsremains in worker kernels and Doctor legacy-repair, store-repair, and heartbeat-migration one-shots. Their classifications change from T1 to W/T3 with caller evidence; this is not a claim that the SQL expressions were physically deleted.No other-owner host SQL was found inside the grant/checker path touched here: availability consumes worker-provided deletion facts and remaining local guards are in memory. Broader unchanged callbacks are not claimed SQL-free. The unrelated standing-grant generation read stays with its owning lane.
Evidence
Focused commands use
node scripts/run-vitest.mjs <files> --maxWorkers=1, the repository entrypoint equivalent topnpm test <files> --maxWorkers=1. Wall times include compiler/import preparation. The final-head CI run took 469 s wall time; its successful jobs total 9,740 s (the sum includes checks and builds, not only tests).[email protected]error contract. Original refusal identity remains in the cause chain whileAbortErrorprevents SDK retries. A fresh final-delta P2 review after the IRC/Teams CI fixes is also clean.v2026.9.8SDK exports, runtime surfaces, and bundled public barrels. Removed current-job reader and IRC client send method are internal;withEffectAuthorityis additive. No released signature change requires a compatibility record. The generated final-head report is checked: 128 reachable export changes, zero direct declaration or kind changes, zero entrypoint additions/removals; the sole changed reachable declaration addswithEffectAuthority. Report digest:108123b7b77d8327e6f6b2f660a9c1e72fc5c85d511750a4af15bcfab31f3490.4741f40d6f47252ffda483a957679c50f6995f8ein isolated Linux arm64 / Node 24.21.0 against base5721d8eb0e6cae9b0818675be2b583acd8b81f91. All selected guards, core/extension types, lint, dead-export scans and import-cycle checks completed; no skips or exceptions.4741f40d6f47252ffda483a957679c50f6995f8e; 89 jobs, no failures, CI gate succeeded.e0f87934d33ca10697459d69b66c4b1c395a211f62917aaf894fd80adecf0b57. The build reported a non-fatal UI startup gzip warning (365.1 KiB vs 364.7 KiB); UI and build/dependency inputs are unchanged in this PR./startupzand/readyz; real owner authority admitted six loopback HTTP calls, while stale captured authority and the original occurrence after restart produced zero calls. Pending mutations did not acknowledge/replay across the crash; the successor receipt admitted real I/O.2026.9.8and exact candidate4741f40d6f47252ffda483a957679c50f6995f8e: updater exit 0, durablefinished/succeeded, managed PID replacement, exact build identity, health and/readyz=200, durable history retained, incognito history absent. Whole cell: 450.847 s; update command: 371.630 s. Native tarball SHA-256:cab67c3f40f3a7e57651032954342344d95af3c3757abc6159123dc3ed4ff1b7. Diagnostic copies added only update-process Node report options; every original assertion and the 1,125 s cell deadline stayed unchanged. No signals were sent and no Node reports were produced.The earlier receipt-owner proofs cover publication-before-reply, commit-admission suspension, custody/ABA/store partitions, worker loss, exact occurrence identity, message/source separation, force-disabled behavior, direct/RPC preparation, retry/chunk boundaries, and real server close settlement. The separate killed-Gateway independent-client case now has current-head native I/O proof, described below.
ClawSweeper's stale synthetic Signal fixture qualification was repaired in openclaw/clawsweeper#1747, merged as
6e783d80e5177979744dbc72dd1f6a32c7f134d7. Only the exact table-row witness was added; scanning remains enabled. Native controls reject changed bytes and a foreign path, and the complete original PR source range passes scanning. ClawSweeper completed review of this exact head at2026-10-05T01:41:24.773Zwith no actionable code findings; it requested the runtime evidence now being completed.Existing follow-up: Zalouser credential persistence can fail after transport acceptance but before returning the current receipt (
extensions/zalouser/src/zalo-js.ts); this separate lifecycle path is unchanged. The repaired chunk owner preserves all receipts it has received.CI repair history: runs
37242475529and37245129202found PR-caused IRC test shadowing/unbound-method/type issues, a shrink-only assertion-baseline mismatch, and a Teams map-spread lint violation. The final candidate corrects those owners. The IRC regression binds the native socket write after connection because Node reconnect setup resets that method. No CI rerun or admin exception was used to hide these failures.Cross-process authority proof and fixture qualifications
Candidate: 4741f40
Case 7 passed: 10 cases in 72.276s on Linux with a synthetic local provider.
Both Gateway lifetimes reached startup completion and readiness before execution.
Job, grant, parent-decision and secondary-partition mutations did not acknowledge while an earlier real authority use held the interval.
Native HTTP: 6 allowed loopback collector receipts; stale captured authority after disable/re-enable produced zero additional requests.
Crash/restart: pending routed mutation lost its connection without acknowledgment or replay; persisted target stayed unchanged; a new actual receipt and owner admitted native HTTP.
Old occurrence in the new Gateway: production authority capture refused at prepare-use; receiptCurrent=false, nativeInitiated=false, collector delta=0.
Cleanup: 9 spawned child processes and 13 recorded descendants verified non-running; detached broker retirement was observed. Final Gateway shutdown exited 0.
Boundary: stock mutation RPCs and real worker/authority owners; the stale-carrier check uses a synthetic probe around the production capture entry, not the public message RPC signing envelope.
Prior attempts: corrected fixture config and approval-policy drift; an early pre-startup run was durably recorded as a failed agent-admission attempt (14ms). Its event-stream visibility remains unqualified. No product fix or baseline runtime equivalence is claimed.
Published-driver qualification: the initial virtualized Linux arm64 cell recorded successful activation and a healthy candidate, but timed out while the released updater remained alive 193 s after its terminal JSON. The released first hop retains older worker/runtime settlement paths; the candidate cannot replace that already-running code. The same assertions completed on native Linux, including command exit and post-update history checks. No product fix or exact blocking-resource diagnosis is claimed for the first host’s timeout.