Repository navigation
refactor(gateway): own update campaign scheduling in its lifecycle - #159306
Merged
Merged
Conversation
Contributor
|
🦞👀 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. |
steipete
enabled auto-merge (squash)
September 27, 2026 01:34
This was referenced Sep 27, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Sep 27, 2026
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Automatic update campaigns own a process-global timer and mutable campaign singleton separately from the Gateway lifetime. Replacing the Gateway can leave campaign state with the retired owner.
User Impact
The existing idle, countdown, hold, adoption and forced-update behavior now uses the Gateway's scheduler and current update lifecycle. Replacement clears only the retired lifecycle's campaign; status and run handlers consume the current owner.
Why This Change Was Made
Require a scheduler in UpdateCampaignController and create the controller in the update-check lifecycle. Remove the native timeout and clear/unref plumbing, global gatewayUpdateCampaign export, and the redundant injected-controller option. One scheduler instance per Gateway process, enforced by types. The existing async-work scope tracks admitted apply work through shutdown.
Update behavior: no config, state, spool, port, schema or public SDK change. Existing countdown/hold boundaries, persisted update rows, acknowledgments and adopted-run ownership remain intact. The recently landed OCM managed-update selection and its older-manager fallback are preserved; only campaign access moves to the lifecycle. Expired process-local campaigns do not leak into a replacement Gateway. No new persisted schedule is introduced.
LOC: production +68/-58/net +10; tests +207/-136/net +71; docs +0/-0/net 0. The 469 changed lines cut over the owner and its status/startup/RPC callers together.
Evidence
Provider
blacksmith-testbox, leasetbx_01m3fe5xws0vqv7gvgg8bg9q61, run 36261201574. After frozen install,pnpm test <file> --maxWorkers=1passed all 18 files / 346 cases in 202.751 s on proof tree6272615737b3c906868e2e1dc26cb0e97cfc4ece:src/gateway/server-methods/update-admission-freshness.test.tssrc/gateway/server-methods/update-effective-channel.test.tssrc/gateway/server-methods/update-freebsd-pkg.test.tssrc/gateway/server-methods/update-handoff-failure.test.tssrc/gateway/server-methods/update-hold.test.tssrc/gateway/server-methods/update-owner.test.tssrc/gateway/server-methods/update-run-campaign.test.tssrc/gateway/server-methods/update-status-schedule.test.tssrc/gateway/server-methods/update-status.test.tssrc/gateway/server-methods/update-unexpected-error.test.tssrc/gateway/server-methods/update.test.tssrc/gateway/server-startup-update-check.test.tssrc/gateway/update-run-watcher.test.tssrc/infra/update-campaign.test.tssrc/infra/update-startup-campaign-run.test.tssrc/infra/update-startup-request-adoption.test.tssrc/infra/update-startup.campaign-apply-error.test.tssrc/infra/update-startup.test.tsFresh-main OCM composition: provider
blacksmith-testbox, leasetbx_01m3g6q6b7x9nvanv9zngc0r1q, run 36284825347. Afterpnpm install --frozen-lockfile(5.644 s), the same focused command passedsrc/gateway/server-methods/update-status.test.ts(24 cases, 25.701 s),src/gateway/server-methods/update.ocm.test.ts(36 cases, 17.715 s), andsrc/infra/update-campaign.test.ts(17 cases, 18.927 s): 77 cases in 62.343 s. Proof tree3e1dea844d1c3fb445c8bf05da28f58ed27dcffc. Publication head1ec0ab80c653fa5e66c25fb5f360db18eb5043e9preserves every changed file byte-for-byte after rebasing onto main containing the merged watcher.The original owner review and fixture-composition review were clean through P2. Deslop of the fresh-main delta retained OCM's existing behavior without extra wrappers or guards; a fresh full-diff Codex P2 review found no actionable findings. Cross-shard grep finds no remaining gatewayUpdateCampaign export/caller or injected updateCampaign option. Exact-head GitHub ci-gate supplies changed-file validation. Final merged-main Gateway/cron/suspend/restart/shutdown proof follows the last slice.
Stack
Follows update watcher #159291, update checks #158909, and session delivery #159275. System-job retry #159129 is independent. Earlier stack links are in the predecessor bodies. Next: diagnostic/CLI/SDK lifetime, auth pruning, MCP preparation/cutover, final census and docs.