Repository navigation
fix(update): stop a newer CLI from migrating state the Gateway service still runs - #186971
Conversation
…e still runs Fixes #186898. Thanks @tomdailey55 for the report and recovery details.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d07976cc37
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (pending) { | ||
| assertGatewayServiceSchemaMigrationAllowed( | ||
| resolveOpenClawStateSqlitePath(), | ||
| pending.foundVersion, | ||
| pending.supportedVersion, | ||
| ); |
There was a problem hiding this comment.
Exempt read-only Doctor modes from the migration refusal
When a newer CLI detects an older service installation and a pending database migration, this check also rejects doctor --lint and bare doctor --json: run-main.ts invokes this preflight for every Doctor invocation before the command handler selects its mode. Those commands cannot migrate live state; the documented contract in docs/cli/doctor/lint.md says an older schema produces a “migration pending” finding without upgrading it. Consequently, users in the installation-skew scenario lose the read-only diagnostic report needed to inspect their installation. Pass the selected Doctor mode into this preflight and restrict the refusal to modes that can actually migrate live databases.
Useful? React with 👍 / 👎.
|
Codex review: blocked before merge. What this changesThe PR prevents a newer CLI from migrating shared state used by an older managed Gateway and adds installation-skew diagnostics. Example: CLI 2026.10.8 encounters shared-state schema 35 while the service targets OpenClaw 2026.10.3.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 7 items remain Keep open: this maintainer-authored PR addresses a real migration hazard, but it blocks read-only Doctor reports and introduces concrete tooling and validation failures. Priority: P1 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherCLI startup inspects the managed service installation, carries its version and database identity into SQLite workers, and lets the existing schema owner refuse incompatible migration effects. flowchart LR
A[CLI invocation] --> B[Service installation inspection]
B --> C[Invocation context]
C --> D[SQLite worker admission]
D --> E[Schema migration owner]
E --> F[Preserve or migrate database]
B --> G[Status and recovery guidance]
Technical reviewBest possible solution: Keep the existing schema owner’s migration refusal, exempt read-only Doctor modes, and complete the affected tooling inventories and diagnostic consumer updates. Do we have a high-confidence way to reproduce the issue? Source establishes the unguarded current-main migration path and the introduced Doctor regression; the PR supplies an isolated CLI reproduction, but this read-only review ran no target code. Is this the best way to solve the issue? The migration owner is the correct boundary, and the worker context prevents policy mixing; the Doctor bootstrap must distinguish diagnosis from migration before applying the refusal. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4757ac8eb6b8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +223, Tests 0, Docs +14. Total +237 across 40 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 28, 2026, 3:03 PM ET / 19:03 UTC. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3db4714d20
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| databasePath: resolveIdentityPathViaExistingAncestorSync( | ||
| resolveOpenClawStateSqlitePath({ ...env, ...command?.environment }), | ||
| ), |
There was a problem hiding this comment.
Resolve the service database with the Windows-aware environment merger
On Windows, a Scheduled Task can select its profile through command-line arguments even when its saved environment names another profile. This plain object spread ignores that selection, so databasePath can identify a different profile's database. The subsequent migration guard can then refuse migrations for the unrelated profile while allowing migration of the database actually used by the older service. Use the existing mergeGatewayServiceEnv(env, command) owner, which applies command-line profile selection and Windows case-insensitive environment semantics before resolving the database path.
Useful? React with 👍 / 👎.
|
Merged at the pinned head b978c04 (4757389). The remaining red was inherited from
Checked on this head before merging: eager-import closure, PR wrapper source closure, export-name collisions and update-restart module outcome all pass. The build, including the bootstrap import guard, passed in the lane. |
…e still runs (openclaw#186971) A bare npm install -g into a different Node prefix left the Gateway service on an older install while the PATH CLI was newer; ordinary CLI config-health writes then migrated the shared state database forward and the old Gateway could no longer start. The shared-state schema runtime and Doctor now refuse that forward migration when the managed service runs an older install, while verified managed-update and rehearsal admission still migrate; status/doctor/gateway status report the CLI/service skew, and an old Gateway facing a newer schema names the newer writer version. Fixes openclaw#186898. Thanks @tomdailey55.
What Problem This Solves
A bare global npm install under a different Node can leave a newer CLI beside an older managed Gateway. Even an ordinary CLI config-health write could then migrate shared state forward and prevent that Gateway from starting.
Fixes #186898. Thanks @tomdailey55 for the report and recovery details.
User Impact
The CLI refuses a forward migration when the service definition proves an older installation will open the same state. The error names both versions, the service root, and the update command. Current-schema databases and unknown service installations keep their existing behavior.
Status, Doctor, and Gateway status explain installation skew; Gateway startup also warns about a different CLI on PATH. A newer-schema startup failure names the existing writer version and recovery action instead of presenting a config-key error. Only a strictly newer writer version is described as newer than the Gateway; same-version and unknown writers retain the original schema-support and backup guidance. Runtime readers retain their inspection advice; Doctor maintenance never recommends rerunning Doctor for a newer schema and omits an uninformative same-version writer sentence. The updating guide explains Node/global-prefix differences and the managed updater's installation ownership.
Why This Change Was Made
The schema runtime owns the decision immediately before migration effects. CLI inspection reads the package belonging to the service definition's entrypoint and carries those facts through SQLite worker admission and reuse keys. Doctor checks agent-only pending migrations too. The native updater retains its existing verified maintenance/rehearsal path.
Deferred publication of already-applied content stays with its existing owner; shipped older readers already reject the newer content version before publication.
No SQLite schema, persisted field, dependency, config option, or CLI option changed. Writer diagnostics reuse
schema_meta.app_version.Evidence
Main integration —
b978c049fedd6bcb015f2730f2a348b8e6626a02Merged
origin/mainate25c026eb75d34ecdeed1d64d68454fb919f3c19(including #187120) with a two-parent merge; no rebase. Git applied the merge without textual conflicts. The three named tests (status.gather,run.option-collisions, andserver-startup-schema-refusal) retain the existing L1939 expectations unchanged while main's cron receipt synchronization and mock-export cleanup are included. No additional production or test changes were needed. This integration supersedes the earlier cron race/main-baseline failure evidence below.Proof on the merged source, with isolated
HOMEandOPENCLAW_STATE_DIRunder this worktree's.artifacts/l1939-main-merge/:pnpm build: exit 0, 237.35 s wall; includescheck-cli-bootstrap-imports(10.6 s), SDK exports/declarations and Control UI packaging.OPENCLAW_VITEST_RUNTIME=node|bun node scripts/run-vitest.mjs run <files> --maxWorkers=1: Node 210 passed (235.16 s wall); pinned Bun 202 passed, 7 existing runtime-specific skips (250.50 s wall). All named merge-boundary tests and all four cron routes passed on both runtimes.git diff --check: pass.node --import ./scripts/tsx.mjs scripts/check-test-mock-exports.mts --base origin/main: pass, 6486 grandfathered factories.node --import ./scripts/tsx.mjs scripts/check-test-lines-ratchet.mts --base origin/main: pass, 6,243,623 lines against 6,320,000 ceiling. The ceiling is inherited unchanged from merged main; this PR does not raise it. Relative to merged main, the mock baseline only removes the three entries already made obsolete by this PR's real-export-preserving mocks.The 11 files were
src/cli/daemon-cli/status.gather.test.ts,src/cli/gateway-cli/run.option-collisions.test.ts,src/gateway/server-startup-schema-refusal.test.ts,src/infra/sqlite-worker-shared-state.test.ts,src/cron/service.failure-alert-notifications.test.ts,src/gateway/server-shutdown.runtime.test.ts,src/gateway/server.spawn-broker.test.ts,src/commands/doctor-maintenance.finish-revalidation.test.ts,src/state/openclaw-agent-db.checkonce.test.ts,src/state/openclaw-state-db-checkonce.test.ts, andsrc/infra/sqlite-user-version.test.ts.Whole PR against merged main: production TypeScript +433/-129 (net +304); test/support +732/-732 (net 0). Integration adds no lane-authored production/test lines. No schema, persisted field, dependency or option changes. The PR remains unmerged.
Doctor recovery context and cron comparison —
d94ef166f06658717f449155c2023dce9228c4eeThe self-referential writer sentence was added by this PR in
7e527d5812ef. Doctor already suppressed its outer repair hint for newer schemas, but the shared SQLite error producer addeddoctor --fixagain for a same-version writer. The producer now accepts explicitruntime/doctor-maintenancecontext. Existing Doctor read admission carries that context through cold readers, warm readers, header checks and existing-schema/content checks. Runtime checkonce refusals retain their protected inspection advice. Doctor never recommends invoking itself for newer data; it omits the redundant same-version writer fact while retaining informative writer versions, schema/support facts, and the original backup/build recovery paragraph. No string post-processing, new authority rule, SQL change, persisted field, schema change, option or dependency.Before the fix, both offline Doctor permission modes (0600/0444) failed their no-repair-advice assertion. The new two-context × three-writer matrix also failed for Doctor on the old producer. The final matrix covers newer, same and unknown writers, preserves the original primitives and recovery assertions, and combines the schema/support checks into one stronger relationship assertion. The entire PR stays at 0 net test/support lines against main.
Local proof, isolated HOME/state under
.artifacts/, Node 26.12.1 and pinned Bun:doctor-maintenance.finish-revalidation.test.ts, both agent/shared-state checkonce files,sqlite-user-version.test.ts, andservice.failure-alert-notifications.test.ts. Node 165.18s, Bun 247.98s wall. The final matrix after the explicit-Boolean lint correction and combined schema assertion passes on Node in the importer run and on Bun (5 tests, 3.80s wall).OPENCLAW_VITEST_RUNTIME=nodeorbun, then runnode scripts/run-vitest.mjs run src/infra/sqlite-user-version.test.ts src/commands/doctor-maintenance.finish-revalidation.test.ts src/state/openclaw-agent-db.checkonce.test.ts src/state/openclaw-state-db-checkonce.test.ts src/cron/service.failure-alert-notifications.test.ts --maxWorkers=1.pnpm buildexits 0, 3m37.6s, including CLI bootstrap import guard passed (9.40s), SDK exports/declarations, runtime postbuild, UI and startup metadata. Core/targeted types, seven-file oxlint/oxfmt, whitespace checks and madge (0 cycles) pass. Fresh isolated Codex review of the production repair found no actionable P0/P1 issue.--base origin/main: 6,549 grandfathered factories; 6,311,468 / 6,311,490 test lines (22 slack); 48 changed source files, no new line-cap violation/growth. No baseline allowance was added.Cron was left unchanged as requested. The complete four-case file ran three times per revision, in this assigned worktree with a clean detached main baseline and restoration of the task branch. Package/lockfile inputs were unchanged between these revisions:
10f112972f4ec7efb2b14080977687ab0f36c56df25b36e95b0161b324ad772127264fb0021c4d6cAll main failures were the same receipt assertion: expected 1 alert, got 0, including the three reported owner cases. This is not a failure exclusive to the PR. Cron also passes on both runtimes with the final production repair. Existing Bun case costs were 38.327s (default owner) and 32.409s (deferred default owner); these unchanged fixtures exercise real session-event fallback, model-turn admission and per-state lifecycle drainage. Their individual component costs were not profiled; no timeout, retry or assertion was weakened.
The required Node importer replay selected 37 files using the changed production basenames in
rg -l ... --glob '*.test.ts' src extensions packages test. 562 tests passed, with 28 existing opt-in skips and the already-diagnosed inherited metadata fixture timeout:src/plugins/plugin-metadata-state-worker.test.ts/ reads committed live startup metadata without space for a database snapshot, 120.011s (file summed test time 131.308s). Total replay wall time 391.53s. Earlier untouched-base proof and its child-writerclose-event diagnosis remain below; this repair did not change that fixture. No new importer failure appeared. Full SQLite inventory remains skipped under the local gate budget; PR CI remains the broad proof.The repair adds 49 production TypeScript LOC to carry diagnostic context through the existing owners, plus 1 test line; the entire PR remains within the zero-net-test-lines requirement. Entire PR against merge base
56eba2fae267818e540d9826899c2288cf5aea08: +433 / −129 = net +304 production TypeScript LOC; +732 / −732 = 0 net test/support LOC. Main was fetched immediately before committing; #186898 remained open and no intervening main commit fixed these owners. The PR remains unmerged. Evidence below is historical for its named heads.Bootstrap build repair —
10f112972f4ec7efb2b14080977687ab0f36c56dRoot cause: the writer-version diagnostic statically imported
config/version, whose comparator imports the externalsemverpackage. SQLite bootstrap is also used by the native hook relay, so this expanded the relay's forbidden static graph. The SQLite message producer now reuses the existing dependency-freescripts/lib/release-version.mjscomparator for OpenClaw monthly alpha/beta/stable/correction releases. Unrecognized or absent writer versions remain non-newer diagnostics. The helper is included in the PR-wrapper source inventory. The synthetic future-writer fixtures use valid monthly patch9999.1.1; their assertions, including the escaped writer-version regex, are preserved. No bootstrap allowlist, dependency, schema, migration or updater admission change.Proof with isolated HOME and state under
.artifacts/on macOS:pnpm buildfailed after 3m24s with both reported native-hook-relaysemverimport errors. After the repair, fullpnpm buildexits 0 in 3m7.4s, includingCLI bootstrap import guard passed, SDK declarations/exports, runtime postbuild, UI build and final startup metadata. The bootstrap check itself took 9.22s. No skip-build or allowlist override was used.9999.1.0; correcting it to the fixture's9999.1.1retained the writer/update assertions. The complete Gateway option-collision file then passed 58 tests on each runtime: Node 42.31s, Bun 41.34s wall.rg -l "sqlite-user-version" --glob '*.test.ts' src extensions packages test, plus the existing replacement-file, read-only-status and preflight consumers: 21 files, 455.73s wall. After the fixture correction, the only remaining failure is the already-diagnosed inheritedsrc/plugins/plugin-metadata-state-worker.test.tscase, reads committed live startup metadata without space for a database snapshot, timing out at 120.156s (file summed test time 133.264s). Its fixture waits for a child writer'scloseevent after successful database work; earlier base proof in this PR reproduced the same failure, and that test is unchanged by the main integration. No timeout/retry/skip/assertion weakening was added. The other selected runnable cases passed; four existing skips remain.tsgousingtsconfig.core.json, targeted test types, touched-file oxlint/oxfmt, whitespace checks, and madge (0 cycles) pass. Both ratchets and line-cap check pass with normal--base origin/maincommands: 6,549 grandfathered mock factories; 6,311,467 / 6,311,490 test lines; 44 changed source files with no new line-cap violation/growth. An initial typecheck used the broad root config by mistake; the correct core and targeted configs pass.7e527d5812effound no actionable P0/P1 issue. The final escaped-regex correction is test-only and replayed on both runtimes. Full SQLite inventory remains skipped under the local gate budget; PR CI supplies broad proof.This repair changes two production lines in place, adds one inventory entry, and adds 0 net test lines. Entire PR: +372 / −117 = net +255 production TypeScript LOC; +714 / −715 = net −1 test/support LOC against main merge base
56eba2fae267818e540d9826899c2288cf5aea08. Main was fetched immediately before committing; #186898 remained open and no intervening main commit fixed this owner. PR remains unmerged. Earlier sections below are historical evidence for their named heads.Writer-version and Darwin CI repair —
7e527d5812ef02601ae76440666a983b25308f2bThe shared SQLite error producer and fleet preflight formatter now use the canonical OpenClaw version comparison. A schema number alone does not establish that the writer application is newer. Only a strictly newer recorded writer gets the newer-Gateway/install-skew wording and newer-install/update remedy. Same-version writers retain the original
doctor --fixinspection guidance; absent writers retain the original generic message. Supported-schema facts and restore-backup guidance remain. The regression table covers newer/same/unknown writers at both message producers. No migration or maintenance admission behavior changed in this repair.Both reported replacement-file tests failed before the fix. The new table also failed for same/unknown writers before the producer change. After the fix, the unchanged replacement-file tests pass, including their original same-version writer/Doctor assertion. Consumer fixtures that actually mean a newer writer now use an explicit future version.
The exact Darwin job log (run 40766816360 / job 123093055740) showed passing dependency-cache, wrapper, materialized-anchor and operation-lock tests, followed by a file-selection failure:
test/scripts/pr-git-invocation.test.tsdid not exist in the candidate. Main commit39b3d94413baadded that test together with its production owner and Darwin workflow. Main56eba2fae267818e540d9826899c2288cf5aea08was integrated to align workflow and source; no copied test, compatibility shim, skip or weakened assertion was added.Local proof on macOS, Node 26.12.1 and repository-pinned Bun, with isolated HOME/state:
sqlite-user-version, both replacement/check-once files, explicit-file preflight, Gateway startup schema refusal, Gateway option collisions, daemon status gathering, and update status read-only. 163 tests per runtime; Node 148.30s, Bun 110.20s. Final table/fixture consolidation was replayed on both runtimes: 2 files / 8 tests, Node 48.64s, Bun 22.73s.python3 -I -B test/scripts/pr-darwin-process-identity.test.py: 30 passed / 1 existing skip, 16.893s. The seven local tooling files cover dependency cache, wrappers, materialized anchors, operation locks, Git invocation, eager imports and wrapper source closure: 253 passed / 18 existing platform skips. The initial 750.24s replay exposed one host precondition: its explicitly offline native-GH test found the Octopool wrapper first on PATH. Replaying that file with/opt/homebrew/binon that test process's PATH passed 4 tests / 12 existing platform skips, 5.55s wall. Task GitHub reads continued through the normal wrapper. No test contract was changed.OPENCLAW_VITEST_RUNTIME=nodeorbunfollowed bynode scripts/run-vitest.mjs run <selected files> --maxWorkers=1. Core tsgo, targeted test/support types, touched-file oxlint, oxfmt and diff whitespace checks pass. Madge reports 0 cycles.--base origin/maincommands: mock exports 6,549 grandfathered factories; test lines 6,311,467 / 6,311,490 (23 slack); line cap 44 changed source files, no new violations or over-cap growth. There is no PR change to the test-line ceiling. The mock ledger only shrinks. SQLite inventory/fullcheck:changedremains skipped under the lane's local gate budget; CI is the broad proof.The whole PR is +372 / −117 = net +255 production TypeScript LOC, and +714 / −715 = net −1 test/support LOC, against the integrated main base. The test table and existing scoped fixture keep the budget negative without dropping the replacement-file or recovery assertions. Main was fetched immediately before committing; #186898 remained open and no intervening main commit fixed these owners. This PR remains unmerged.
The sections below are prior-head evidence and observations; their historical counts do not replace the current totals above.
Exact-head CI repair —
3db4714d20dcc0ee13e3d7d90e1a22e02acb6011The skew guard now preserves the schema owner's existing refusal order: verified schema-maintenance paths remain admitted, without an extra unconditional database-access assertion masking canonical migration errors. Newer-schema diagnostics retain the writer version, supported schema, refusing build and restore-backup guidance, and recommend the newer install or
openclaw update; a build facing a strictly newer writer never recommendsdoctor --fix; the latest repair above restores the original guidance for same-version or unknown writers. Doctor's entrypoint and installation-skew facts are one finding, with repair classification and authorization retained.The wrapper inventory includes both eagerly required installation-context modules. This fixes the lease/bootstrap closure and the provisioner preload that failed before recording its private-store injection; weakening worker admission or injection assertions was unnecessary. The changed dispatcher mock spreads real exports. The mock ledger shrank by exactly three stale entries (6,560 → 6,557), with no added allowance. The same-content attribution fixture keeps its writer alive through admission so committed WAL history stays observable; its refusal assertions are unchanged.
Validation against the final candidate:
node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts: 0 cycles. Fresh isolated Codex autoreview against77602e41ecacfound no actionable P0/P1 production defect; final assertion refinements preserve the same behavior.node --import ./scripts/tsx.mjs scripts/check-test-mock-exports.mts --base origin/main: 6,557 grandfathered factories, green.node --import ./scripts/tsx.mjs scripts/check-test-lines-ratchet.mts --base origin/main: 6,304,690 lines against a 6,310,000 ceiling, green.node scripts/check-line-cap-ratchet.mjs --base origin/main: 44 changed source files, no new violation or over-cap growth.Broader local proof is not entirely green. These additional failures reproduce with all 23 existing changed production paths pinned to untouched base
3ffc75eecb1f, followed by byte-for-byte restoration of the candidate:src/plugins/plugin-metadata-state-worker.test.ts— reads committed live startup metadata without space for a database snapshotcloseevent. No timeout/retry/assertion change.src/cli/daemon-cli/install.definition-repair.test.ts— pending recovery after an operator edit; retired LaunchAgent timeout 20/throttle 10; timeout 600/throttle 1ServiceInspectionErrorinstead of the expected authority outcome, and legacy plist policy stays unchanged. These same-root fixtures bypass installation-skew handling.The macOS-only
test/scripts/pr-worktree-provision.test.tsfull cold/warm sibling + sparse-transition case also exceeds its existing 120s limit: 201.094s on Node, 206.150s on Bun. It runs six serial native provisions plus sparse transitions; the runnable original CI-private-store cases all pass. This pre-existing host-cost limitation is recorded under the lane ruling, not hidden by a larger timeout, retry, or skip. PR CI remains the broad proof; the SQLite inventory/fullcheck:changedis skipped under the local gate budget.Main was fetched immediately before publishing; #186898 remained open and no newer main commit touched these owners during the lane. This repair is net −7 production LOC; the entire PR is +356 / −117, net +239 production TypeScript LOC, with 0 net test/support LOC. No merge performed.
Managed-update review repair —
77602e41ecac631a770ffeb593bcd11f7fdf693dAccepted P1 on the previous head: the service-skew refusal ran before Doctor could recognize its updater or private rehearsal. Candidate Doctor must repair while the service definition still points at the previous installation. Preflight now resolves the existing rehearsal/legacy guards and live-driver continuation first. Ordinary Doctor, including a bare update flag without a verified continuation, still refuses pending migrations. The shared-state runtime recognizes the existing exact-database schema-maintenance owner used by candidate/finalize Doctor and update repair.
The real CLI proof also exposed a later callback failure: an environment-only plugin-repair callback omitted the actor's known service-install facts. The broker now retains its original facts across those callbacks and rejects conflicting supplied facts. Native ownership and commit admission still run. The worker regression fails on the old broker policy, then passes through the real writer and commit-admission path.
Final validation on Node 26.12.1 and the repository-pinned Bun fork:
doctor-update-schema-guard.test.ts,openclaw-state-db-schema-policy.test.ts, andsqlite-worker-shared-state.test.ts.OPENCLAW_VITEST_RUNTIME=node/bunwithnode scripts/run-vitest.mjs run <selected files> --maxWorkers=1, isolatedHOMEandOPENCLAW_STATE_DIRunder.artifacts/.d07976cc37ae79c0f702263e24c150f72135f7d1: no actionable P0/P1 findings.The fresh two-root fixture kept CLI 2026.10.8 and service install 2026.10.3. The managed case used a real update-ledger record naming its synthetic live parent, with PID/start identity and ancestry admission. The service definition continued to point at the older root. Both cases invoked:
The product exit/schema results were independently validated from the captured output. A harness-only expectation that Doctor would restamp
schema_meta.app_versionwas removed after checking its existing owner: Doctor preserves that stamp (2026.10.3 here). This repair keeps that behavior and adds no persisted field.The existing Doctor guard file took 164.97s on Node and 254.60s on Bun (an earlier Bun run took 333.55s). Its existing SIGINT backup case took 17.461s on Node and 30.554s on Bun, with an earlier Bun observation of 88.045s. These exercise real backup/maintenance/worker fixtures; individual Bun costs were not profiled. Recorded under the campaign's pre-existing-slow-suite ruling; no timeouts/retries were added or committed assertions weakened.
This follow-up is net +23 production LOC / −4 test-support LOC. Reusing the canonical backup fixture and table-driving backup/integrity refusal phases kept the test budget negative. Main was fetched immediately before publishing; the issue remained open and no newer main commit touched these owners during the follow-up. No merge performed.
Original authoring evidence
The original isolated two-root CLI reproduction migrated schema 35 → 36. The regression fails with the original schema runtime and passes with the guard, preserving the catalog and schema metadata. Skew reporting, stored-writer diagnostics, and the best-effort startup warning also have failing-before-fix coverage.
The live fixture used separate install roots (CLI 2026.10.8, service package 2026.10.3), a synthetic LaunchAgent definition, isolated
HOME/OPENCLAW_STATE_DIR, and an unused loopback port. Every command below usednode openclaw.mjs --profile upd-l1939; no fixture service was loaded.agents list, older service, schema 35statusgateway statusdoctor --fixagents list, current schema 36agents list, service entrypoint changed to matching installagents list, service package version unavailablegateway run --auth none --allow-unconfigured --port <unused-port>, schema 37 / writer 2026.10.9openclaw update)Representative output (synthetic roots abbreviated):
Validation: core tsgo, targeted test types, touched-file oxlint/oxfmt, madge (0 cycles), full runtime build/bootstrap import guard, and the focused regression suites. Both related E2E importer files passed (5 tests; 74.63s wall, 27% test time).
Pre-existing slow files encountered (summed test time): Gateway agent-database startup 151.3s, Gateway reload handlers 141.2s, and Doctor update-schema guard 284.5s. These exercise repeated fresh Gateway/backup/maintenance lifecycles; no test exceeded 30s in the original importer run. They were recorded under the campaign's pre-existing-slow-suite ruling.
Additional existing slow-test observations
src/cli/update-cli.target-schema.test.ts(file total)src/gateway/session-history.subagent-visibility.test.ts(file total)src/skills/workshop/library.test.ts— archiveUnusedWorkshopSkills > fails closed at the sandbox guardsrc/flows/doctor-health.update-schema.test.ts— refuses an unfenced state upgrade (2026.9.2, json=true)src/infra/state-migrations.owner-mismatch.test.ts— runs independent repairs while refusing divergent copiessrc/gateway/session-history.subagent-visibility.test.ts— subagent coordination history > rejects prepared history after source authority changes (projected-fast-path)src/agents/worktrees/registry-read.test.ts— preserves registry and checkout on refused publication (checkout lease)These existing tests exercise real repair, Git, worker, and publication fixtures. Their individual costs were not profiled in this lane; no retries, timeouts, or assertions were weakened. Recorded under the pre-existing-slow-suite ruling.
The SQLite inventory/full
check:changedwas skipped under the lane's local gate budget; PR CI supplies the broad repository gates. The related-importer selection covered 364 files. An early plan was invalidated by source edits; its interrupted files were replayed with the source frozen. The only remaining failures came from the shared dispatch fixture omitting real LaunchAgent exports; preserving those exports, isolating service inspection, and resetting queued programs fixed them. All four fixture consumers then passed: 4 files / 95 tests, 15.84s wall. The final proxy-helper extraction passed another 15 files (including 227 CLI tests), plus rebuilt bootstrap boundaries and the repeated live matrix. Existing platform skips are unchanged.Review: local ClawSweeper was unavailable. Isolated Codex autoreview against base
3ffc75eecb1f2ea29b97602b76b26d58750284adcompleted with no actionable P0/P1 findings. Fresh independent review caught the agent-only Doctor case; it is fixed and covered by the existing rehearsal regression. The final review includes the typing, diagnostic, mock, and proxy-extraction corrections; the initial authoring snapshot wasd07976cc37ae79c0f702263e24c150f72135f7d1.Production TypeScript (entire PR): +356 / −117, net +239 LOC. Net test/support LOC: 0. The entrypoint line-cap ratchet also passed after moving its existing proxy-bootstrap functions unchanged into a sibling owner. Native scoped cleanup and existing-fixture consolidation preserve the prior assertions while making room for the regressions.