Repository navigation
fix: unblock upgrades with retired JSON state - #174489
Conversation
Move retained cron, OAuth, and runtime JSON recovery into Doctor-owned migrations. Archive obsolete sources with verified original bytes and actionable recovery warnings, and allow update admission to reach the current repair path. Keep canonical SQLite values authoritative and protect custom cron locators during config-only recovery. Fixes #174343.
|
🦞👀 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: f86ebb0c13
ℹ️ 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".
| } catch (error) { | ||
| result.warnings.push(`Could not import ${relative}: ${String(error)}. ${recovery}`); | ||
| } | ||
| backup.removeSource(() => undefined); |
There was a problem hiding this comment.
Preserve runtime sources when their SQLite import fails
When a retired runtime file parses but its import callback fails—for example because the SQLite transaction cannot be completed—the catch converts the failure to a warning and this line still removes the source. The backup preserves bytes, but the next Doctor run no longer detects the source, so Voice Wake settings, bindings, or approvals cannot be retried automatically and remain absent from canonical state. Only archive malformed/unsupported content; retain or restore the active source for operational import failures.
AGENTS.md reference: AGENTS.md:L81-L82
Useful? React with 👍 / 👎.
| for (const [filePath, backup] of backups) { | ||
| assertCurrent(); | ||
| backup.removeSource(() => undefined); |
There was a problem hiding this comment.
Keep cron sources after an operational import error
If parsing succeeds but loadLegacyCronRepairState throws—for example because the SQLite store or worker is temporarily unavailable—the broad catch records a recovery warning and execution reaches this unconditional source removal. A later Doctor run therefore cannot retry the automatic cron import, leaving the jobs inactive unless the operator manually reconstructs them from the archive. Archive malformed definitions as intended, but preserve the original files when the canonical-store operation fails.
AGENTS.md reference: AGENTS.md:L81-L82
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cb58fb83e
ℹ️ 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".
| return resolveLegacyOAuthSecretKeyFileCandidates(env).filter( | ||
| (candidate) => !isPathInside(stateDir, candidate), | ||
| ); |
There was a problem hiding this comment.
Allow legacy OAuth keys inside custom state roots
When OPENCLAW_STATE_DIR is the historical key directory itself—for example $XDG_CONFIG_HOME/openclaw on Linux—this filter discards the valid auth-profile-secret-key candidate solely because it is inside the state root. Doctor then treats an otherwise decryptable sidecar as configured-unavailable, archives the auth sources, and forces the operator to reauthenticate even though the required key exists; retain these known key-file candidates regardless of their relationship to the custom state path.
AGENTS.md reference: AGENTS.md:L82-L84
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. What this changesThis PR restores Doctor-owned imports and verified archival of retired JSON state so older installations can upgrade. Example: An installation retains cron/jobs.json from OpenClaw 2026.5.26.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 6 items remain Keep this PR open: it addresses a confirmed upgrade dead end, but custom state roots can strand recoverable OAuth credentials. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherDoctor consumes legacy configuration and state under maintenance ownership, imports supported records into existing SQLite owners, and preserves obsolete inputs in recovery archives before update admission proceeds. flowchart TD
A[Legacy JSON state] --> B[Doctor maintenance ownership]
B --> C[Parse and import]
C --> D[Existing SQLite owners]
C --> E[Verified recovery archives]
D --> F[Update admission]
E --> F
Technical reviewBest possible solution: Provide a convergent Doctor migration that recovers available credentials, preserves canonical state and original bytes, and maintains current authorization boundaries. Do we have a high-confidence way to reproduce the issue? Official-release logs establish the upgrade dead end, current main retains its refusal, and source inspection establishes the custom-root key exclusion without executing target code. Is this the best way to solve the issue? Restoring imports under existing Doctor and SQLite owners addresses the central refusal safely in principle; the key lookup must retain valid historical candidates. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cc16c381ebff. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: shipped entry point. SecurityNeeds attention: Imported approvals reach automatic binding decisions, and their final-effect authorization scope remains unproven. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +1104, Tests +460, Docs +12. Total +1576 across 48 files. Added test files: 4. View PR surface stats
Review metrics
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 16, 2026, 2:13 PM ET / 18:13 UTC. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d21351a9f6
ℹ️ 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".
| // Configured absolute/tilde locators are not rewritten by the directory owner. | ||
| // Keep their preserved credential bytes recoverable without restoring a legacy alias. |
There was a problem hiding this comment.
Preserve relocated cron sources before repairing config
When cron.store points inside the legacy root—for example ~/.clawdbot/cron/jobs.json—this rename moves the JSON to .openclaw, but only OAuth locators receive relocation handling. The later cron import resolves the unchanged cron.store path in migrateRetiredCronState, finds no source, and config repair can then remove the retired selector, leaving the user's jobs stranded and absent from SQLite without a recovery warning. Translate the cron locator to the moved path for the import or defer relocation until it is consumed.
AGENTS.md reference: AGENTS.md:L51-L53
Useful? React with 👍 / 👎.
|
Landing with two red checks that also fail on current
This PR's own failures from earlier runs (lint, database-worker ratchet) are fixed on this head; no assertions or baselines were weakened. |
PR #174489 (956dd5d) replaced plugin-install-index with retired-core-state. The new owner still includes plugins/installs.json and archives it with recovery instructions; it did not omit that work. Update the process test's exact phase list to match that intended plan. Keep the session-target-outside-snapshot refusal, exact step order, blocked later steps and byte-identical copied state assertions intact. Update behavior is unchanged: current Doctor handles retired state, and a migration plan still refuses a session store outside its snapshot. No production code changes. Proof on a1c6b9e with Node 24 and maxWorkers=1: - The assigned failure reproduces before and passes after the change. - Complete file: 18/20 before, 19/20 after (194.38s). The remaining, untouched preview case hit its explicit one-second git rev-parse deadline under local load. An earlier preview failure passed in an isolated diagnostic and in the final full run; neither is claimed fixed. - Execution-side target-discovery/refusal check passes (124.30s with preparation), confirming the same retired-core-state prelude. - CLI/update test typecheck, targeted lint, format and whitespace pass. - Independent P2 review is scoped-clean. No timeout, retry, skipped assertion or CI rerun was added.
Owner refactors left unused exports and moved deprecated outbound test calls into a scanned shared helper. Use the supported durable send API while keeping the prior queue default, result arrays, and error behavior. Remove dead helpers, internalize local implementations, and keep catalog discovery with its owner. Keep the public quota type for declaration emission and check the marker at its producer. Receipt tests use the canonical file reader with unchanged byte assertions. The client credential API is intentionally staged by #174294; model its entry until cutover instead of deleting the unactivated owner. No Knip ignores or credential implementation changes. Proof: deadcode dependencies/exports/unused-files and deprecated API guards pass; core/scripts/UI and affected test types, declaration emission, targeted lint/boundary lint/format, and P2 review pass. Focused quota/Doctor tests pass (53.0s wall), as do 49 completion tests (160.21s wall), using maxWorkers=1. Remaining importer proof and inherited architecture findings are recorded in the PR. The full architecture command reaches four unchanged legacy sentinel references from #174489; no baseline or assertion is weakened.
* fix(ci): restore dependency and runtime hygiene checks Owner refactors left unused exports and moved deprecated outbound test calls into a scanned shared helper. Use the supported durable send API while keeping the prior queue default, result arrays, and error behavior. Remove dead helpers, internalize local implementations, and keep catalog discovery with its owner. Keep the public quota type for declaration emission and check the marker at its producer. Receipt tests use the canonical file reader with unchanged byte assertions. The client credential API is intentionally staged by #174294; model its entry until cutover instead of deleting the unactivated owner. No Knip ignores or credential implementation changes. Proof: deadcode dependencies/exports/unused-files and deprecated API guards pass; core/scripts/UI and affected test types, declaration emission, targeted lint/boundary lint/format, and P2 review pass. Focused quota/Doctor tests pass (53.0s wall), as do 49 completion tests (160.21s wall), using maxWorkers=1. Remaining importer proof and inherited architecture findings are recorded in the PR. The full architecture command reaches four unchanged legacy sentinel references from #174489; no baseline or assertion is weakened. * fix(ci): preserve live GitHub digest and localize unused helpers Main d25d32d (#173712) added an Enterprise session-reader consumer after the original audit base. The first PR merge build failed with MISSING_EXPORT/TS2305 because the hygiene commit removed its helper. Restore factoryGitHubRequestDigest exactly as on main and rebase for the named build failure, preserving request binding and authorization checks. The current export scan also finds three helpers used only by their own modules: sessionGitHubRepositoryUrl, copyProgressDraftLineMetadata and cloneBoardSnapshot. Make them private; keep all implementations intact. The progress snapshot consumer was retired deliberately in #174559. Proof: CI artifact build passes (377.09s); 39 Enterprise consumer tests pass (95.55s, --maxWorkers=1). Four visibility suites pass (347.37s, --maxWorkers=1); export scan passes with zero findings (202.10s). Fresh P2 review is scoped-clean. Additional local type, lint and importer proof is recorded in the PR. * chore(ci): leave UI helper cleanup to focused peer fix READY PR #174625 now covers the exact openNewSessionPlusMenu deletion. Restore this file to the base version so this branch contains only the remaining hygiene repairs. No UI code or assertions differ from main. The duplicate guard verified the peer's diff and fresh OPEN/non-draft state. P2 review of this scope reduction is clean; existing runtime, export, type and owner-test proof remains valid for the retained changes. * chore(ci): defer parser fixture cleanup to existing PR The final duplicate guard found READY PR #174631 with the exact observeJsonParse deletion. Restore the fixture to the base version so this PR no longer overlaps that active cleanup. Its importing tests and assertions are unchanged and had already passed locally. Fresh P2 review is clean. Retained runtime changes keep their completed build, focused test, type, lint and declaration proof.
…d-ending updates (openclaw#174489) Updating an install whose state predates July 2026 dead-ended: 10.x refused retired JSON state (delivery queues, cron state, OAuth sidecars, runtime state) and told operators to upgrade through 2026.9.7, but 9.x could not complete that pass. The retired importers had been removed while their refusal guards remained. Doctor now migrates cron jobs, referenced OAuth sidecars and runtime state directly in migration code (runtime never reads legacy shapes), keeps current SQLite values authoritative, and archives obsolete or malformed files byte-for-byte; sources stay in place and the migration fails visibly (admission stays blocked for retry) when a SQLite import fails, and are archived only after a successful commit. The 'upgrade through 2026.9.7' dead-end guidance is removed. Live: refusal -> Doctor complete -> update admission admit, with 19 exact-byte archives and migrated rows verified. Fixes openclaw#174343
PR openclaw#174489 (448dbf5) replaced plugin-install-index with retired-core-state. The new owner still includes plugins/installs.json and archives it with recovery instructions; it did not omit that work. Update the process test's exact phase list to match that intended plan. Keep the session-target-outside-snapshot refusal, exact step order, blocked later steps and byte-identical copied state assertions intact. Update behavior is unchanged: current Doctor handles retired state, and a migration plan still refuses a session store outside its snapshot. No production code changes. Proof on 5d76018 with Node 24 and maxWorkers=1: - The assigned failure reproduces before and passes after the change. - Complete file: 18/20 before, 19/20 after (194.38s). The remaining, untouched preview case hit its explicit one-second git rev-parse deadline under local load. An earlier preview failure passed in an isolated diagnostic and in the final full run; neither is claimed fixed. - Execution-side target-discovery/refusal check passes (124.30s with preparation), confirming the same retired-core-state prelude. - CLI/update test typecheck, targeted lint, format and whitespace pass. - Independent P2 review is scoped-clean. No timeout, retry, skipped assertion or CI rerun was added.
* fix(ci): restore dependency and runtime hygiene checks Owner refactors left unused exports and moved deprecated outbound test calls into a scanned shared helper. Use the supported durable send API while keeping the prior queue default, result arrays, and error behavior. Remove dead helpers, internalize local implementations, and keep catalog discovery with its owner. Keep the public quota type for declaration emission and check the marker at its producer. Receipt tests use the canonical file reader with unchanged byte assertions. The client credential API is intentionally staged by openclaw#174294; model its entry until cutover instead of deleting the unactivated owner. No Knip ignores or credential implementation changes. Proof: deadcode dependencies/exports/unused-files and deprecated API guards pass; core/scripts/UI and affected test types, declaration emission, targeted lint/boundary lint/format, and P2 review pass. Focused quota/Doctor tests pass (53.0s wall), as do 49 completion tests (160.21s wall), using maxWorkers=1. Remaining importer proof and inherited architecture findings are recorded in the PR. The full architecture command reaches four unchanged legacy sentinel references from openclaw#174489; no baseline or assertion is weakened. * fix(ci): preserve live GitHub digest and localize unused helpers Main faa7f43 (openclaw#173712) added an Enterprise session-reader consumer after the original audit base. The first PR merge build failed with MISSING_EXPORT/TS2305 because the hygiene commit removed its helper. Restore factoryGitHubRequestDigest exactly as on main and rebase for the named build failure, preserving request binding and authorization checks. The current export scan also finds three helpers used only by their own modules: sessionGitHubRepositoryUrl, copyProgressDraftLineMetadata and cloneBoardSnapshot. Make them private; keep all implementations intact. The progress snapshot consumer was retired deliberately in openclaw#174559. Proof: CI artifact build passes (377.09s); 39 Enterprise consumer tests pass (95.55s, --maxWorkers=1). Four visibility suites pass (347.37s, --maxWorkers=1); export scan passes with zero findings (202.10s). Fresh P2 review is scoped-clean. Additional local type, lint and importer proof is recorded in the PR. * chore(ci): leave UI helper cleanup to focused peer fix READY PR openclaw#174625 now covers the exact openNewSessionPlusMenu deletion. Restore this file to the base version so this branch contains only the remaining hygiene repairs. No UI code or assertions differ from main. The duplicate guard verified the peer's diff and fresh OPEN/non-draft state. P2 review of this scope reduction is clean; existing runtime, export, type and owner-test proof remains valid for the retained changes. * chore(ci): defer parser fixture cleanup to existing PR The final duplicate guard found READY PR openclaw#174631 with the exact observeJsonParse deletion. Restore the fixture to the base version so this PR no longer overlaps that active cleanup. Its importing tests and assertions are unchanged and had already passed locally. Fresh P2 review is clean. Retained runtime changes keep their completed build, focused test, type, lint and declaration proof.
…176504) Adds a doctor compatibility inventory record (doctor-pre-july-retired-state, removeAfter 2026-11-29) for the pre-July JSON state importers restored by #174489 to fix the #174343 dead end, plus pointer comments in the four restored importer modules, so the release removal check deletes them after the window. No runtime behavior change.
…penclaw#176504) Adds a doctor compatibility inventory record (doctor-pre-july-retired-state, removeAfter 2026-11-29) for the pre-July JSON state importers restored by openclaw#174489 to fix the openclaw#174343 dead end, plus pointer comments in the four restored importer modules, so the release removal check deletes them after the window. No runtime behavior change.
Fixes #174343
What Problem This Solves
Fixes the update dead end where pre-July JSON state makes current Doctor or update admission require an intermediate release that cannot complete the operator's repair.
User Impact
Operators can run current
openclaw doctor --fixand continue upgrading. Doctor imports legacy cron definitions/runtime state, referenced OAuth credentials, Voice Wake settings, conversation bindings, and default-home plugin approvals into existing SQLite owners. Current SQLite data wins, and original bytes are preserved in named archives.Obsolete delivery queues, plugin indexes, sandbox registries, replay ledgers, and restart notifications are archived with recovery instructions. Old deliveries are never replayed automatically. Doctor tries both historical OAuth key files and, in an interactive terminal, the existing macOS Keychain entry; missing keys leave archived ciphertext and give
openclaw models auth login --provider openaias the forward path. Restoring archived sources does not replay a completed credential import.Why This Change Was Made
Importer removal left refusal guards as the only owner of several shipped state formats. The base refusal at lines 37–40 still directs operators to 2026.9.7. Source history identifies removals in
ff96d47c3506(delivery queues),a8c1182c16eb(cron),d12a2cf036c5(OAuth sidecars),f77ceef31812(pre-June OAuth), and3543c6bb0895(runtime JSON).Restore the shipped parsing logic under Doctor's existing maintenance and migration owners, and reuse the existing verified backup/receipt owners for archival. Runtime readers stay on current formats. Admission keeps importable user-state sources pending until current Doctor has committed them, and refuses sources it cannot inspect; transient archives remain advisory. Config-only recovery retains the guard against discarding a custom cron locator before its source is imported; its recovery action is current Doctor. No schema, dependency, or public option changes.
The simplification removes obsolete refusal paths and refusal-only tests. The remaining growth is the one-shot import logic needed to repair every refused category together. A binary archive regression also fixes a shared verifier that hashed decoded UTF-8 instead of original bytes. The historical OAuth reader only tried its first key-file candidate; Doctor now tries both existing locations without adding an environment option. Missing sidecars leave the auth source pending so correcting a stale locator and rerunning Doctor still recovers the credentials. Unattended runs preserve the existing no-Keychain-prompt contract.
Evidence
Latest two-red recheck (head d21351a)
Both remaining failures are inherited on current
origin/main(f6f939a8ebc65fc9bbe6c01b6723677e94a9614f). The newer CI merge is22791d7d0d6af6cf8cc09d05e010716f5c43efbf, combining this PR with main571eaa2a5927295874564af075ba99015a57cc6b. This Matrix failure is distinct from the earlier missing-receipt failure recorded below.openrouter/openrouter/autoadvisory.promise resolved { phase: 'preflight', ... } instead of rejectingfailures on both plain main and this PR cleanly merged with the same main in a temporary checkout. Main 41.37s Vitest / 47.81s wrapper; PR comparison 46.38s / 53.98s.a1bdebdb9f8dec868e069700f39422f36ad81e22correctly makes roots with zero legacy inbound-dedupe rows port-ready. The fixture creates only canonicalidb-snapshotchunks, but its shared setup still expects the earlier one-time-scan refusal added byf2478e569a15.The Matrix detector, portability test, and port-preflight owner are byte-identical between the two comparison trees and between CI's main base and current main. This failure occurs at the shared fixture's initial dry-run assertion, before its Doctor repair block or any port publication. No retired sources were archived or reclassified by this PR to produce the result.
Commands used fresh isolated HOME/OPENCLAW_STATE_DIR/cache directories. Doctor:
OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs --config test/vitest/vitest.unit-src.config.ts src/flows/doctor-core-checks.test.ts --maxWorkers=1. Matrix:node scripts/test-database-conformance.mjs --engine postgres --connection postgresql://[email protected]:32771/postgres -- src/infra/database-engine/matrix-roots.postgres.test.ts --maxWorkers=1. The owned local PostgreSQL container used CI's pinned pg17/pgvector image and was removed afterward. No test assertion, baseline, or production code was changed.The unchanged Matrix detector regression also passed on the PR/current-main combination: a fresh snapshot root returns no migration, then adding a real legacy inbound-dedupe row reports pending migration (725ms test; 30.94s Vitest including preparation). This verifies that actual legacy rows retain their blocking semantics.
CI repair and exact-source comparison
CI run 38943317928 tested merge
016a42a64cf09519fa463161d5d58b3e38f34f4c, combining PR head0cb58fb83e3211a545b00b73544c758366fca124with main7e1e6cfc4e18528de2dd3a897049d5f860742ddc. Comparisons below use the original PR head, that exact merge where newer-main tests are involved, and an untouched detachedorigin/mainatb4569473a552d5dc10f8ce2f19d0084b449d7dc0. Every command used a separate HOME, OPENCLAW_STATE_DIR, and test cache under this worktree's.artifacts/.check-lint-core-1typescript(no-unnecessary-type-conversion)inlegacy-oauth-sidecar.ts:336. Plain main lacks that new conversion. Removed the redundant Boolean call. The corrected stripe has no remaining finding in either changed file; focused lint withconfig/tsconfig/oxlint.core.jsonpasses. Local strict line-limit findings in untouched files are inherited; 16 affected paths also fail on current plain main and another older main path has since been refactored. Hosted CI reports these limits as warnings. No rule, limit, or baseline changed.checks-fast-baseline-ratchets/ database-workerimportConfigMachineState; plain main passes. The batch import can select the credential row, so the guard correctly requires a reviewed caller. Replaced the Voice Wake calls with the existing scalar atomic updater using literal noncredential keys and keep-current-or-import callbacks. The exact ratchet now passes (222 → 222T1 calls and12 → 12compatibility calls); no guard exemptions or baseline changes.matrix-roots.postgres.test.ts0instead of2publication calls on resume/rollback. None of these owners differs from CI's main parent. Plain main passes 3/3 with existing fixf2478e569a150583622632387fe616f23eb833fc, which repairs the fixture through the registered Doctor migration before porting.openrouter/openrouter/autoadvisory. Main commiteaaf5533213de19e614689d7b5bdb539d05fa92badded static Jev rows, causing model-reference validation to treat the runtime-discovered OpenRouter catalog as exhaustive. This PR did not change the test or model-validation owner.47edda1e4d2294826fff66c0a3d41defff768354changed runtime-config lookup, exposing the fixture's missing accepted store resolver. Current main passes all 12 with existing fixf527f20f741d00183ece27517f4f0a20db1a1b6d.Exact static commands:
node --import tsx scripts/run-oxlint-shards.mts --only=core --split-core --core-stripe=1/5 --threads=1, followed by stripe2/5;node --max-old-space-size=4096 --import ./scripts/tsx.mjs scripts/check-database-worker-ratchet.mts --base 7e1e6cfc4e18528de2dd3a897049d5f860742ddc.Exact Bun comparison:
OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs --config test/vitest/vitest.unit-src.config.ts src/flows/doctor-core-checks.test.ts src/sessions/session-state-events.worker-control.test.ts --maxWorkers=1. Original branch: 26/26 pass, 56.46s wall. Plain main: 25/26 pass with only the inherited model assertion, 66.07s wall. Source preparation took 30.445s and 33.9s respectively.Exact PostgreSQL comparison:
node scripts/test-database-conformance.mjs --engine postgres --connection postgresql://[email protected]:32770/postgres -- src/infra/database-engine/matrix-roots.postgres.test.ts --maxWorkers=1. Used CI's pinned PostgreSQL 17/pgvector image in an owned local container, removed afterward. Main: 3/3 pass, 194.97s Vitest / 207.46s wrapper (cases 64.722s, 53.192s, 20.897s). CI merge: all three failures, 87.08s Vitest / 101.97s wrapper; the tests themselves used 24.711s. This existing real port/backup/recovery suite is slow; no timeout or assertion was weakened.The exact CI-merge Bun replay completed with the original nine failures (the Doctor model assertion and eight worker-control failures), 17 passes, and 424.09s wall time. The three worker waits each reach the existing 120-second timeout because the missing resolver prevents the fixture's deferred operation from starting. Current-main worker cases finish in milliseconds; neither timeouts nor assertions were changed here.
Post-fix proof: all 16 direct/barrel-import affected test files passed (352 tests; five selected shards in 391.17s), including all four runtime SQLite rejection/source-retention/retry regressions and canonical-value preservation. Core tsgo, touched-file type-aware oxlint, oxfmt,
git diff --check, and madge (0 cycles) passed. The exact full core stripe replay now has only inherited untouched line-limit findings. Independent review found no actionable P0–P2 defect. This follow-up is production +12/−4, with no new test code; existing failure/retry regressions cover the changed contract.Live revalidation on committed
d21351a9f6911f993ee7f7c5d845d7e236ce2c9d: usedHOME/OPENCLAW_HOME=.artifacts/l1650/ci-live-home,OPENCLAW_STATE_DIRat its.openclaw, explicit config/profile selection, and synthetic port 62947. No Gateway was started.pnpm openclaw --profile l1650-proof update admit --context <synthetic-context.json>exited 3 and all 20 fixture files remained byte-identical.pnpm openclaw --profile l1650-proof doctor --fix --non-interactiveexited 0 (Doctor complete.). Verification found 19 exact-byte archives and committed cron, Voice Wake, conversation binding, plugin approval, and both OAuth credentials. Final admission exited 0 withverdict: admit, empty reasons, and empty warnings. The build completed from the committed source.Persistence-failure repair
The follow-up fixes a data-loss path in the restored cron/runtime importers: a catch covered both rejected JSON and SQLite errors, then source cleanup ran. The shared retired-state owner now parses separately from persistence. Only intentionally rejected input or a completed commit lets an importable source reach archival. SQLite load/write failures retain live sources, propagate a visible failed step, and keep admission refused with
openclaw doctor --fixguidance. Successful archive warnings are advisory; lock and persistence failures remain blocking.Reproduction on
f86ebb0c: five new cases failed (four runtime import failures and a cron SQLite-load failure). Final regressions also inject a real cron write rejection inside its transaction; sources remain byte-identical, no rows are committed, and clearing the fault lets a rerun import and archive them. Malformed-input and current-value preservation cases pass.All 14 affected sibling files passed (392 tests); after the final parser cleanup and successful-step classification, the two owning files passed again (13 tests). Core and changed-test typechecks, direct oxlint/oxfmt,
git diff --check, and the import-cycle check passed (0 cycles). Final independent review found no actionable P0–P2 issues. No timeouts or assertions were weakened. The final 13-test run took 74.67 seconds wall time, dominated by compilation; the runtime file reported 95% transform and 2% test time.Live proof on committed
0cb58fb83e32: explicitHOME/OPENCLAW_HOMEat.artifacts/l1650/followup-live-home,OPENCLAW_STATE_DIRat its.openclawdirectory, matchingOPENCLAW_PROFILE=l1650-proofand explicitOPENCLAW_CONFIG_PATH, with isolated port 56188. In an authority-free child environment,pnpm openclaw --profile l1650-proof update admit --context "$PWD/.artifacts/l1650/live-admission-context.json"exited 3 for the actual legacy sources; all 20 fixture files remained byte-identical.pnpm openclaw --profile l1650-proof doctor --fix --non-interactivethen exited 0 (Doctor complete.). Verification found 19 byte-exact archives plus the migrated cron definition, Voice Wake setting, conversation binding, plugin approval, and OAuth credential. The same admission command then exited 0 (admit). The initial harness attempt was rejected for inherited supervisor metadata; an empty-profile probe was discarded and repeated with explicit profile/config selection. Neither was counted as migration proof.OAuth audit: the existing receipt owner verifies persisted credentials before archival, and import/commit/verification errors preserve both auth sources and referenced sidecars. It remains separate from the generic archive helper. Delivery queues, plugin indexes, and sandbox registries intentionally archive transient bytes without SQLite import; state-directory migration relocates the preserved tree.
Simplification shares cron source enumeration and parse/commit/archive ordering, reuses number normalization, and deletes redundant parser/inspection code. The still-active runtime/plugin-index refusal shells were retained. This follow-up is production +172/−174 (net −2) and tests +222/−29; no schema, dependency, public option, or baseline changes.
Real CLI, isolated synthetic HOME/state/profile:
pnpm openclaw --profile l1650-proof doctor --fix --non-interactiveexited 0 withDoctor complete.Verified 19 retired originals were removed only after byte-identical archives existed; cron definition/runtime state, both synthetic OAuth profiles, Voice Wake settings, bindings, and approvals were present in current SQLite. The recovery capture manifest existed before repair.Same isolated state:
pnpm openclaw --profile l1650-proof update admit --context <synthetic-context.json>exited 0 with{"verdict":"admit","reasons":[],"warnings":[]}. No operator state or existing Gateway was used.Untouched-base comparison at
5aec205816506ceb6983a5ab1c549c9e0b301a61: all seven new cron/OAuth cases fail at the retired-source refusal. The repair fixtures cover plaintext/encrypted OAuth, stale-primary/valid-fallback keys, unavailable keys, malformed cron data, and preservation of canonical data and source bytes.Exercised all 213 selected affected-consumer test files across scoped runs. After the final corrections, the four affected suites passed all 72 tests (124.54s in Vitest; 265.30s including preparation). The missing-sidecar retry, plaintext/encrypted/fallback-key imports, byte-identical archives, config-only cron protection, and verified-account session routing pass.
Core typecheck, changed-test typecheck, direct oxlint/oxfmt, four-page MDX check, line-cap ratchet, import-cycle check, and
git diff --check: passed. Final independent review was scoped-clean through P2. Runtime and E2E builds completed successfully.Known inherited proof limitations: unchanged
src/state/openclaw-state-ownership.test.tsreports fixture lock handles remaining open after cleanup (16 teardown failures in the affected run; the untouched base reproduces the same signature, with a 22-test cleanup cascade). The existing daemon-runtime-pin maintenance-lock release is the narrow suspect; the exact retained resource remains unproven. The environment-name check reports 453 against budget 452 on both the base and this patch; no budget was changed. Fullcheck:changedSQLite inventory was omitted because its SQLite inventory stalls on this host; PR CI remains the broad proof. No remote lease was used.Existing slow-test observations
src/commands/doctor-session-sqlite.deferred-plugin.test.tssrc/cli/update-cli/update-command-original-service.test.tssrc/cli/update-cli/update-command-lease.test.tssrc/commands/doctor-config-preflight.plugin-deferral.test.tssrc/cli/update-cli/update-command-fresh-preview.test.tssrc/commands/doctor-agent-deletion-journal.test.tsIndividual cases above 30 seconds:
src/commands/doctor.runs-legacy-state-migrations-yes-mode-without.e2e.test.ts— doctor command > runs legacy state migrations in yes mode without prompting: 36.1s.src/commands/doctor-session-sqlite.deferred-plugin.test.ts— session sources needed by deferred plugin migrations > settles a retained source in the same Doctor after late plugin completion (source changed: false, sibling pending: false, pending change: none, missing transcript: none): 46.2s.src/commands/doctor-session-sqlite.deferred-plugin.test.ts— session sources needed by deferred plugin migrations > settles a retained source in the same Doctor after late plugin completion (source changed: false, sibling pending: true, pending change: none, missing transcript: none): 31.3s.src/commands/doctor-session-sqlite.deferred-plugin.test.ts— session sources needed by deferred plugin migrations > settles a retained source in the same Doctor after late plugin completion (source changed: false, sibling pending: false, pending change: plugin, missing transcript: none): 41.5s.src/commands/doctor-session-sqlite.deferred-plugin.test.ts— session sources needed by deferred plugin migrations > settles a retained source in the same Doctor after late plugin completion (source changed: false, sibling pending: false, pending change: none, missing transcript: absent): 44.7s.src/commands/doctor-session-sqlite.deferred-plugin.test.ts— session sources needed by deferred plugin migrations > verifies canonical import and retains default originals until resolution without replay (missing transcript: false): 43.0s.src/commands/doctor-session-sqlite.deferred-plugin.test.ts— session sources needed by deferred plugin migrations > verifies canonical import and retains configured-root originals until resolution without replay (missing transcript: false): 49.6s.src/commands/doctor-config-preflight.plugin-deferral.test.ts— configured plugin migration deferral > inspects retained obligations through the broken contract: 33.3s.src/commands/doctor-config-preflight.plugin-deferral.test.ts— configured plugin migration deferral > doctor preserves pending inputs and retries after the package becomes available: 51.1s.src/plugins/doctor-contract-artifact.test.ts— Doctor artifact hash and loading agreement > keeps the selected bytes consistent across source and built hosts: 30.7s.test/scripts/doctor-config-preflight-plugin-index.built-cli.e2e.test.ts— Doctor plugin index persistence built CLI proof > keeps an empty legacy state dir separate when the canonical root exists: 35.0s.The Doctor suites repeatedly prepare real state/schema/worker owners and, for deferred-plugin cases, perform an initial import followed by plugin completion and retained-source settlement. The plugin-deferral recovery cases run several Doctor passes around package/contract changes. The CLI suites exercise real update/lease/recovery owners across fresh process or isolated state fixtures. These existing fixture costs need a separate performance pass; no timeouts, retries, or assertions were relaxed.
The separate npm-manifest symptom did not reproduce: updating a legacy npm record for the published
@openclaw/[email protected]succeeded despite its manifest ID beingbrave(Updated brave: 2026.9.7 -> 2026.10.1). No installer change is included. Source history does not establish which historical release resolved the reporter's npm failure; the broader reported environment-specific staging failure remains unconfirmed.Production LOC: +1450 / −338 (net +1112). Test LOC: +982 / −522. Documentation: +74 / −62.