Repository navigation
fix: allow Doctor repair with canonical service home overrides - #160056
Conversation
Compare process and runtime homes independently with the OS account home so a canonical OPENCLAW_HOME in service metadata does not block Doctor credential migration. Preserve relocated-home isolation, active-writer checks, and the existing migration owner.
|
🦞👀 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: needs real behavior proof before merge. Reviewed September 29, 2026, 12:30 AM ET / 04:30 UTC (Revision 5). ClawSweeper reviewWhat this changesThe branch accepts canonical OpenClaw home overrides for service management, updates the recovery guidance, and adds Doctor credential-migration regression coverage. Regression provenancePossible regression — suspected (failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 7 items remain Keep this PR open. Current main still rejects the canonical service-home override implicated in the Doctor refusal, and the reporter corrected their earlier diagnosis in favor of this cause. The repair is useful, but alias reassignment remains an unresolved native-service authority concern, and the installed-updater recovery path is unproven. Priority: P1 Review scores
Verification
How this fits togetherDoctor compares the caller’s environment with the installed Gateway service before taking maintenance ownership and repairing legacy credentials. Service identity checks also govern later native stop, start, and restoration operations. flowchart LR
A[Doctor repair request] --> B[Caller and service homes]
B --> C{Account home identity?}
C -->|Yes| D[Maintenance ownership]
D --> E[Credential import]
E --> F[Native Gateway restoration]
C -->|No| G[Service refusal]
Decision needed
Why: The branch explicitly documents alias support, which changes which state selection may reach the account’s native service after asynchronous work. Before merge
Findings
Agent review detailsSecurityNeeds attention: The diff adds no supply-chain change, but its mutable-alias admission can outlive native service authorization. PR surfaceSource -4, Tests +125, Docs +2. Total +123 across 7 files. View PR surface stats
Review metrics
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: Let Doctor repair a literal canonical home override through its existing migration owner, bind native service control to current account-home state, and offer a visible Fix action for blocked upgrades. Do we have a high-confidence way to reproduce the issue? Yes for the source mechanism: current main rejects a nonempty canonical OPENCLAW_HOME, and the PR reports a before-fix synthetic Doctor refusal. The reporter’s native unit and installed-updater path were not reproduced. Is this the best way to solve the issue? Not yet. The canonical override addresses the refusal, but accepting mutable aliases without binding their authority through native dispatch is unsafe; a literal account-home override is the narrower repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0e6c5a8d891f. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Carry the preload-owner fix and regression coverage from b9cd492 (#160024). The failing CI merge inherited a newer preload that tried to resolve vitest/runtime relative to temporary JavaScript fixture entrypoints. It crashed before those children could register their IPC handlers. Apply the adapter only to recognized Vitest workers, preserving their package-local runtime while leaving ordinary forks, threads, and evals alone. Keep the accepted canonical-home repair unchanged. Validated the four original failures and the preload regressions before repair, three focused passes, the original CI shard, changed checks, and fresh P1 review on a Linux Testbox. Co-authored-by: Vincent Koc <[email protected]>
The published-driver upgrade-survivor cell (legacy-operator-state) failed at legacy-operator-update-noop for every candidate built after #160056. That change reworded the managed-service rerun guidance, and the already-current assertion hardcoded the full advisory text, so the only difference was advisory.message. Project each step's advisory to its kind plus a non-empty explanation. The check still requires an already-current, repair-free result with no steps or exactly one unexecuted managed-service-reconciliation entry (same name, command, cwd, duration, exit code, and advisory kind). Product text is unchanged.
The published-driver upgrade-survivor cell (legacy-operator-state) failed at legacy-operator-update-noop for every candidate built after #160056. That change reworded the managed-service rerun guidance, and the already-current assertion hardcoded the full advisory text, so the only difference was advisory.message. Project each step's advisory to its kind plus a non-empty explanation. The check still requires an already-current, repair-free result with no steps or exactly one unexecuted managed-service-reconciliation entry (same name, command, cwd, duration, exit code, and advisory kind). Product text is unchanged. (cherry picked from commit 4e52570)
…law#160056) * fix: allow Doctor repair with canonical service home overrides Compare process and runtime homes independently with the OS account home so a canonical OPENCLAW_HOME in service metadata does not block Doctor credential migration. Preserve relocated-home isolation, active-writer checks, and the existing migration owner. * test: keep inherited Vitest preloads out of verifier children Carry the preload-owner fix and regression coverage from fe5c642 (openclaw#160024). The failing CI merge inherited a newer preload that tried to resolve vitest/runtime relative to temporary JavaScript fixture entrypoints. It crashed before those children could register their IPC handlers. Apply the adapter only to recognized Vitest workers, preserving their package-local runtime while leaving ordinary forks, threads, and evals alone. Keep the accepted canonical-home repair unchanged. Validated the four original failures and the preload regressions before repair, three focused passes, the original CI shard, changed checks, and fresh P1 review on a Linux Testbox. Co-authored-by: Vincent Koc <[email protected]> * test(update): align canonical home recovery guidance --------- Co-authored-by: Vincent Koc <[email protected]>
…aw#161079) The published-driver upgrade-survivor cell (legacy-operator-state) failed at legacy-operator-update-noop for every candidate built after openclaw#160056. That change reworded the managed-service rerun guidance, and the already-current assertion hardcoded the full advisory text, so the only difference was advisory.message. Project each step's advisory to its kind plus a non-empty explanation. The check still requires an already-current, repair-free result with no steps or exactly one unexecuted managed-service-reconciliation entry (same name, command, cwd, duration, exit code, and advisory kind). Product text is unchanged.
* fix: allow Doctor to repair offline app-owned state * test(doctor): model native manager identity in app-owned repair * test(doctor): retain state-only CLI repair fixture authority (cherry picked from commit 44d880a) Backport adaptation: kept the release line's active-state-writer refusal case from #160056 as an extra row in the new service-identity matrix.
Closes #159926
Closes #159927
What Problem This Solves
Fixes
openclaw doctor --fixrefusing maintenance when the installed service'sOPENCLAW_HOMEresolves to the OS account home, blocking the required legacy credential-store migration even from a canonical shell.User Impact
The credential-store migration now has its Doctor path back for canonical home overrides. Doctor imports and verifies the legacy credentials, archives the original bytes, and leaves runtime consuming canonical storage. Its existing maintenance ownership, active-writer checks, and migration owner remain unchanged.
An
OPENCLAW_HOMEthat genuinely resolves elsewhere remains isolated: native service management still reportsservice management skipped: non-default state dir or config path, with guidance to use the OS account home and canonical state/config paths. Operators keeping relocated state must stop its owning Gateway/supervisor and use Doctor's existing offline maintenance path against that state; this fix does not let it adopt the account's native service. A canonical runtime override also cannot hide a relocatedHOMEorUSERPROFILE.Why This Change Was Made
The identity predicate rejected every nonempty
OPENCLAW_HOMEbefore comparing resolved paths. Doctor validates the installed service environment as well as its caller, so the service's saved override could cause the reported refusal while the shell's selectors were canonical. Compare the process home and effective OpenClaw home independently with the OS account home, retaining state/config/profile checks and filesystem normalization.The regression reproduces the exact refusal with a canonical caller and a service-defined canonical home override. The reporter's actual unit environment was not supplied, so that host's precise mismatch remains unverified. Thanks to @oscarsixsecllc for the paired reports.
Evidence
tbx_01m3js2ps29x0s6h25rvpqxh2s(lease run): regression failed before the fix with the reported maintenance refusal. It exercises real maintenance ownership and credential repair with a synthetic native service.pnpm test src/config/paths.test.ts src/infra/gateway-supervision.test.ts src/commands/doctor-maintenance.service-identity.test.ts --maxWorkers=1: three passes, 67 tests each; 21.69–21.75 seconds wall per run. The new regression file took about 3.8 seconds of test time and 6.9 seconds wall; the path and supervision files took about 12.2 seconds and 0.7 seconds wall respectively. CI timing is not used as proof.claude-cliimport, byte-preserving archival, no native service mutations for a stopped service, and refusal while another owner holds state. Existing path tests also reject a canonical runtime override masking a copied process home.node scripts/check-changed.mjs -- <six changed paths>passed on the Testbox, including core types, all 25 selected test type graphs, lint, and repository guards.git diff --checkpassed.server.chat.canonical-publication,server.xai-fallback, andserver.config-patchtook 30.637/30.558/31.281 seconds with cold Gateway startup and real retry work; those suites are unchanged.No PR CI jobs were dispatched or rerun for proof.
CI startup repair
Head
c48a8f4bb280e3491e83995780471d2cc403d978carries the existing preload-owner fix and regression coverage from #160024 (b9cd492ac60f, credited to Vincent Koc). The failed job tested merge commitc855070740f0e0e2386751d99cbe77b2011fc09b, which included a newer Vitest preload. Captured child stderr wasMODULE_NOT_FOUND: Cannot find module 'vitest/runtime': the inherited preload resolved the package relative to temporary JavaScript fixture entrypoints. The branch-only verifier suite passed 27/27; applying that CI preload reproduced the exact four failures. This was a test-preload startup failure, and the accepted home-identity code remains unchanged.The adapter now runs only in recognized Vitest workers. Ordinary descendant forks, threads, and eval commands preserve their flags and IPC without loading Vitest; package-local Vitest workers retain their adapter and fatal dependency-resolution diagnostics. No unrelated changes from the upstream tooling commit were ported.
Blacksmith Testbox
tbx_01m3kakb2s85aqbed4pbj66gkb(lease run) verified the committed treed92bde9980e3be5868c3eb9a5c9522f42c7e12ad:node scripts/check-changed.mjs -- test/vitest/vitest.jsdom-preload.mts test/jsdom-compat.test.ts test/scripts/vitest-jsdom-preload.test.tspassed; fresh direct-route P1 autoreview was scoped-clean.pnpm test <file> --maxWorkers=1costs:test/jsdom-compat.test.ts2.40 seconds wall / 360 ms test time;test/scripts/vitest-jsdom-preload.test.ts1.80 seconds wall / 202 ms test time. New-head CI timing is not used as proof.Auto-merge settings were left unchanged.
CI classification and diagnostic expectation repair
Run
36391577910was compared on Linux using its exact merge snapshot80da61e948db0aef86e3f7d59ce7adb6b008bac6and untouched main parent267da052ea2674f4d122e09f7178e0c6b1a63e3d:package-update-activation-journal.test.ts:7andpackage-update-activation-lifetime.test.ts:11:sqlite-reliability-process.jsdeclaresassertReliabilityForcedExitlocally but does not export it. The affected files are identical across the snapshots. Main fixes the export inda2efd83b8a689572803d31c740fd700d0f0a907.release()to return false. Main fixes the assertion infa90c83d1ab83cb73a10d2bb24cc08af20fd2683, retaining the custody-preservation assertions.repair pins relative installation selectors before failed-update triage, while the main parent passes 24/24. Only the recorded 200-character guidance differs. The shared expectation now reflects the accepted canonicalOPENCLAW_HOMEguidance; the deep-equality and selector assertions remain intact. Repair delta: production 0, test support +1/-1; no added tests or runtime cost.Blacksmith Testbox
tbx_01m3kmecdqjc6h6emjbz0vf7hf(lease run): the Windows suite passed 24/24 three times after correction (102.89/72.80/91.69 seconds wall; Vitest 63.90/43.25/53.31 seconds). All six consuming suites passed 136/136 (209.41 seconds Vitest, 238.99 seconds wrapper).node scripts/check-changed.mjs -- src/cli/update-cli/update-cli-failure-recovery.test-support.tspassed, including the CLI update type graph and lint. Fresh direct-route Codex P1 autoreview was scoped-clean. The known convergence-authority and CI/tooling failures remain with their existing owners.The final focused regression also passed with a verified one-line-only diff from the exact merge snapshot (1 selected test passed, 23 filtered; 27.12 seconds wall, 4.17 seconds Vitest). The full triple runs differed additionally in two erased type-only declarations; no additional runtime changes were present. An initial final-proof attempt stopped before tests because its guard compared the synthetic Testbox sync commit with the source SHA; checking the independently pinned merge checkout resolved that tooling mismatch.