Repository navigation
fix(update): preserve compatible state when switching to npm stable - #144155
Conversation
|
🦞👀 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: blocked before merge. Reviewed September 11, 2026, 4:41 PM ET / 20:41 UTC (Revision 13). ClawSweeper reviewWhat this changesThe PR lets selected releases initialize compatible fresh-profile state before update history, repairs update-lock initialization and recovery, and corrects the skill-environment security scanner. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this remains a useful fix for fresh-profile transitions to older stable releases. The prior blockers are resolved, and this review found no new actionable defect; the latest commit changes only tests. Priority: P1 Review scores
Verification
How this fits togetherThe updater selects a package, checks its compatibility with profile data, and coordinates installation and Gateway restart. Its installation lock remains separate from the profile database so replacing the runtime cannot invalidate update ownership. flowchart TD
A[Update request and profile] --> B[Select and stage package]
B --> C{Compatible state and runtime?}
C -->|No| D[Refuse and preserve installation]
C -->|Fresh profile| E[Selected release initializes state]
E --> F[Record update history]
C -->|Existing compatible profile| F
F --> G[Activate and verify Gateway]
H[Live installation lock] --> E
H --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1195, Tests +3256, Docs +82, Config 0, Other +450. Total +4983 across 73 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the accepted target-owned bootstrap, schema-preserving history, and live installation ownership together, preserving the documented refusal and recovery boundaries. Do we have a high-confidence way to reproduce the issue? Yes, from source: a fresh main profile targeting 2026.9.3 admits schema-17 history before checking the schema-16 target. The linked issue supplies a pinned reproduction; no target code was executed during this review. Is this the best way to solve the issue? Yes: letting the selected runtime initialize state fixes the incompatible-state producer while reusing the existing ledger, package transaction, and installation-lock owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0f0ddbc12ca0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
|
补充一个 macOS + npm global 路径的复现数据点(不在本 PR 描述的 Linux worktree 路径里),方便验证矩阵: 环境:macOS (Apple silicon), 复现(9.2 → 9.3 升级窗口):
疑似同源(与本 PR 的修复方向): if (parentActivation !== undefined && inspection.serviceUpdateVerdict?.kind !== "absent" && inspection.offline !== true)
throw new Error("The update parent owns Gateway activation...")看起来正好在 update-lifecycle fence 域内——本 PR 改 fresh-state initialization 时若动了 如有需要可让我跑任何额外 repro 命令。 |
4f0d9a4 to
63e7080
Compare
01ddc18 to
69dd595
Compare
bfcc52a to
b5f8693
Compare
|
@olveww-dot I checked the current PR head against this report. A normal update admits its history run before target execution and the That establishes the current source behavior; it does not reproduce the published 9.3 macOS standalone |
f9f961b to
d96f455
Compare
|
Merged via squash.
|
…penclaw#144155) * fix(update): initialize fresh profiles with the selected runtime Let the staged target initialize compatible state before admitting update history, while retaining executor ownership and existing-state downgrade protection. Preserve read-only previews, owned service selectors, legacy schema metadata, and interruption guards. Reject changed stored channels before adopting their config snapshots. Refs openclaw#144132. Verified ten npm stable targets on isolated Testboxes, existing-state refusals, real systemd startup, and focused red-to-green regressions. * fix(update): preserve admission and finalization contracts Reject contradictory native service selectors before fresh state or package metadata selection, and unwind already-published fresh refusals through the canonical CLI exit boundary after ownership settles. Use the synchronous Kysely boundary for interruption metadata inspection. Align existing-profile and continuation fixtures with their real database, package version, Gateway version, and control-store ownership. Preserve legacy fallback, rollback, service lifecycle, and no-op assertions. Document that fresh previews do not create history. Related to openclaw#144132. * fix(update): close fresh-admission and control-store races Publish the existing shared update-control database only after its private schema and permissions are complete, preserving original authority and single-link recovery checks. Select fresh initialization from actual state and keep inherited diagnostic IDs consistent across executor and history. Preserve current-main update ownership and completion behavior. Repair the skill-environment detector with source dataflow and scoped validated rule regeneration, and align regression fixtures with the current runtime and package integrity contract. * fix(update): preserve sealed managed handoff startup Prepare the control database through its existing owner before staging the standalone helper, then bind the helper to the captured existing identity. Revalidate before spawn and keep publication dependency resolution lazy so sealed runtime loading never depends on installation packages or native code. Register the static OpenGrep fixtures as external Knip inputs. Keep the Gateway test's synthetic parent alive until its native stop boundary, preserving notice ordering and production authority checks. * fix(update): publish control databases with Windows durability * fix(update): retain executor ownership during service recovery * fix(update): initialize control storage without optional native bindings * test(update): align platform and merge workflow fixtures * test(update): verify settled children and isolate deletion timing
Closes #144132
What Problem This Solves
Fixes an issue where users switching a fresh main installation to an npm stable could receive a refusal or finish with a Gateway that could not start. A preview could also leave subsequent updates blocked. Concurrent first-use updates could fail with unreadable executor state, and installations without optional fs-safe bindings could fail before installing a replacement.
Why This Change Was Made
Recording history first initialized fresh profiles with main's newer database schema. The selected target now initializes fresh state before the first durable history write; previews remain read-only, the selected package stages once, and existing database compatibility is checked before activation. Target selection follows the owned service profile, final Doctor uses the admitted runtime and Node executable, and inherited diagnostic IDs remain consistent across executor and history.
The existing control-store owner exclusively creates one private canonical file and lets SQLite commit its schema atomically. Ordinary lease inspection recognizes an empty first-use schema as having no lease; malformed or populated foreign schemas remain unreadable. Concurrent writers use the same inode. Windows applies a protected ACL at exclusive creation. This removes the native-only publication prerequisite while retaining the same path, schema, claim transactions, and existing empty-file recovery. Current main's repair for older interrupted files with excess read permissions is retained, including when such a writer wins creation; unsafe ownership, links, directories, and write permissions remain rejected.
The normal parent prepares and pins the control database before starting a sealed helper. That helper operates only on its admitted existing database and cannot recreate missing or empty state. Failure recovery now carries the active update run into the existing executor-aware service owner. Terminal results wait for cleanup and settlement, preserving the original failure and CLI exit code.
The scoped OpenGrep correction tracks actual skill input into host environment writes and clears only consumed sanitizer output. Trusted service environment restoration is not skill input. Scoped regeneration validates the candidate pack and preserves unrelated rules and bytes; no source-path exclusions or ignored test fixtures were added.
User Impact
Compatible fresh installations can switch to the tested npm stables and start a healthy Gateway while preserving configuration, workspace selection, and source checkouts. Existing data newer than the selected release remains protected by an explicit refusal before replacement. Current main's native-service capability checks also remain: unsupported managed-service targets refuse before service stop or activation. There is no reverse migration, schema-version bump, new configuration, dependency, or storage location. Selected-target initialization can remain after a later refusal; the updater does not delete that state.
The maintainer accepted target-owned fresh initialization, atomic first initialization of the existing control store, and the scanner correction. The final implementation preserves those ownership and recovery contracts and the supported native-optional installation path. Release-note context is maintained here; CHANGELOG.md is release-owned.
Evidence
Current candidate:
b3b061117a9948ce5c08949f7b120b210ca16843. Exact-head CI passed: 126 successful jobs, 11 intentional skips, and zero failures. The security-sensitive guard also passed after one infrastructure retry for a GitHub HTTP 500. Subsequent changes are confined to five test/test-support files: all 480 shared CLI tests, 66 merge-workflow tests, 27 Doctor sibling/process cases and the final six process-settlement cases pass, with clean selected checks and independent P0–P2 reviews. The helper accepts cooperative cleanup only after a successful root exit; forced/uncertain/signaled outcomes remain rejected. The reclamation benchmark now excludes client/runtime setup and passed its full 200,000-row deletion with a 190ms maximum gap, retaining the 500ms threshold and all assertions. Original CI diagnostics do not establish the exact cause of its discarded child result or timing spike; those limits remain recorded. No runtime source changed after the live-tested revision below.The final production matrix passed 26/26 on
934e8b778690c84b3429efa3a9279ed8850a726b: four parallel artifact modes, eleven fresh transitions (the ten plain stables through 2026.9.4 plus legacy 2026.6.11), and eleven existing-state cases. This produced sixteen successful updates and ten safe refusals, all with real Doctor/Gateway health, authored configuration and source preservation, one private single-link control store, and the inherited diagnostic-ID regression passing. The full tree and 69 changed-file hashes were verified; the downloaded archive has SHA-25680bc196f408694b76ae4d340fb93481c1a33f4c20927e4dd63d48c14f9923dba. The lease was stopped and verified completed. All subsequent changes are test fixtures/support and are explicitly distinguished from this recorded-source proof.Actual pinned-dependency
npm ci --omit=optionalfixtures reproduced the originalhelper-unavailablefailure and passed with the corrected real database/lease owners. Node and installed Bun probes covered first creation and non-mutating empty reads. Native Windows proof passed 23 publication/privacy tests plus independent addon-free package checks for first use, eight competing writers, crash recovery, held-writer waiting, sealed missing/replaced-state rejection, and protected owner/SYSTEM/Administrators-only ACLs. Source and fixture hashes were verified, and the lease was stopped. The Windows private-file creator is unchanged by the subsequent POSIX-only legacy-permission integration.Focused proof includes 91 publication/database/executor/sealed cases, the final CLI recovery-command regression, and 51 merged-main publication/permission/custody cases. The exclusive-create legacy-winner case fails on the prior owner and passes with same-inode recovery. The two recovery-caller tests fail without the active-run arguments. Relevant types, lint, unused-export checks, schema/legacy-store/import-cycle guards, and formatting passed across retained full and targeted receipts. Independent reviews resolved all accepted actionable findings; mechanical test portability corrections retain exact Windows refusal and preservation assertions.
Earlier 26-case campaign, second 26-case campaign, and three-case canary passed at their recorded source revisions. Their archives, full-tree identities, and changed-file hashes are retained; they are not mislabeled as final-head proof. Scanner evidence includes 32 fixtures, ten compiler tests, and a validated 145-rule pack with all 144 unrelated rules unchanged.
Earlier CI failures exposed the Windows descriptor issue, stale staged-runtime fixtures, a recovery-command expectation, and missing platform/API test adapters; those were repaired. Unrelated mock-UI geometry and cron timing failures remain recorded separately. No baseline, timeout, assertion, or CI gate was weakened. The reported published 9.3 macOS standalone
update repair/parent-activation error was not reproduced and is not claimed fixed by this PR.Final maintainer review resolves the remaining automated checklist: the custom-artifact refusal and retained target-created state are within the accepted, documented compatibility boundary; the ledger keeps existing table/schema contracts; and the eleven existing-state cases establish compatible update versus safe refusal. The live archives were downloaded and independently hash-verified before lease cleanup. The automated reviewer could not retrieve those traces, which is recorded as its access limitation. Its final review of
b3b061117a9948ce5c08949f7b120b210ca16843found no actionable code or security defect.