Skip to content

perf(update): defer Gateway maintenance during candidate validation - #154548

Merged
steipete merged 1 commit into
mainfrom
upd/candidate-canary-startup-time
Sep 21, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/candidate-canary-startup-time

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Candidate validation spends part of the installed updater's deadline preparing session catalogs and background maintenance that the canary never uses.

Related: #144858, #154381. Thanks to @ZaneMc-AO and the other reporters for the field evidence.

User Impact

Update canaries reach readiness without session catalog hydration, worker recovery, task/skill startup, or background maintenance. A warning records the deferral; the serving Gateway prepares these normally after activation. Required configuration, ownership, schema, and migration admission and actual plugin runtime loading remain intact. There are no new configuration, CLI, environment, dependency, or schema surfaces.

The reported 299-second failure measures the entire 2026.9.4 validation interval, including earlier checks; it does not establish five-minute Gateway startup. This synthetic baseline already met the requested 90-second target. This change removes unnecessary work and protects the candidate boundary; it does not reproduce the reporter's complete Intel Mac environment. Troubleshooting now links the one-time manual package-manager install, Doctor, and restart recovery for the old updater's fixed deadline.

Why This Change Was Made

The shipped --update-canary option previously suppressed autonomous work late in startup. The existing bootstrap, request-runtime, early-runtime, and finish owners now apply it before preparing serving-only state. Normal Gateway startup retains its existing path. Production growth is 11 lines to select the existing candidate mode across those owners; no second startup implementation was added.

Evidence

Matched packaged builds on one Linux Testbox with four effective CPUs, Node 24.19.0, ten agents/agent databases, and npm Codex, Mistral, and Groq plugins. The state was seeded with 53,664 synthetic transcript events; the copied main database was 222.4 MiB at Gateway spawn, after rehearsal, in both runs. Ownership/schema checks and plugin loading still executed.

Measurement Before After
CLI bootstrap/config admission 2.765 s 2.928 s
Server ownership/schema preflight 0.121 s 0.159 s
Startup maintenance 0.612 s deferred
Worker store/runtime/placement preparation 0.126 s deferred
Session catalog hydration 0.046 s deferred
Early runtime work 0.072 s 0.002 s
Plugin runtime loading 1.672 s 1.858 s
Spawn → HTTP bound 5.483 s 5.046 s
Spawn → candidate ready log 7.262 s 6.941 s
Spawn → successful startup/readiness probes 7.295 s 6.956 s

These are one matched pair, not a statistical hardware guarantee. Nested spans are not additive. The direct-owner validation totals were 41.175 s and 40.083 s; that harness's Doctor lint correctly deferred inspection without a recognized updating-parent origin.

The actual published 2026.9.4 updater was also installed in a private npm prefix. Its own public SDK created ten schema-19 agent databases, with a 226.5 MiB main database; its Codex/Mistral/Groq packages were installed at 2026.9.4. Its unchanged updater then ran update --tag <candidate.tgz> --yes --json --timeout 1800 --no-restart, retaining the released 300-second canary clamp. The full update returned status: "ok", installed the candidate 2026.9.5 package, and reported 90.548 s overall. Candidate readiness was 6.134 s, with ten copied databases and a 225.1 MiB main database at spawn. No repair agent ran. Pending Codex migration and isolated-service-management warnings remained visible. This cell exercises migration/activation and canary readiness; it intentionally does not restart a managed service.

  • Real Gateway regression: original code fails before bind at the forbidden agent CLI shim; patched code loads the synthetic plugin and returns HTTP 200 from both /startupz and /readyz without invoking the deferred owners.
  • New boundary file: 16.74 s wall with node scripts/run-vitest.mjs <file> --maxWorkers=1; 14.71 s Vitest duration (57% transform, 39% fixture/test time), HTTP assertions 29 ms. One shared real Gateway boot is needed to protect cross-owner startup wiring.
  • Modified schema-refusal file: two cases passed; 40.29 s wall on macOS, 34.45 s Vitest duration (85% transform, 5% test time). Both ordinary and candidate startup retain exit 78 for an unsupported future schema. The wall time is compiler preparation, not a slow test.
  • Five Gateway owner suites and five existing canary suites passed; the infra group reports 92 tests. Built canary integration passed in 15.665 s test time / 28.53 s wall. Builds, package integrity checks, required check:changed (including core/core-test types), formatting, and diff checks passed. Final isolated autoreview found no actionable P0/P1 issues.
  • LOC: production +80/−69 (net +11); tests +160/−4 (net +156); docs +13. CI duration is pending the first PR run.

Testbox proof: tbx_01m318a9xvs8nr0em78fj770ea, run 35566135777, verified source tree f5f7676ef164d78db7273ce80d0d0683b388e032. Earlier regression/sibling/build proof used tbx_01m311md7n7zq7y20x3tnxc047, run 35559124184; those commands passed before the lease was subsequently cancelled during packaging. A replacement lease hit an SSH multiplexing error before command execution; the fresh retry with a smaller command payload succeeded. Initial plugin-name and legacy-roster fixture errors were corrected before counting the published-driver result.

Testbox leases are stopped after evidence collection, so their Actions conclusion can show cancelled after successful commands; the recorded wrapper results above exited zero.

Apply the existing candidate flag before session catalogs, worker recovery,
and background lifetimes are prepared. Keep configuration, ownership,
schema, migration admission, and plugin runtime validation intact.

Prove the startup boundary and document manual recovery from the published
updater's shared five-minute deadline. The published 2026.9.4 driver upgrades
the synthetic ten-agent state successfully, with candidate readiness in 6.134s.

Thanks to @ZaneMc-AO and the other timeout reporters.
Related: #144858, #154381
@clawsweeper

clawsweeper Bot commented Sep 21, 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 docs Improvements or additions to documentation gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 21, 2026
@steipete
steipete marked this pull request as ready for review September 21, 2026 07:23
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 3:29 AM ET / 07:29 UTC (Revision 2).

ClawSweeper review

What this changes

The PR makes update-validation Gateways defer serving-only preparation and maintenance, adds readiness and schema-refusal coverage, and documents recovery from the older updater’s deadline.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, bounded improvement absent from current main. No blocking correctness defect was found, and the published-updater proof supports the candidate-startup change without claiming to resolve the reporter’s complete hardware-specific timeout.

Priority: P2
Reviewed head: 6c74a7559acc62390f37b1a1b75122e4628e6fde

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused patch with relevant real upgrade evidence, meaningful boundary coverage, and no actionable correctness findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The source-matched packaged Linux runs exercise the changed Gateway startup owners, and the published 2026.9.4 updater successfully activates the candidate against ten older agent databases with readiness in 6.134 seconds. This supports the scoped optimization, without proving managed-service restart or the reporter’s Intel Mac outcome.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The source-matched packaged Linux runs exercise the changed Gateway startup owners, and the published 2026.9.4 updater successfully activates the candidate against ten older agent databases with readiness in 6.134 seconds. This supports the scoped optimization, without proving managed-service restart or the reporter’s Intel Mac outcome.
Evidence reviewed 10 items Pinned introduction and proof identity: Reviewed the merge-base-to-head changes. The raw original head records parent ac63848 and tree f5f7676ef164d78db7273ce80d0d0683b388e032, matching the source tree identified in the supplied proof. The separately inspected test merge records the pinned base followed by the exact PR head.
Admission remains ahead of deferred maintenance: Bootstrap still performs workspace, ownership, database-schema, configuration, and authentication preparation. The new guards suppress the CLI shim, profile cleanup, worker preparation, and startup maintenance only for the existing candidate mode; plugin bootstrap remains outside those guards.
Readiness and lifetime boundaries: Candidate startup omits session projection and initial maintenance sidecars. Post-attach startup still loads plugin runtimes before declaring candidate readiness. Deferred database admission retains its stop owner, which resolves pending activation and joins outstanding work during shutdown.
Findings None None.
Security None None.

How this fits together

The updater starts a temporary Gateway against copied state to validate a candidate installation. Gateway startup performs admission checks and loads plugins before returning readiness results to the updater.

flowchart TD
  A[Installed updater] --> B[Candidate and copied state]
  B --> C[Configuration and database admission]
  C --> D{Update validation mode}
  D -->|Candidate| E[Defer serving maintenance]
  D -->|Normal startup| F[Prepare serving services]
  E --> G[Load plugins and report readiness]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +11, Tests +156, Docs +13. Total +180 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 80 69 +11
Tests 2 160 4 +156
Docs 2 13 0 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 253 73 +180

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +11 lines; tests net +156 lines Production growth selects the existing candidate mode across startup owners; the larger test addition protects their combined readiness boundary.

Root-cause cluster

Relationship: partial_overlap
Canonical: #154381
Summary: The PR reduces candidate-side work relevant to the retained first-hop investigation but does not establish a complete fix for its state-dependent timeout.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep candidate validation focused on admission, plugin loading, and readiness while the activated serving Gateway owns maintenance and session preparation.

Do we have a high-confidence way to reproduce the issue?

Yes for unnecessary candidate startup work: current-main source invokes the deferred owners, and the supplied regression records failure before the fix. The reporter’s complete Intel Mac timeout was not reproduced.

Is this the best way to solve the issue?

Yes. Applying the existing candidate flag at the startup owners is a narrow solution that preserves normal startup and required validation, with relevant published-driver upgrade evidence.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 69afbbaf3742.

Labels

Label justifications:

  • P2: This is a bounded update-validation improvement with measured benefit, without proof that it alone resolves the reported first-hop blocker.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The source-matched packaged Linux runs exercise the changed Gateway startup owners, and the published 2026.9.4 updater successfully activates the candidate against ten older agent databases with readiness in 6.134 seconds. This supports the scoped optimization, without proving managed-service restart or the reporter’s Intel Mac outcome.
  • proof: sufficient: Contributor real behavior proof is sufficient. The source-matched packaged Linux runs exercise the changed Gateway startup owners, and the published 2026.9.4 updater successfully activates the candidate against ten older agent databases with readiness in 6.134 seconds. This supports the scoped optimization, without proving managed-service restart or the reporter’s Intel Mac outcome.

Evidence

What I checked:

  • Pinned introduction and proof identity: Reviewed the merge-base-to-head changes. The raw original head records parent ac63848 and tree f5f7676ef164d78db7273ce80d0d0683b388e032, matching the source tree identified in the supplied proof. The separately inspected test merge records the pinned base followed by the exact PR head. (6c74a7559acc)
  • Admission remains ahead of deferred maintenance: Bootstrap still performs workspace, ownership, database-schema, configuration, and authentication preparation. The new guards suppress the CLI shim, profile cleanup, worker preparation, and startup maintenance only for the existing candidate mode; plugin bootstrap remains outside those guards. (src/gateway/server-startup-bootstrap.ts:483, 6c74a7559acc)
  • Readiness and lifetime boundaries: Candidate startup omits session projection and initial maintenance sidecars. Post-attach startup still loads plugin runtimes before declaring candidate readiness. Deferred database admission retains its stop owner, which resolves pending activation and joins outstanding work during shutdown. (src/gateway/server-kernel-request-runtime.ts:61, 6c74a7559acc)
  • Real packaged startup and published-driver proof: The supplied body at sourceRevision 7584e4d64e5c2bdc410dbe9aa2612ee702087c47e67afd062d1283578cdbf628 reports matched Linux packaged runs with ten agent databases: readiness improved from 7.262 s to 6.941 s. The unchanged published 2026.9.4 updater then successfully installed the candidate with schema-19 input, reporting status ok, 90.548 s overall, and 6.134 s candidate readiness. This exercises the changed startup owners and upgrade boundary; managed-service restart and the reporter’s Intel Mac environment are expressly outside its coverage. The linked Testbox run is completed/cancelled, consistent with the stated lease cleanup; its conclusion alone is not the behavioral proof. (6c74a7559acc)
  • Focused regression coverage: The new suite uses one real Gateway boot, rejects calls to deferred owners, verifies synthetic-plugin loading, and checks HTTP 200 from both startup and readiness endpoints. The changed schema suite preserves future-schema refusal with exit 78 in ordinary and candidate modes. The body records test costs and successful sibling/build checks; this read-only review did not execute tests. (src/gateway/server-startup-update-canary.test.ts:143, 6c74a7559acc)
  • Still necessary on current main: The fetched main retains the pre-PR bootstrap, early-startup, and finish behavior. Its separate request-runtime change adds shutdown-budget forwarding rather than these candidate deferrals. No merged replacement for this behavior was established. (src/gateway/server-startup-bootstrap.ts:468, 69afbbaf3742)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-21T07:22:56.187Z sha 6c74a75 :: needs maintainer review before merge. :: none

@steipete
steipete enabled auto-merge (squash) September 21, 2026 07:35
@steipete
steipete merged commit f921c4e into main Sep 21, 2026
286 checks passed
@steipete
steipete deleted the upd/candidate-canary-startup-time branch September 21, 2026 07:54
vincentkoc added a commit to vyctorbrzezowski/openclaw that referenced this pull request Sep 21, 2026
…question-layout-restart-recovery-20260921

* 'main' of https://github.com/openclaw/openclaw: (110 commits)
  perf(infra): collect and retire idle worker heaps (openclaw#154408)
  perf(sessions): hand shared history to the final reader (openclaw#154552)
  fix: clarify Codex onboarding migration scope (openclaw#151383)
  fix: recover conflicted PRs after accepted auto-merge
  perf(update): defer Gateway maintenance during candidate validation (openclaw#154548)
  perf(test): advance llama.cpp reload deadlines virtually (openclaw#154536)
  refactor(skills): prepare pinned library resources off-thread (openclaw#148560)
  fix(tooling): preserve Node compiler policy in script subprocesses (openclaw#154509)
  ci: select supported Node and cover packaged Node 26 (openclaw#154298)
  fix(release): preserve Telegram rerun evidence (openclaw#154561)
  docs: follow pending PR merges through completion
  fix(gateway): avoid stuck shutdowns after lifecycle errors (openclaw#145241)
  fix(ui): let focused dashboard widgets fill the task area (openclaw#154440)
  feat(release): add non-Latest extended-stable releases (openclaw#154515)
  fix(release): project 7.35 package Telegram config (openclaw#154546)
  refactor(config): derive host contracts from schemas (openclaw#153936)
  fix(ui): remove finished subagents from inline activity (openclaw#154469)
  refactor(config): derive core channel contracts from schemas (openclaw#153935)
  refactor(config): derive boundary contracts from schemas (openclaw#153937)
  fix(ui): keep thread activity current across cached updates (openclaw#154540)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
…penclaw#154548)

Apply the existing candidate flag before session catalogs, worker recovery,
and background lifetimes are prepared. Keep configuration, ownership,
schema, migration admission, and plugin runtime validation intact.

Prove the startup boundary and document manual recovery from the published
updater's shared five-minute deadline. The published 2026.9.4 driver upgrades
the synthetic ten-agent state successfully, with candidate readiness in 6.134s.

Thanks to @ZaneMc-AO and the other timeout reporters.
Related: openclaw#144858, openclaw#154381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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