Repository navigation
fix(update): allow direct upgrades from extended-stable - #184547
Conversation
Normalize verified 2026.9.33/34 physical database inventories inside candidate Doctor, attribute migrations with committed generations, and return physical receipts to the older updater. Keep explicit candidate inspections current and preserve strict checks for changed data, intervening commits, and replacements. Complete agent schema preparation before ordinary readers enter, and preserve the source cron selector when a released updater snapshots a rehearsal copy. No new schema, durable state, configuration, or ordinary-reader exclusion. Supersedes the approach in #182129.
|
🦞👀 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. |
|
Codex review: blocked before merge. What this changesThis PR adapts legacy database fingerprints inside candidate Doctor and prepares schemas and cron identity for direct extended-stable upgrades. Example: Update an installation running OpenClaw 2026.9.34 directly to a candidate containing this repair.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this maintainer-authored PR addresses a documented shipped-updater incompatibility, but its newly added explicit-config cron regression fails on the reviewed head. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe installed updater supplies captured database generations to candidate Doctor, which migrates preserved state and returns write receipts for rollback verification. flowchart TD
A[Installed updater] --> B[Captured legacy inventory]
B --> C[Candidate Doctor]
C --> D[Paired generation observation]
D --> E[Existing schema migration owners]
E --> F[Settled legacy receipt]
F --> G[Rollback verification]
Technical reviewBest possible solution: Retain candidate-side normalization in the existing owners and correct the explicit-config cron regression without weakening partition-selection checks. Do we have a high-confidence way to reproduce the issue? Released 2026.9.34 and current main use incompatible fingerprint formats, corroborated by native failures recorded in #179349; this review executed no target code. Is this the best way to solve the issue? Whole-inventory verification followed by candidate-local normalization addresses the compatibility boundary while retaining current generation and migration owners. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7b95dbd3fdfe. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +199, Tests +281, Docs +13. Total +493 across 13 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 26, 2026, 7:23 AM ET / 11:23 UTC. |
Integrate main to repair the demonstrated CI interaction with selected-profile inspection. Keep original source selectors for rehearsal cron identity while binding metadata discovery to the selected state directory, and exclude generation-only inspection from environment rebinding. Validation: six source-selector/profile regression cases, production and affected test typechecks, targeted lint, formatting, diff checks, and independent Codex review passed. The requested Testbox product matrix remains pending.
Since #184275 the Linux WAL split-brain inspection runs asynchronously on the periodic maintenance tick. Interruption tests advance the fake clock past that tick, so a synchronous close in teardown could race a pending inspection and throw. Close through the orderly async lifecycle first.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 271851e69d
ℹ️ 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".
| const sourceEnv = | ||
| sourceInput.env?.OPENCLAW_STATE_DIR?.trim() || sourceInput.env?.OPENCLAW_CONFIG_PATH?.trim() | ||
| ? sourceInput.env | ||
| : { ...sourceInput.env, OPENCLAW_STATE_DIR: sourceRoot }; |
There was a problem hiding this comment.
Preserve source selectors in the production snapshot request
When an installation uses only OPENCLAW_CONFIG_PATH to select a config directory outside its state root, this fallback derives the wrong legacy cron identity. The production launcher in prepareUpdateCandidateStateSnapshot (src/infra/update-candidate-snapshot.ts) omits both source selectors from the serialized env, so this branch always substitutes sourceRoot, even with a current updater. If historical cron partitions exist under both directories, the newly added transform binds the rehearsal to the state-root partition rather than the source's active config-directory partition, causing candidate Doctor to inspect the wrong jobs. The new explicit-config test misses this because its test helper serializes the supplied environment directly. Pass the original selectors through the production request, and preserve an unresolved selection when an older parent's payload cannot establish the source identity.
Useful? React with 👍 / 👎.
…ded-stable-direct # Conflicts: # src/gateway/update-run-watcher.interruption.test.ts # src/infra/update-physical-database-generations.ts
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
) * fix(update): support direct extended-stable upgrades Normalize verified 2026.9.33/34 physical database inventories inside candidate Doctor, attribute migrations with committed generations, and return physical receipts to the older updater. Keep explicit candidate inspections current and preserve strict checks for changed data, intervening commits, and replacements. Complete agent schema preparation before ordinary readers enter, and preserve the source cron selector when a released updater snapshots a rehearsal copy. No new schema, durable state, configuration, or ordinary-reader exclusion. Supersedes the approach in openclaw#182129. * test(gateway): stop WAL maintenance before closing watcher test state Since openclaw#184275 the Linux WAL split-brain inspection runs asynchronously on the periodic maintenance tick. Interruption tests advance the fake clock past that tick, so a synchronous close in teardown could race a pending inspection and throw. Close through the orderly async lifecycle first. * test(update): match the path-qualified migration refusal message
) ## What Problem This Solves Read-only Doctor checks can recreate SQLite WAL/SHM files after drainage, changing the physical inventory used by extended-stable update receipts even when the database contents are unchanged. ## User Impact Doctor preserves the source database artifacts while inspecting shared auth and checking whether SQLite reclamation is needed. The update troubleshooting guide now documents direct updates from 2026.9.33/2026.9.34 starting with a release containing the compatibility and artifact-preservation fixes. ## Why This Change Was Made Both inspections use the existing artifact-preserving read owner. Mutation still uses the existing identity, integrity, and maintenance checks. The published-driver survivor seed now creates nonempty legacy shared-auth rows with the baseline CLI and removes a title from its baseline-created session; native assertions verify both repairs before subsequent candidate CLI reads. Production LOC: **+6**, across two production files; seven changed files total. No schema or receipt-format change. Related: #179349, #184547. ## Evidence - Unmodified published **2026.9.33 → packed candidate**: complete `legacy-operator-state` survivor **PASS** on Testbox `tbx_01m5xy65dny80saenbmrvetj6b` ([allocation](https://github.com/openclaw/openclaw/actions/runs/40456990168)); delegated command exit 0, lease stopped after proof. The command took **600.43 s**, including packaging and the scenario; this is execution time, not a performance comparison. - Verified shared-auth source-row removal and unchanged relocated values, repaired session title, candidate Gateway and agent turn, cron ownership, no-op second update, clean Doctor, and backup/restore. The auth/title assertions run before candidate CLI probes. - `pnpm test src/commands/doctor-sqlite-reclamation.test.ts --maxWorkers=1`: **9/9 passed**, **140.48 s** wall time. The new no-op physical-inventory assertion fails with the old inspection code because it recreates WAL/SHM files. Changed-file lint, formatting, and `git diff --check` passed. Independent review found no actionable P0/P1 issues. The focused suite exercises real SQLite file families, compaction, retained readers, and cancellation. In-memory mocks cannot detect the physical WAL/SHM changes; worker preparation is included in the reported wall time. ## CI baseline attribution The failed compact test job is [checks-node-changed-compact-small-6](https://github.com/openclaw/openclaw/actions/runs/40460500525/job/122044204234): 17 failures in `src/agents/command/attempt-execution.cli.test.ts`. A clean, frozen-install checkout of current main [`e990b80`](e990b80) reproduces all 17 failures (70 pass), including the same `terminalReplyExpectation: optional` versus `required`/`result-required` mismatches. This PR does not change that test or its reply-policy owners. The baseline reproduction used the pinned Bun runtime and completed in 183.25 s including worker preparation. The failures remain recorded; they are not attributed to the SQLite inspection change. The other failed test job, [checks-node-changed](https://github.com/openclaw/openclaw/actions/runs/40460500525/job/122044204521), contains one OAuth failure: `makes a pending peer wait and inherit only the same-account shared rotation` in `test/oauth-refresh-authority-chain.e2e.test.ts`. Running that case with both production files restored to the exact PR-base blobs also fails with terminal `status: error` versus `ok`: the baseline reaches the peer assertion at line 537, while CI fails the preceding owner assertion at line 536. The same test fails without the patch; the actor differs, and the assertion output does not expose the underlying error. The candidate files were then restored byte for byte. The base run took 687.94 s including a cold E2E build; the test-runner phase took 95.57 s. The CI failure occurs before peer-result assertions; the baseline failure occurs at the peer result. Both are recorded for the auth test owner. The changed legacy-auth predicate is only different inside artifact-preserving inspection, which this scenario does not enter. All lint, type, and other static checks passed. Landing uses the authorized inherited-failure exception; failed checks remain failed.
…claw#185561) ## What Problem This Solves Read-only Doctor checks can recreate SQLite WAL/SHM files after drainage, changing the physical inventory used by extended-stable update receipts even when the database contents are unchanged. ## User Impact Doctor preserves the source database artifacts while inspecting shared auth and checking whether SQLite reclamation is needed. The update troubleshooting guide now documents direct updates from 2026.9.33/2026.9.34 starting with a release containing the compatibility and artifact-preservation fixes. ## Why This Change Was Made Both inspections use the existing artifact-preserving read owner. Mutation still uses the existing identity, integrity, and maintenance checks. The published-driver survivor seed now creates nonempty legacy shared-auth rows with the baseline CLI and removes a title from its baseline-created session; native assertions verify both repairs before subsequent candidate CLI reads. Production LOC: **+6**, across two production files; seven changed files total. No schema or receipt-format change. Related: openclaw#179349, openclaw#184547. ## Evidence - Unmodified published **2026.9.33 → packed candidate**: complete `legacy-operator-state` survivor **PASS** on Testbox `tbx_01m5xy65dny80saenbmrvetj6b` ([allocation](https://github.com/openclaw/openclaw/actions/runs/40456990168)); delegated command exit 0, lease stopped after proof. The command took **600.43 s**, including packaging and the scenario; this is execution time, not a performance comparison. - Verified shared-auth source-row removal and unchanged relocated values, repaired session title, candidate Gateway and agent turn, cron ownership, no-op second update, clean Doctor, and backup/restore. The auth/title assertions run before candidate CLI probes. - `pnpm test src/commands/doctor-sqlite-reclamation.test.ts --maxWorkers=1`: **9/9 passed**, **140.48 s** wall time. The new no-op physical-inventory assertion fails with the old inspection code because it recreates WAL/SHM files. Changed-file lint, formatting, and `git diff --check` passed. Independent review found no actionable P0/P1 issues. The focused suite exercises real SQLite file families, compaction, retained readers, and cancellation. In-memory mocks cannot detect the physical WAL/SHM changes; worker preparation is included in the reported wall time. ## CI baseline attribution The failed compact test job is [checks-node-changed-compact-small-6](https://github.com/openclaw/openclaw/actions/runs/40460500525/job/122044204234): 17 failures in `src/agents/command/attempt-execution.cli.test.ts`. A clean, frozen-install checkout of current main [`9e66a2e`](openclaw@9e66a2e) reproduces all 17 failures (70 pass), including the same `terminalReplyExpectation: optional` versus `required`/`result-required` mismatches. This PR does not change that test or its reply-policy owners. The baseline reproduction used the pinned Bun runtime and completed in 183.25 s including worker preparation. The failures remain recorded; they are not attributed to the SQLite inspection change. The other failed test job, [checks-node-changed](https://github.com/openclaw/openclaw/actions/runs/40460500525/job/122044204521), contains one OAuth failure: `makes a pending peer wait and inherit only the same-account shared rotation` in `test/oauth-refresh-authority-chain.e2e.test.ts`. Running that case with both production files restored to the exact PR-base blobs also fails with terminal `status: error` versus `ok`: the baseline reaches the peer assertion at line 537, while CI fails the preceding owner assertion at line 536. The same test fails without the patch; the actor differs, and the assertion output does not expose the underlying error. The candidate files were then restored byte for byte. The base run took 687.94 s including a cold E2E build; the test-runner phase took 95.57 s. The CI failure occurs before peer-result assertions; the baseline failure occurs at the peer result. Both are recorded for the auth test owner. The changed legacy-auth predicate is only different inside artifact-preserving inspection, which this scenario does not enter. All lint, type, and other static checks passed. Landing uses the authorized inherited-failure exception; failed checks remain failed.
What Problem This Solves
Fixes direct updates from extended-stable 2026.9.33 and 2026.9.34 failing during candidate Doctor with
SQLite migration source changed after update capture, even though the disposable rehearsal succeeded.User Impact
Operators can update directly from those releases to a candidate containing this fix; the installed updater does not need the repair. Changed data, intervening commits, replaced files, and tampered backups still refuse automatic restoration.
It also repairs a current-main regression: since #184384, updates driven by the published 2026.10.5 updater fail candidate Doctor lint and roll back (
reason: doctor-failed). The source cron-selector repair here restores them; see the product proof below.Why This Change Was Made
The published extended-stable updater records physical SQLite-family fingerprints, while current migration attribution expects committed-content generations. Design B keeps the compatibility boundary inside candidate Doctor: verify the entire incoming physical inventory and derive committed generations from the same stable observation, attribute migrations and final settlement with committed generations, then return physical postimages to the older parent. Explicit candidate inspections remain committed; only the verified legacy parent's unmarked restore inspection receives the old format.
Doctor completes agent version and additive schema preparation before ordinary readers enter, without adding exclusive custody to ordinary admission. Settlement preserves the existing narrowly bounded zero-write WAL-index transition without discarding commit evidence. No new schema, durable store, configuration option, timeout, or baseline is introduced.
Private rehearsal preserves the original cron partition selector before relocating copied state. Released parents omit source selectors and launch in the rehearsal namespace, so the snapshot uses explicit source selectors when supplied and otherwise the source state directory. Metadata discovery still uses the selected installation. This also preserves the selected-profile repair from #184384; generation-only requests do not require an environment payload.
Supersedes #182129.
Evidence
The legacy-inventory regression independently uses the published 2026.9.34 fingerprint algorithm. It fails on base
622215d053bbe4c1ec3c6cdc4a386ccd27d5a844with the original migration error and passes with the fix. Existing refusal coverage includes changed data, same-content commits, replaced files, retained readers, native close, and tampered backups.Before main integration: 77 focused Doctor/migration tests, 126 infrastructure tests, and 17 snapshot tests passed. After integration: all six affected source-selector/profile cases passed with artifact verification; production and affected test typechecks, targeted lint, formatting, and diff checks passed. A broader run passed all 28 assertions but was invalidated by a source edit during execution; it is not counted as a passing command.
CI run 40312346871 exposed an interaction with the new selected-profile prelude: it accessed
envon generation-only requests and overwrote explicit snapshot configuration. This head integrates main and fixes both at the owning boundaries.pr-simplifyis complete. Net delta against integrated main: +201 production TypeScript lines, +281 test lines, +13 documentation lines. Remaining growth implements the legacy wire adapter, paired observation, and attributed schema preparation. Independent Codex P0–P2 review of the final diff is scoped-clean; project code was not executed by the reviewer.Product proof (Blacksmith Testbox, real published updaters)
ee78cf81686tbx_01m5w2hcpbjv5cpqqmx9g3d1g3ee78cf81686tbx_01m5w2hcnx11vavc1myb8f9xqnee78cf81686tbx_01m5w37sv047nffm5vzf4am873271851e69dd(merged main)tbx_01m5w57d04mf764kq99m0dn6wx271851e69dd(merged main)tbx_01m5w892zepw7zkr3f96kwbfnjstatus: ok06bf581731ftbx_01m5w766hvcsv2sg1q8qhhbcvk,tbx_01m5w892zfyvr6mq16mcn9k32xcandidate-doctor-lintexit 1,reason: doctor-failed, rolled back to 10.5The 10.5 control also passed on main
59a81af6e01(before #184384) with a 208 s update step, which places the regression at #184384. An earlier 10.5 run onee78cf81686timed out at the 386 s cell budget on a box roughly 1.7x slower than baseline (build 8m21s vs 3m56s); its retry onc7533575241passed in 362 s, and the merged head passed in 286 s. Blacksmith cleanup-reconciliation warnings after completed lanes are provider bookkeeping, not lane results.CI
The earlier
update-run-watcher.interruption.test.tsfailure is a latent main defect from #184275: on Linux the periodic WAL split-brain inspection now runs asynchronously, and these tests advance the fake clock past that tick and then close state synchronously. Reproduced on macOS by lifting the Linux-only tripwire gate: the old teardown fails 4 cases with the exact CI error; the new teardown (await closeOpenClawStateDatabaseAsync()first, matching other gateway tests) passes 26/26. Fixed inc7533575241.271851e69ddmerges current main (which includes #184399's path-qualified refusal message) and updates the one new expectation accordingly. CI on271851e69ddis green.