Skip to content

refactor(cron): remove receipt custody before worker cutover - #168772

Merged
steipete merged 3 commits into
mainfrom
upd/upd-l1540
Oct 11, 2026
Merged

steipete merged 3 commits into
mainfrom
upd/upd-l1540

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Cron receipt custody serialized scheduler writes, approvals, and agent removal around held launch handles. Gateway shutdown also had to drain that second ownership layer.

Why This Change Was Made

This is PR 2a of the approved worker-owned cron design. The scheduling/launch step is split into 2a (remove custody and its consumers) and 2b (move timer, manual, and event scheduling to the worker together), followed by result/recovery consolidation.

Remove custody owners, attachments, publications, prepared-use handles, and dependent launch/read wrappers. Existing Gateway, run, tool, permission, approval-row, deletion, and transcript owners retain their checks. The host remains the sole scheduler.

The original importer proof also exposed a real-Gateway UI fixture that rebuilt the dirty checkout on every start, restart, and auth bootstrap. It now uses the prepared openclaw.mjs entrypoint, matching its sibling fixture, with unchanged assertions and timeouts.

The integration proof also found a stale cross-process read in the Dreaming restart E2E fixture. The Gateway had completed cleanup, but the test observed its own cached projection. Its initial cleanup assertion now uses the existing sessions.list RPC, preserving the cleanup and retention assertions.

The final importer run also exposed a stale Telegram poll test spy: production uses openKeyedStoreV2, while failure injection still intercepted openKeyedStore. The test now intercepts the current API and preserves its warning, absent-route, and no-resend assertions. No Telegram production behavior changed.

The CI follow-up repairs the native Gateway fork fixture: generated test code now lives under the repository Vite root, while config, transform cache, and runtime state stay isolated. The child config also inherits the shared Node environment. The missing-receipt probe still requires independent worker-exit proof before disposing its staged input.

User Impact

Scheduling, durable receipt accounting, and database format remain unchanged. Committed standing-grant consumption authorizes one start: revocation may race that already-checked launch; subsequent consumption observes revocation. Run liveness, host policy, expiry, and cancellation still gate initiation. The approval documentation states this accepted tradeoff.

No schema, dependency, config, or CLI changes. Updates and rollback require no data migration.

Refs #168072.

Evidence

Latest rebase: 509cd7ac96dda90966f7b3bf14998d2db09a3af1 on 90f04bfb10df3b55d7473b6519be8bbe8fab77a2. Pushed with --force-with-lease against a77f1ccca200cc516910f37621953e27d1cdcb02 after the conflict-only proof below. The lead reported that prior head's CI green except the known ci-gate.

Two conflicts resolved at their owners: message-action-turn-capability.ts keeps main's new prompt-reaction imports and behavior while removing the obsolete custody type/use hook; send.history.test.ts keeps main's bound openKeyedStoreV2 helper, superseding the PR's earlier unbound helper fix. The native-fork fixture commit rebased unchanged.

node scripts/run-vitest.mjs src/gateway/message-action-turn-capability.test.ts src/agents/tools/message-tool.current-prompt-reaction.test.ts extensions/telegram/src/send.history.test.ts --maxWorkers=1: 3 files, 49 tests passed, 150.74 s command wall time on Node 24.19.0. File wall times: 19.80 s, 31.59 s, and 50.70 s; transform/setup dominate these runs. pnpm check:madge-import-cycles: 0 cycles. Formatting and git diff --check passed. Proof was limited to the conflicted owners and their prompt-reaction integration, as requested; no CI wait or merge.

Earlier-head evidence follows.

Previous fixture-repair head: a77f1ccca200cc516910f37621953e27d1cdcb02. This CI repair is a normal push on top of f8753d34; the earlier integration was rebased and pushed with --force-with-lease. No merge was attempted.

Fetched all three failing node-job logs and checks-ui (2/3) once. The failing node files are test-helpers.acquisition.test.ts, server.sessions.fixture-lifecycle.test.ts, and server.startup-fixture-lifetime.test.ts.

Root cause and owner: the shared native fork fixture put fixture.test.ts outside its Vite root. Child reports show zero executed tests and Cannot find module '/@fs/.../fixture.test.ts', before the PID write or Gateway startup. The missing PID then correctly retained fixture inputs and resource claims. This reproduces on the exact PR base, so it is not caused by receipt-custody removal. The generated child config also omitted the shared Node environment, allowing Solid to choose jsdom. The repair fixes both at server.fixture-lifetime.test-support.ts, without changing production shutdown or weakening joins, assertions, timeouts, or retries.

Node 24.19.0 local comparison through node scripts/run-vitest.mjs, using explicit gateway-database-workers and gateway-server configs and --maxWorkers=1:

Source Acquisition file Native lifecycle/startup files
Exact base eec5e318ecaa 12 passed, 1 failed; 86.53 s command wall 7 passed, 5 failed; 80.96 s command wall
Original head f8753d34 12 passed, 1 failed; 83.06 s command wall 7 passed, 5 failed; 136.55 s command wall
Repaired source 13 passed; 124.56 s Vitest wall 10 passed, 2 timed out; 378.02 s Vitest wall

Remaining local proof limit: startup fixture ownership: public clean cleanup and retains fixture state and fences successors after a required Gateway close failure reached the existing 90-second child deadline. The captured startup diagnostic reports gateway.server-start-import beginning after 69,444.6 ms; fresh native source loading/compilation consumes most of that budget on this loaded host. The required-cleanup and kernel-cleanup cases passed in 67.412 s and 50.887 s, and the missing-receipt probe passed in 1.679 s. The acquisition fork passed in 37.808 s. These are recorded slow-fixture limitations, not a fully green native replay. Retained directories and resource claims were preserved; no join was bypassed.

UI is inherited from newer main. CI tested merge 40dd42d9 against f2e649da67fa909126980d88171e93f3f99d6f01, which includes the Sessions Solid migration f4d601a00613. session-row.tsx lost the previous missing-kind icon fallback; the unchanged scope-race fixture supplies archived rows without kind, producing the CI props.data.attributes/REACTIVITY_HALTED failure. The UI tree, test config, package manifest, and lockfile are identical between exact PR base and original head. sessions-page.scope-race.test.ts passes all eight tests on both (23.45 s / 15.94 s). A replay of newer main alone halted and was terminated by the existing no-output guard after 195.48 s. Local Bun is 1.4.2; CI used 1.4.3-canary.1, so this is not claimed as an exact-runtime reproduction. No UI changes are included.

node scripts/check-changed.mjs --base f8753d343f2910817e090021800498b1d177d5a5 -- <the two changed fixture files> passed formatting, ratchets, guards, and both affected test type graphs (gateway-root 24.1 s, gateway-server 20.7 s). It stopped at the full-tree dead-export scan: src/cli/run-main.test-support.ts: readActiveGatewayLockPortMock. That file and the entire CLI subtree are unchanged from the exact base; source inspection confirms the same unused export there. Production and script export scans passed with zero entries. The final planned targeted oxlint command was run separately and passed. No baseline or suppression changed.

pnpm check:madge-import-cycles: 0 cycles. git diff --check: passed. Fresh isolated Codex autoreview was unavailable (HTTP 401, no review report); the campaign fallback applies.

This follow-up changes 0 production lines and +23 / -14 test/support lines. Whole-PR production: +329 / -1,620 = -1,291 lines; tests/support: +187 / -1,822 = -1,635 lines. Counts classify test-helpers.server-lifecycle.ts as test support; the previous count placed its four deleted lines in production. No schema, dependency, config, or CLI option changes.

Previous rebase proof

Previous rebase: f8753d343f2910817e090021800498b1d177d5a5 on eec5e318ecaa95def03d5c27254d12db149856fa. This update rebases the PR again and is pushed with --force-with-lease against the previous head 87c4a173afe2ecc37bffa41725119da68947c991.

The single textual conflict was in docs/tools/exec-approvals.md: main's plain-language idempotency wording is retained, together with the approved distinction that revocation blocks subsequent consumption while an already-consumed use may still start. The production patch is unchanged. Main's newer shutdown-hook/cleanup ordering remains in place alongside receipt-custody removal. Both 3367a12c (Node environment) and 8267c240 (Solid imports in Node projects) are included.

Historical local proof on Node 24.19.0:

  • All 11 previously failing Gateway database-worker files passed: 90 tests, using the explicit test/vitest/vitest.gateway-database-workers.config.ts; 90.41 s command wall time. This includes local-request-context, worker-environments/transcript-commit, and internal-source-reply-persistence, plus the other eight failing files from the prior CI run.
  • 54 shutdown/standing-grant/receipt/agent-lifecycle owner and sibling files: 304 passed, six existing skips; 261.02 s command wall time. The skips are five Bun-only desktop transport cases (Bun was not selected) and one Linux-only shutdown case on this Mac.
  • Combined: 65 files exercised, 394 tests passed, six existing skips. No assertions, timeouts, retries, or platform skips changed.
  • pnpm check:madge-import-cycles: 0 cycles. oxfmt --check docs/tools/exec-approvals.md and git diff --check: passed.

Production remains +329 / −1,624 = −1,295 lines; tests/support +164 / −1,804 = −1,640 lines. No schema, dependency, config, or CLI change was added during this integration. No merge or CI rerun was performed.

Historical proof and diagnosis for the prior heads

Production: +329 / −1,624 = −1,295 lines. Tests/support: +164 / −1,804 = −1,640 lines. No baseline, ignore, or suppression changes.

Validation target: 87c4a173afe2ecc37bffa41725119da68947c991 on integrated base aec34bbde0f56a8fa50f5711f99c8a26508921e1.

Final-base proof exercised 527 distinct test files: 8,417 passing cases and one existing platform skip. All selected importer paths were observed in test output. The broad command retained one failing stale-spy case, corrected and rerun below; it is not presented as a wholly green invocation.

  • node scripts/run-vitest.mjs <526 selected owner/direct/one-barrel files> --maxWorkers=4: 8,031 passed, one failed, one skipped; 4,327.20 s wall time. The single failure was the stale Telegram poll spy described above.

  • Explicit routing of 20 selected files omitted by the broad mixed-project run: 349 passed; 443.57 s. This fills the omitted paths rather than counting selection as execution.

  • Unchanged extensions/codex/harness.test.ts --maxWorkers=1: 36 passed; 61.47 s wall time after main's canonical cache-settlement fix.

  • Corrected extensions/telegram/src/send.history.test.ts --maxWorkers=1: 29 passed; 64.11 s wall time; the write-failure case passed in 0.720 s.

  • The Dreaming fixture's repaired assertion passed through the real Gateway. Its single-worker probe took 78.82 s including preparation; on the final base its test took 64.045 s under the broader run.

  • pnpm check:madge-import-cycles: 0 cycles. git diff --check: clean.

  • node scripts/check-changed.mjs --base aec34bbde0f56a8fa50f5711f99c8a26508921e1: formatting, ratchets, core types, all core-test types, extension-test types, and root-test types passed. It exited at the dead-export scan after 1,465.33 s. An isolated archived copy of that exact main base reproduced identical findings in both production and full-tree scans (five each); both script scans passed. The remaining checks were run from the same native planner after that inherited failing step, reusing completed typecheck proof: All 12 remaining checks passed (787.38 s), including core/extension/script lint, schema/storage guards, runtime import cycles, webhook and pairing guards. No baseline, ignore, or suppression changed.
    Inherited export findings are captureSessionEntryMaintenanceAgeFact, SessionEntryMaintenanceAgeCapture, SqliteReclamationPreparedSource, GatewayApprovalEventPublisherV2, OpenClawAgentDatabaseWorkerCloseResult (production scan), and the UI helper reconnectGateway (full-tree scan).

  • Fresh isolated Codex autoreview was unavailable (HTTP 401, no report). The campaign's explicit fallback applies; the lead approved the substance of the earlier head.

Runtime preparation, real Gateway restarts, browser replay, and worker fixture setup dominate the known slow cases. Measured final-base test times include UI image replay 34.692 s and attachment replay 129.842 s; copied-session lazy cron harness 35.385 s; destination preparation/settlement/recovery 47.161/64.809/34.638 s; updater activation 30.221 s and canary reopen 37.039 s; memory semantic recall 36.248 s; Dreaming restart 64.045 s. These pre-existing integration suites were recorded under the campaign's slow-suite ruling; no timeout, retry, or assertion was weakened.

The first build attempt stopped before tests because this worktree lacked links for main's already-locked workboard Solid dependencies. pnpm install --frozen-lockfile --ignore-scripts restored this worktree's private installation; tracked dependency files stayed unchanged.

The lead approved the substance of previous head 1216af901792bb9337dfa010191a48201fca3890. This branch was rebased onto aec34bbde0f56a8fa50f5711f99c8a26508921e1 and pushed with --force-with-lease. The single textual conflict was the memory publication test observer: main already repairs command observation and supports its newer publication dispatch, so main's helper and call site are retained unchanged; the narrower PR-only memory fixture override was removed. Clean overlaps preserve main's async message discovery, post-await target-authority check, and SQLite admission/fact-exchange changes alongside custody removal.

An intermediate-base importer run reproduced a native-binding cache deadlock in extensions/codex/harness.test.ts (120.008 seconds). Main landed its canonical fix, 7cc1ca64798c, during this integration: comparison transactions no longer reuse stale cached rows, and native-binding settlement invalidates the affected keys. After rebasing onto that fix, the unchanged harness passed all 36 tests; the blocked case took 1.801 seconds. No speculative Codex test edits remain.

Prior-head evidence remains historical, not current-head CI: 618 unique test files exercised; focused owner proof passed 101 tests, with broader importer/owner proof passing 4,873 + 2,825 + 2 + 832 tests and the four memory-helper files passing 61 tests. check:changed passed with the dead-export scan run separately; its inherited findings were reproduced on original base 9cf7fc279c26cf3493b75e703aeadac6d0deb5ee. No baselines, ignores, or suppressions changed. Madge and runtime import cycles were zero.

Original fixture timings: UI cases failed at 180 seconds before the launcher repair, then passed in 30.696 and 83.369 seconds (162.26 seconds file wall; 241.23 seconds including preparation). The old memory observer deadlocked pruning at 240 seconds plus cleanup; that narrower fix is now superseded by main's observer.

No merge was attempted. Hosted CI attribution is recorded below.

CI attribution follow-up — head 87c4a173afe2ecc37bffa41725119da68947c991, run 38113595420.

Fetched the complete 150-check inventory and each of the seven failed shard logs once. They identify 11 failing Gateway database-worker files. CI tested synthetic merge 5ece9b70, which combines this PR with newer main 48a2b3d29bdb71792b5fa7fb97ca9450ac995ac6; that is later than this PR's merge base aec34bbde0f56a8fa50f5711f99c8a26508921e1.

The failures are inherited from main's test environment, not the receipt-custody removal. Main commit 74e8844382e9 adds controlUiSolidPlugin() to test/vitest/vitest.gateway-database-workers.config.ts without an explicit environment. The installed Solid plugin defaults unspecified test environments to jsdom. Native SQLite and worker byte arrays then fail realm-sensitive checks: config revision key is corrupt, Session history worker returned an invalid transcript frame, and fs-safe's Uint8Array validation. The implicated production validators are unchanged by this PR.

Local comparison through node scripts/run-vitest.mjs --config test/vitest/vitest.gateway-database-workers.config.ts <the 11 failing files> --maxWorkers=4:

Source Runtime Result Command wall time
Exact merge base aec34bbde0f5 Node 26.11.1 11 files, 90 passed 118.15 s
PR head 87c4a173afe2 Node 26.11.1 11 files, 90 passed 106.27 s
Exact merge base aec34bbde0f5 CI's Node 24.19.0 11 files, 90 passed 94.29 s
PR head 87c4a173afe2 CI's Node 24.19.0 11 files, 90 passed 85.80 s
CI's newer main base 48a2b3d29bdb without this PR Node 24.19.0 All 11 files fail: 49 failed, 7 passed, 34 skipped 96.07 s
Same CI base with temporary environment: "node" in the database-worker project Node 24.19.0 12 files, 91 passed, including the explicit-jsdom UI auth-readiness integration 117.30 s

Canonical correction: explicitly set environment: "node" in createGatewayDatabaseWorkersVitestConfig, retaining the Solid transform and the UI test's own jsdom annotation. The correction probe changed no production code, assertions, timeouts, or retries and has been reverted. PR source and head remain unchanged. A broader exact-group replay on the older base was stopped after passing progress once the different CI merge base was identified; it is not claimed as a completed pass. CI remains red until the main test-environment correction lands. No CI rerun or merge was performed.

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: memory-core Extension: memory-core agents Agent runtime and tooling extensions: qa-lab size: XL labels Oct 11, 2026
@steipete
steipete marked this pull request as ready for review October 11, 2026 01:06
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR removes cron receipt custody and its consumers while retaining host scheduling and durable run receipts.

Example: An operator revokes the daily-report standing grant after its first use commits.

  • Before: Revocation waits for the retained launch interval to settle.
  • After: Revocation can finish before that consumed use starts; subsequent consumption is refused.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The approved reduction has substantial supporting tests, but reachable authority defects and absent final-effect proof prevent readiness.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Refactor · Worth it: Yes
User problem: Cron coordination adds a second ownership layer around scheduler writes, approvals, removal, and shutdown.
Reason: The maintainer-directed design supports removing this layer and explicitly accepts the consumed-launch race while preserving independent permission checks.

Merge readiness

⛔ Blocked before merge - 6 items remain

Keep open: this PR implements an approved simplification, but two authority regressions and a stale SDK contract remain actionable.

Priority: P1
Reviewed head: 509cd7ac96dda90966f7b3bf14998d2db09a3af1

Before merge

  • Add real behavior proof - Authority-chain proof required: the complete body supplies extensive test and Gateway-fixture results, but no after-fix final-effect trace proves allowed operations and rejection of withdrawn or replaced authority through the surviving message, approval, and transcript owners. Include lost committed permission-update replies and delayed transport initiation while preserving the accepted consumed-launch race; terminal screenshots or request logs should redact credentials, IPs, phone numbers, and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Preserve permission revocation after a committed reply is lost (P1) - If cron.update removes message permission while a run is active, the worker can commit and lose its successful reply. runCronRuntimeMutation then skips publish, so jobs-mutation-persistence never calls publishCronRunReceiptMutation; unknown settlement only invalidates the loaded store. The replacement isCurrent callback checks admission and agent availability, not current job permissions, so that occurrence can continue using its captured message authority. The deleted owner reconstructed committed facts after settlement and had a regression for this exact lost-reply case. Preserve invalidation or reconciliation in the surviving permission owner independently of reply delivery.
  • Carry the scheduled assertion to final provider initiation (P1) - Replacing effect initiation with an unconditional callback removes the final check from consumers that relied on the captured scope. For example, a scheduled Twitch send enters twitchOutbound.sendText, then TwitchClientManager.sendMessage awaits getClient. If message permission is removed while connection preparation is pending, the active marker is revoked, but the adapter carries no assertDirectAdapterHandoff into the subsequent client.say batch and this helper now invokes it without checking authority. The send therefore occurs after withdrawal. Carry the existing synchronous scheduled assertion through preparation and invoke it at the SDK handoff; no held custody interval is needed.
  • Update the SDK guide for custody-free effect handling (P3) - The unchanged SDK guide tells adapters that captureEffectAuthority restores a captured scope, acquires fresh held uses, releases an interval at provider initiation, and serializes uses through FIFO. This PR makes that exported helper unconditional, so following the documented contract no longer supplies those guarantees. Update the guide to describe the surviving synchronous authority checks and their propagation through queues and preparation.
  • Resolve security concern: Durable permission withdrawal can miss its live consumer - A committed permission change must retire the active occurrence's authority even when its response is lost; stored withdrawal currently does not reach the surviving live guard.
  • Resolve security concern: Transport preparation can outlive scheduled authorization - The nearest forbidden operation is a previously allowed scheduled send whose message permission was withdrawn during preparation; Twitch can still reach the external SDK handoff.

Findings

  • [P1] Preserve permission revocation after a committed reply is lost — src/cron/service/run-receipts.ts:106-109
  • [P1] Carry the scheduled assertion to final provider initiation — src/shared/effect-authority.ts:8-9
  • [P3] Update the SDK guide for custody-free effect handling — docs/plugins/sdk-channel-plugins.md:776-782
  • [high] Durable permission withdrawal can miss its live consumer — src/cron/service/run-receipts.ts:106
  • [high] Transport preparation can outlive scheduled authorization — src/shared/effect-authority.ts:9

Tests

  • Missing end-to-end proof: Supply final-effect traces for allowed and withdrawn scheduled authority, lost committed permission replies, delayed transport preparation, and upgrade/restart with existing jobs and grants intact; those scenarios are not established by the supplied suite results.
Agent review details

How this fits together

The Gateway schedules cron runs and supplies their tool authority; shared-state workers persist jobs, receipts, and approvals, while channel transports and process launchers perform effects.

flowchart TD
A[Host scheduler] --> B[Cron run admission]
B --> C[Tools and approvals]
C --> D[Shared state worker]
D --> E[SQLite state]
C --> F[Transport and process effects]
Loading

Technical review

Best possible solution:

Remove custody while preserving permission invalidation independently of reply delivery and carrying existing live assertions to final transport effects.

Do we have a high-confidence way to reproduce the issue?

Source establishes both failing paths, supported by the removed lost-reply regression and Twitch's awaited preparation; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The approved simplification is appropriate, but the surviving permission and transport owners must retain their actual checks without restoring the removed custody machinery.

Full review comments:

  • [P1] Preserve permission revocation after a committed reply is lost — src/cron/service/run-receipts.ts:106-109
    If cron.update removes message permission while a run is active, the worker can commit and lose its successful reply. runCronRuntimeMutation then skips publish, so jobs-mutation-persistence never calls publishCronRunReceiptMutation; unknown settlement only invalidates the loaded store. The replacement isCurrent callback checks admission and agent availability, not current job permissions, so that occurrence can continue using its captured message authority. The deleted owner reconstructed committed facts after settlement and had a regression for this exact lost-reply case. Preserve invalidation or reconciliation in the surviving permission owner independently of reply delivery.
    Confidence: 0.99
  • [P1] Carry the scheduled assertion to final provider initiation — src/shared/effect-authority.ts:8-9
    Replacing effect initiation with an unconditional callback removes the final check from consumers that relied on the captured scope. For example, a scheduled Twitch send enters twitchOutbound.sendText, then TwitchClientManager.sendMessage awaits getClient. If message permission is removed while connection preparation is pending, the active marker is revoked, but the adapter carries no assertDirectAdapterHandoff into the subsequent client.say batch and this helper now invokes it without checking authority. The send therefore occurs after withdrawal. Carry the existing synchronous scheduled assertion through preparation and invoke it at the SDK handoff; no held custody interval is needed.
    Confidence: 0.99
  • [P3] Update the SDK guide for custody-free effect handling — docs/plugins/sdk-channel-plugins.md:776-782
    The unchanged SDK guide tells adapters that captureEffectAuthority restores a captured scope, acquires fresh held uses, releases an interval at provider initiation, and serializes uses through FIFO. This PR makes that exported helper unconditional, so following the documented contract no longer supplies those guarantees. Update the guide to describe the surviving synchronous authority checks and their propagation through queues and preparation.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 35ab90410d55.

Provenance checked

  • Receipt custody and reconciliation changes intended behavior with a stated reason (58bcc01: Publish current receipt authority around writes and reconcile unknown outcomes without replay.)
  • Transport effect preparation changes intended behavior with a stated reason (9a7b4da: Retain scheduled authority through asynchronous preparation to final provider initiation, extended to remaining transports by refactor(cron): hold message authority for remaining transports and delete the native checker (cron 2b/3) #165129.)
  • Standing-grant launch interval changes intended behavior with a stated reason (843a24c: Close the consume-to-spawn revocation gap; this PR explicitly replaces that contract with one authorized start per committed consumption.)
  • Agent and Claw removal publication keeps the original intent (24d5996: Move retirement SQL to workers while retaining deletion authority and committed publication through cleanup.)

Testing

Proof path: in-process harness.

Security

Needs attention: Two reachable regressions allow scheduled effects to use withdrawn authority.

Evidence

Security concerns:

  • [high] Durable permission withdrawal can miss its live consumer — src/cron/service/run-receipts.ts:106
    A committed permission change must retire the active occurrence's authority even when its response is lost; stored withdrawal currently does not reach the surviving live guard.
    Confidence: 0.99
  • [high] Transport preparation can outlive scheduled authorization — src/shared/effect-authority.ts:9
    The nearest forbidden operation is a previously allowed scheduled send whose message permission was withdrawn during preparation; Twitch can still reach the external SDK handoff.
    Confidence: 0.99

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 58bcc01 adds src/cron/service/run-receipts.ts:100 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 58bcc015a37d; files: src/cron/service/run-receipts.ts)
  • Shakker: Raw commit 10169f0 adds src/cron/active-jobs.ts:37 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 10169f0489e4; files: src/cron/active-jobs.ts)

PR surface

Source -1295, Tests -1631, Docs +10. Total -2916 across 55 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 38 329 1624 -1295
Tests 15 185 1816 -1631
Docs 2 19 9 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 55 533 3449 -2916

Review metrics

Metric Value Why it matters
Production versus tests Production +329/−1,620; tests/support +185/−1,820 The reduction serves the approved custody removal, but deleted security coverage exposes gaps in the surviving owners.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The patch can permit scheduled effects after their message authority has been withdrawn.
  • merge-risk: 🚨 security-boundary: Lost committed permission replies and delayed Twitch preparation can bypass withdrawal before external effects.
  • merge-risk: 🚨 compatibility: The exported effect-authority helper changes behavior, and its documented SDK contract still promises the removed mechanism.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (8 earlier review cycles)
  • reviewed 2026-10-11T01:06:08.344Z sha 1216af9 :: needs real behavior proof before merge. :: [P1] Preserve permission revocation when a committed mutation loses its reply
  • reviewed 2026-10-11T01:15:04.346Z sha 1216af9 :: needs real behavior proof before merge. :: [P1] Preserve permission revocation when a committed mutation loses its reply | [P3] Update the documented contracts after removing receipt custody
  • reviewed 2026-10-11T02:46:37.470Z sha 1216af9 :: needs real behavior proof before merge. :: [P1] Preserve permission revocation when a committed mutation loses its reply | [P3] Update the documented contracts after removing receipt custody
  • reviewed 2026-10-11T03:39:50.997Z sha 1216af9 :: needs real behavior proof before merge. :: [P1] Preserve permission revocation when a committed mutation loses its reply | [P3] Update the documented contracts after removing receipt custody
  • reviewed 2026-10-11T05:12:47.120Z sha 87c4a173afe2ecc37bffa41725119da68947c991 :: needs real behavior proof before merge. :: [P1] Preserve permission revocation after a committed reply is lost | [P1] Carry the scheduled guard to final provider initiation | [P3] Update the SDK guide to match custody-free effect handling
  • reviewed 2026-10-11T06:07:00.776Z sha 87c4a173afe2ecc37bffa41725119da68947c991 :: needs real behavior proof before merge. :: [P1] Preserve permission revocation after a committed reply is lost | [P1] Carry the scheduled assertion to final provider initiation | [P3] Update the SDK guide for custody-free effect handling
  • reviewed 2026-10-11T06:38:17.128Z sha f8753d3 :: needs real behavior proof before merge. :: [P1] Preserve permission revocation after a committed reply is lost | [P1] Carry the scheduled assertion to final provider initiation | [P3] Update the SDK guide for custody-free effect handling
  • reviewed 2026-10-11T08:22:22.189Z sha a77f1cc :: needs real behavior proof before merge. :: [P1] Preserve permission revocation after a committed reply is lost | [P1] Carry the scheduled assertion to final provider initiation | [P3] Update the SDK guide for custody-free effect handling

Reviewed October 11, 2026, 4:39 AM ET / 08:39 UTC (Revision 9).

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 11, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 11, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 11, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram and removed extensions: memory-core Extension: memory-core labels Oct 11, 2026
Keep the host scheduler and durable run receipts while removing the receipt custody owner, prepared uses, and publication hooks from cron, approvals, agent removal, and Gateway shutdown. Existing run, permission, approval-row, and transcript owners retain their checks; a committed standing-grant use may race later revocation.

Repair two inherited fixtures exposed by the required proof: use the prebuilt CLI in the real-Gateway media test, and observe the current cache-prune execute boundary in the memory reservation test. Refs #168072.
@openclaw-barnacle openclaw-barnacle Bot removed the channel: telegram Channel integration: telegram label Oct 11, 2026
@steipete
steipete merged commit 16f2290 into main Oct 11, 2026
150 checks passed
@steipete
steipete deleted the upd/upd-l1540 branch October 11, 2026 08:42
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…8772)

Cron PR 2a of the worker-owned redesign (docs/refactor/cron-worker-owned.md): deletes cron receipt custody/revocation and its consumers across scheduling, standing grants, operator approvals, agent removal and Gateway shutdown. Independent live checks stay at each effect (run active, grant current and unexpired, host exec policy, approval rows); the accepted revocation-after-check race is named in code. Host remains the scheduler until 2b. Production -1,291 LOC. Refs openclaw#168072.
RomneyDa added a commit that referenced this pull request Oct 14, 2026
Failed state-database resource drainage left its read seal held, and retries reused the stale seal, so every capture failed with STATE_DATABASE_READ_ADMISSION_INVALIDATED until restart. Native handles are not retired on that path, so release the seal while keeping failed resource custody, and seal again before each retry drains. Failed native retirement still keeps its seal.

Fixes #162085

Backport adaptation: kept the release branch's worker-access.md; its stale-sentence removal depends on #168772, which is not on this line.
(cherry picked from commit 63c8229)
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 18, 2026
First-parent upstream c96fac1..d9eba8a (10 PRs: openclaw#168948 GitHub
connection authority to workers, openclaw#168975, openclaw#168772 cron receipt custody
removal, openclaw#169012, openclaw#169006, openclaw#169009, openclaw#168283 test batch d042, openclaw#168994,
openclaw#168964, openclaw#168855 approval/placement state in workers).

Conflicts:
- docs/reference/database-schemas/worker-access-inventory.md: took
  upstream, then regenerated (db:worker-inventory:gen, 633 files / 2449
  calls) instead of hand-merging.
- src/agents/embedded-agent-runner/compact-reasons.test.ts: upstream
  openclaw#168283 deleted low-value cases; kept upstream's file plus our own
  additions only (unknown_model, empty reason, closed-union check and the
  isCompactionSkipCode block).

session-reset-service.ts auto-merged: upstream's awaited placement
retirement (assertCurrent) is disjoint from our continuation-cancellation
cleanup reason.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: qa-lab gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant