Skip to content

refactor(gateway): share outbound recovery scheduling - #159096

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

steipete merged 1 commit into
mainfrom
hostneutral/scheduler-outbound-recovery-0926

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Pending outbound delivery recovery arms a private interval outside the Gateway schedule.

User Impact

The first recovery remains eager. Later retries keep the five-second cadence, coalesce late wakes, and stop with the Gateway while admitted recovery settles. Queue persistence, captured state roots, delivery authority and backoff decisions stay with their existing owners. Existing state, configuration, spools and ports need no migration.

Why This Change Was Made

Pass the required kernel scheduler into recovery and return its existing in-flight promise to the scheduled job. Delete the interval, unref and clearInterval plumbing. One scheduler instance per Gateway process, enforced by types; no standalone instance or optional fallback is added. No storage schema, retention, config, SDK or RPC contract changes.

Production +13/−6/net +7; tests +35/−12/net +23; docs +0/−0/net 0. The small increase makes the existing recovery completion visible to scheduler shutdown.

Evidence

Blacksmith-testbox lease tbx_01m3fe5xws0vqv7gvgg8bg9q61, run 36261201574, frozen install, base 41324a0f2562c7998abe0152aa9b3be20bf0e4de, verified candidate tree 7955c94c3577f1c0d10021fd9fcdd040e75b115a: all three candidate file runs passed, 44 cases and 36.941s command wall. Every command used pnpm test <file> --maxWorkers=1, with source verification before and after.

File Cases Candidate wall Baseline wall
src/gateway/server-runtime-services.test.ts 40 18.677s 8.266s
src/gateway/server-runtime-services.delivery-recovery.test.ts 1 11.000s 30.730s
src/gateway/server-runtime-services.heartbeat-lifecycle.test.ts 3 7.264s unchanged sibling

These are command costs, not a performance comparison. Existing native persistence/worker setup accounts for the baseline above 30 seconds. The regression advances the shared injected clock by three minutes and observes one recovery, then verifies lifecycle stop prevents further retries. No new Gateway boots, wall-clock sleeps or per-file clock implementations were added.

Independent Codex P2 review is clean; deslop and six-root caller closure passed. The publication rebase preserves this reviewed patch and main's post-ready cutover. The measurements above belong to the pinned proof composition; GitHub's enforced openclaw/ci-gate validates the published head instead of a separate Testbox check-changed. Final merged-main live proof follows the stack.

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 merged. Cold storage is #159088. Remaining reviewed owners land separately; final merged-main Gateway/cron/suspend/shutdown proof follows the stack.

This PR migrates outbound recovery. Next are session delivery, update watcher and update campaign; their prepared proof has passed. Cron timing, periodic/media work, diagnostic/SDK and MCP lifetime cutovers, and final census/docs remain. Final Gateway/cron/suspend/restart/shutdown proof runs on merged main.

@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:34
@steipete
steipete merged commit 1c91579 into main Sep 26, 2026
195 checks passed
@steipete
steipete deleted the hostneutral/scheduler-outbound-recovery-0926 branch September 26, 2026 18:50
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 size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant