Repository navigation
refactor(gateway): share update watcher scheduling - #159291
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 26, 2026, 8:55 PM ET / September 27, 2026, 00:55 UTC. ClawSweeper reviewWhat this changesThe branch moves Gateway update-run polling and delayed state-schema publication onto the shared scheduler and updates the affected lifecycle tests. Merge readiness⛔ Blocked before merge - 2 items remain Current main still uses separate watcher timers, so this PR remains useful. The focused tests support the cutover, but the repository’s required published-updater-to-candidate compatibility proof is still outstanding. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway watches update-run records written during updates. It broadcasts progress, sends eligible notices, and publishes the state schema after older updater activity clears. flowchart LR
A[Update run records] --> B[Gateway update watcher]
C[Update lifecycle] --> D[Shared scheduler]
D --> B
B --> E[Progress and notices]
B --> F[Schema publication]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +2, Tests +63. Total +65 across 8 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the shared scheduler cutover and verify the candidate Gateway against state produced by the published 2026.9.2 updater through restart and the existing schema-publication grace. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a scheduling refactor, and current main's native watcher timers establish the pre-change behavior. Is this the best way to solve the issue? Yes: the existing Gateway scheduler is the appropriate owner for these wakeups. The published-updater compatibility cell is still needed to validate the upgrade path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 038b10b48de0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
The Gateway update watcher owns separate native timers for active-run observation and deferred schema publication. Their wakes are outside the kernel schedule.
User Impact
Update status, interrupted-run reconciliation, final notices, and schema-publication grace retain their existing contracts. The Gateway scheduler now owns both wakeups and exposes them through its existing next-wake fact.
Why This Change Was Made
The watcher borrows the required scheduler from its update-check lifecycle. Remove both native timer handles and their clear/unref plumbing. One scheduler instance per Gateway process, enforced by types: no private default or optional scheduler is added. The existing work scope still joins admitted notices and cancels interrupted-update verification on stop.
Update behavior: existing install state, configuration, callback ports, run rows, upgrade receipts and schema versions are unchanged. The publication deadline is re-derived from the owning ledger on each boot, preserving the old updater's grace rather than restarting it. A late wake observes current state once; no missed-poll replay. No schema, config, RPC or SDK surface changes.
Production +26/-24/net +2; tests +122/-59/net +63; docs +0/-0/net 0. The eight-file cutover replaces timer-driven owner tests with the shared injected clock and preserves the existing durable-recovery fixture.
Evidence
Provider
blacksmith-testbox, leasetbx_01m3fe5xws0vqv7gvgg8bg9q61, run 36261201574. Frozen install and exact source verification precededpnpm test <file> --maxWorkers=1:src/gateway/server-methods/update-status.test.tssrc/gateway/server-runtime-services.delivery-recovery.test.tssrc/gateway/update-run-watcher.interruption.test.tssrc/gateway/update-run-watcher.schema-publication.test.tssrc/gateway/update-run-watcher.test.tssrc/gateway/server-startup-update-check.test.tsSix files / 70 cases passed in 68.096 s; the baseline selections also passed. Publication head
21364cf0660d655818fef27e1736659dcb701e19, based on main5e0d86f46d83a0bf81dd4242ccb7ce86d23d0a40. Proof treeaa35863a90bae8b69e2322cd96fa5edda8a3aa90; all eight published files match the reviewed/proved composition byte-for-byte. Sleep catch-up, pending verifier cancellation, final notices, and schema-publication deadlines are exercised. This is focused proof, not yet the final merged-main live run.Deslop and independent Codex review through P2 have no accepted/actionable findings. Cross-shard call-site grep confirms the only production start is the lifecycle-owned Gateway entry point.
git diff --checkpasses. Exact-head GitHub ci-gate supplies changed-file validation; the final slice carries live Gateway/cron/suspend/restart/shutdown proof.Stack
Follows kernel scheduler #158423, update-check lifecycle #158909, and outbound recovery #159096. Session delivery #159275 and system-job retries #159129 are separate slices. Earlier stack links are in those PRs. Next: update campaign, diagnostic/CLI/SDK lifetime, auth pruning, MCP preparation/cutover, final census and docs.