Skip to content

refactor(gateway): share cold-storage maintenance scheduling - #159088

Merged
steipete merged 1 commit into
mainfrom
hostneutral/scheduler-cold-storage-0926
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
hostneutral/scheduler-cold-storage-0926

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 head 669ea265dbfbf6a758c60e0977a9b4633d75ea0e; 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 enforced openclaw/ci-gate supplies that gate.

Blacksmith Testbox, lease tbx_01m3er4ym3e4e69mfkcyc84m7t, run 36239456451. Each command ran after pnpm install --frozen-lockfile; wall includes the supported wrapper and worker preparation.

pnpm test src/gateway/session-cold-storage-maintenance.test.ts --maxWorkers=1 passed all 5 cases before and after: baseline 30.270s, candidate 24.286s. Candidate base 4543ce2515ef27e460d3545ac6c2675f483ad49c, tree d14f3ad92d85f9cf4df246803f5e8bfdfee58d53. 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.

@clawsweeper

clawsweeper Bot commented Sep 26, 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 gateway Gateway runtime size: S labels Sep 26, 2026
@steipete
steipete enabled auto-merge (squash) September 26, 2026 18:10
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 26, 2026, 2:13 PM ET / 18:13 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: 669ea265dbfbf6a758c60e0977a9b4633d75ea0e

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 8 items Introduced scheduler cutover: The introduced patch replaces the private interval and synchronous startup tick with a named scheduler registration and joins its job on stop.
Current main still has the private timer: The fetched main revision arms a 60-second interval and calls the startup tick directly; it does not contain this cutover.
Latest release also has the private timer: Release v2026.9.6 contains the interval implementation, so this scheduler cutover is neither released nor already on current main.
Findings None None.
Security None None.

How this fits together

Gateway 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]
Loading

Before merge

  • Complete next step (P2) - Add after-fix proof from a real Gateway with cold storage enabled, showing automatic archiving and shutdown completion; redact private details such as addresses, keys, and endpoints. Updating the PR body should trigger re-review; otherwise ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

PR surface

Source +9, Tests +30. Total +39 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 17 8 +9
Tests 1 49 19 +30
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 66 27 +39

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a bounded internal maintenance refactor with no reported current-user regression.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Label justifications:

  • P3: This is a bounded internal maintenance refactor with no reported current-user regression.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit aa0ad4c adds src/gateway/session-cold-storage-maintenance.ts:28 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: aa0ad4c78044; files: src/gateway/session-cold-storage-maintenance.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 6e47c42 into main Sep 26, 2026
201 checks passed
@steipete
steipete deleted the hostneutral/scheduler-cold-storage-0926 branch September 26, 2026 18:25
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant