Repository navigation
refactor(gateway): share cold-storage maintenance scheduling - #159088
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 changes before merge. Reviewed September 26, 2026, 2:13 PM ET / 18:13 UTC. ClawSweeper reviewWhat this changesThe branch moves transcript cold-storage startup and recurring sweeps onto the Gateway's shared scheduler, forwards that scheduler from startup, and updates focused clock-driven tests. Merge readiness⛔ Needs changes before merge - 1 item remains Keep open. Current main and the latest release still use a private cold-storage interval, so this scheduler migration remains useful. The merged scheduler and task-maintenance PRs are prerequisites, not replacements for this change. Priority: P3 Review scores
Verification
How this fits togetherGateway maintenance receives live configuration and scheduler wakeups, then asks the cold-storage worker to archive eligible inactive transcripts. The sweep owner also handles manual requests, reports progress, and joins work during shutdown. flowchart LR
A[Gateway startup] --> B[Shared scheduler]
B --> C[Cold-storage sweep owner]
D[Manual storage request] --> C
C --> E[Live policy and authority checks]
E --> F[Archive worker]
F --> G[Cold transcripts and status]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +30. Total +39 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one Gateway-owned scheduler for automatic cold-storage wakes while preserving the existing sweep owner's live policy checks, manual requests, worker commits, and shutdown drain. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is an internal scheduling refactor rather than a report of broken existing behavior. Source inspection establishes the old private interval. Is this the best way to solve the issue? Yes: the patch uses the existing Gateway scheduler and leaves cold-storage policy, worker writes, and manual request ownership in their current owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against df50212501d1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Transcript cold-storage maintenance owns a private minute interval and separate startup tick. Move both onto the required Gateway scheduler while retaining the existing sweep owner for manual/periodic coalescing, live config and authority checks, progress, and shutdown joins. Delete native interval/unref/clear plumbing; use the injected clock for existing status timestamps.
This follows task maintenance #159038 and reuses its required scheduler forwarding and shared fixture field. Only cold-storage arming moves in this PR; other maintenance loops stay with their existing owners until their reviewed slices. One scheduler instance per Gateway process, enforced by types; no constructor or optional fallback is added.
User Impact
Existing state/config/ports/spools need no migration. Startup and minute sweeps retain their owning store/config decisions; overdue wakes coalesce once. Archive/restore eligibility, retention, bytes, manual RPC authority and worker ownership remain unchanged. No storage schema, config, SDK or RPC contract change.
Strict LOC after its task prerequisite: production +17/−8/net +9; tests +49/−19/net +30; docs +0/−0/net 0. Growth is required dependency forwarding and the joined scheduler handle.
Evidence
Reviewed on the task slice above
be46e6966c2b52c6cde06abf965c44f9a175a47f, then mechanically rebased after its prerequisite merged. Publication head669ea265dbfbf6a758c60e0977a9b4633d75ea0e; GitHub exact-head CI attaches on publication. The cold-storage owner/test and maintenance forwarding remain byte-identical to the passed artifact; duplicated shared forwarding is omitted. Fresh Codex review covers the composition and main's admission-helper deduplication. Prior costs are reused, not claimed as a new-head remote run; GitHub's enforcedopenclaw/ci-gatesupplies that gate.Blacksmith Testbox, lease
tbx_01m3er4ym3e4e69mfkcyc84m7t, run 36239456451. Each command ran afterpnpm install --frozen-lockfile; wall includes the supported wrapper and worker preparation.pnpm test src/gateway/session-cold-storage-maintenance.test.ts --maxWorkers=1passed all 5 cases before and after: baseline 30.270s, candidate 24.286s. Candidate base4543ce2515ef27e460d3545ac6c2675f483ad49c, treed14f3ad92d85f9cf4df246803f5e8bfdfee58d53. Coverage retains config changes, manual/periodic coalescing, stale-commit rejection, worker drain, RPC acknowledgement and committed progress after failure. These wall measurements include wrapper preparation and are not a performance comparison.Deslop, formatting, caller closure and fresh Codex P2 composition review are recorded with publication preparation. Final merged-stack live proof remains pending.
Scheduler stack
Published predecessors: diagnostic preparation #157517, auth naming #158275, scheduler owner #158423, event-loop health #158531, channel health #158537, mention expiry #158614, upstream monitoring #158617, worker placement #158662, idle work #158666, Incognito expiry #158690, OAuth maintenance #158717, lifetime maintenance #158727, worker reconciliation #158812, PR subscriptions #158821, update checks #158909, Gmail renewal #158913, metadata #158959, and audit #158982.
Task maintenance is merged as #159038; generation #159042 and post-ready #159047 are also merged. Approval deadlines #159081 are pending. This continuation lands cold storage. Remaining reviewed owners land separately; final merged-main Gateway/cron/suspend/shutdown proof follows the stack.