Repository navigation
fix(cron): preserve Gateway plugin registry for scheduled runs - #166991
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 October 8, 2026, 11:12 AM ET / 15:12 UTC (Revision 5). ClawSweeper reviewWhat this changesThe branch lets scheduled condition checks reuse their owning Gateway’s current plugin registry through startup, lazy construction, and cron hot reload. Example: A scheduled condition first runs after a Gateway restart with 31 plugins.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains necessary and is ready from this review: current main lacks the registry handoff, the earlier ownership findings are resolved, and the new real Gateway evidence satisfies the outstanding proof requirement. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway runs scheduled jobs and evaluates their conditions before starting a payload. Plugin preparation supplies the tools these conditions can use; this change carries the Gateway’s existing plugin resources into detached scheduling work. flowchart TD
A[Gateway startup or cron reload] --> B[Live plugin registry owner]
A --> C[Scheduled condition becomes due]
C --> D[Detached scheduled execution]
B --> D
D --> E[Check registry compatibility]
E --> F[Prepare condition tools]
F --> G[Persist condition result]
G --> H[Run payload when condition fires]
Technical reviewBest possible solution: Keep plugin reuse in the existing scheduled-execution owner and retain the established compatibility, generation, and tool-policy checks. Do we have a high-confidence way to reproduce the issue? Yes: current-main source exposes the missing registry scope, and the supplied real Gateway baseline reproduces duplicate registration, condition timeout, and liveness delay after restart. This read-only review did not execute a reproduction. Is this the best way to solve the issue? Yes: supplying the live registry at the scheduled owner repairs the missing handoff through the existing borrowing path without increasing deadlines, adding a cache, or changing operator settings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ea7cc1066568. Provenance checked
TestingProof path: shipped entry point. Added test files: 1. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -1, Tests +82. Total +81 across 6 files. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep the live registry handoff at the scheduled owner, without recovering ambient request scope. Reuse the cron constructor contract in the lazy adapter and replace plumbing assertions with a preparation and generation regression. Original fix by @67-luck for openclaw#166756; maintainer cleanup and proof coverage. Co-authored-by: wanghao <[email protected]>
|
Merged via squash.
|
…law#166991) * fix(cron): preserve Gateway plugin registry for scheduled runs * fix(cron): bind registry from Gateway scheduler owner * fix(cron): retain Gateway registry binding across hot reload * fix(cron): prepare scheduled conditions with their Gateway plugins Keep the live registry handoff at the scheduled owner, without recovering ambient request scope. Reuse the cron constructor contract in the lazy adapter and replace plumbing assertions with a preparation and generation regression. Original fix by @67-luck for openclaw#166756; maintainer cleanup and proof coverage. --------- Co-authored-by: Peter Steinberger <[email protected]>
* fix(cron): preserve Gateway plugin registry for scheduled runs * fix(cron): bind registry from Gateway scheduler owner * fix(cron): retain Gateway registry binding across hot reload * fix(cron): prepare scheduled conditions with their Gateway plugins Keep the live registry handoff at the scheduled owner, without recovering ambient request scope. Reuse the cron constructor contract in the lazy adapter and replace plumbing assertions with a preparation and generation regression. Original fix by @67-luck for #166756; maintainer cleanup and proof coverage. --------- Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit 3e16525)
…law#166991) * fix(cron): preserve Gateway plugin registry for scheduled runs * fix(cron): bind registry from Gateway scheduler owner * fix(cron): retain Gateway registry binding across hot reload * fix(cron): prepare scheduled conditions with their Gateway plugins Keep the live registry handoff at the scheduled owner, without recovering ambient request scope. Reuse the cron constructor contract in the lazy adapter and replace plumbing assertions with a preparation and generation regression. Original fix by @67-luck for openclaw#166756; maintainer cleanup and proof coverage. --------- Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit 3e16525) (cherry picked from commit 360e399) Co-authored-by: RomneyDa <[email protected]>
…law#165373, openclaw#166843, openclaw#166991, openclaw#168037) (cherry picked from commit a4511e5) Co-authored-by: RomneyDa <[email protected]>
Fixes #166756
What Problem This Solves
The first scheduled condition check after Gateway restart can synchronously reload plugins already loaded at startup, exhaust its 30-second budget, and stall Gateway liveness and channel sockets.
User Impact
Scheduled condition checks reuse their Gateway's current compatible plugins after restart and cron hot reload. The existing trigger deadline, tool policy, request isolation, and plugin-generation checks are preserved. No configuration, protocol, SDK, schema, or migration changes are required.
Why This Change Was Made
Detached scheduling deliberately drops request-local state. The cron owner now supplies a live registry resolver through startup, lazy construction, and hot reload, allowing preparation to use the existing Gateway-owned borrowing path. Resolving it per run follows registry replacement without borrowing another Gateway's resources.
Maintainer cleanup removes the ambient request-registry fallback, shares the cron constructor's parameter contract with its lazy adapter, and replaces helper-identity/constructor-argument assertions with real preparation, tool execution, registration-count, and generation coverage.
Original fix by @67-luck; maintainer cleanup and proof by @steipete. Contributor commits and human co-author credit are preserved.
Evidence
Verified candidate
c36968226bded0675e8ef07b5adaae9dc4781b31against captured main57dd17b4ea39b5f5d87db9faabaa2f0b10fa83f4. Exact-head CI passed. Independent Codex autoreview was scoped-clean through P2. This PR is intentionally left unmerged.Real Gateway proof ran on secretless AWS lease
cbx_211600b2dc4e(r7i.xlarge, 30.81 GiB RAM), with the QA mock OpenAI provider, isolated state, and ephemeral ports. The fixture loaded 31 local plugins with calibrated synchronous PBKDF2 work inregister, making duplicate registration measurable without patching production code. These are synthetic registration costs, not a benchmark of the reporter's plugin fleet. Evaluations were naturally scheduled; forced runs, which bypass the condition, were not used. The first evaluation followed a full process restart and the 60-second liveness startup grace.REGISTRY_OKAfter main's initial timeout, the warm-cache reload observation completed without another registry load. Its 30,354 ms figure is completion after the advertised due time, not a measured CPU stall. Quiet conditions preserve prior payload-run status, so the retained
errorwas not counted as a second timeout.Cron replacement was exercised through supported
config.patchupdates ofcron.enabledfalse then true. The Gateway PID remained unchanged.plugins.reloaddeliberately re-registered only the selected probe plugin once; the subsequent condition borrowed that new generation without registering it again.Main evidence:
All 283 tests across the 19 trigger/cron/Gateway module files passed (156.92 s wall). The changed preparation file passed 5 tests with
pnpm test src/cron/trigger-script.preparation.test.ts --maxWorkers=1(58.93 s cold wall, mostly worker compilation); the new regression took 879 ms within the module run. CI's 17 Node validation jobs totaled 3,856 runner-seconds, including setup and existing selected coverage, not just the added regression.The production-only negative control kept the test unchanged and reverted only
scheduled-run-gateway-context.tsto the main merge-base version. It failed on the intended assertion: startup's singlefullregistration was followed by unwanteddiscoveryandtool-discoveryregistrations. The fixed production file was restored byte-for-byte before subsequent checks.Production typecheck passed (63.06 s), as did the three applicable test-type graphs (166.44 s combined). Full build with QA artifacts passed (382.88 s). Local oxfmt, scoped oxlint, and
git diff --checkpassed; no contributor runtime executed locally. The full build reported an unrelated UI startup-bundle-size warning; UI source is unchanged.Commands and source isolation
The installed Crabbox CLI was launched from a clean trusted main worktree. Every run used the trusted bootstrap, the full pushed PR SHA,
--fresh-pr,--no-hydrate, andCRABBOX_ENV_ALLOW=CI. The bootstrap verified the SHA and IMDS no-role boundary and installed dependencies in a fresh temporary HOME. Public networking and no Tailscale were verified before use.The original-head baseline also passed 32 tests on lease
cbx_b35b1f297781. An allocation that fell back tot3.small(cbx_a77651d52052) was stopped without executing candidate code; the memory-capable replacement supplied the final proof.Two temporary-harness issues were corrected without changing product code: a retired
cron.maxConcurrentRunsoption, and a counter comparison made before replacing the trigger definition (the owner correctly resets that counter). The three passing registry phases were retained; the fired-turn observation was rerun and passed. After the full build gate passed,pnpm build qaRuntimesupplied runtime artifacts for the remaining harness-only work. No failing product check was hidden by a retry.Review findings and exact change size
The latest ClawSweeper review had no production-code finding. Its missing real restart/hot-reload evidence is supplied above. Both low-value plumbing assertions were removed and replaced with the preparation regression and production-only negative control. No human review findings were outstanding.
Against main's PR merge base: production +25 / -26 (net -1); tests +86 / -4 (net +82); docs +0 / -0. Existing schedule documentation already specifies the behavior restored by this fix. No changelog edits.