Repository navigation
fix(doctor): preserve explicitly configured profile workspaces - #145976
fuller-stack-dev merged 3 commits into
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: needs real behavior proof before merge. Reviewed September 19, 2026, 1:47 PM ET / 17:47 UTC (Revision 6). ClawSweeper reviewWhat this changesDoctor now preserves explicitly configured profile workspaces, including filesystem aliases, and reports preservation without blocking subsequent repairs. Merge readiness⛔ Blocked before merge - 3 items remain This remains a useful fix absent from current main and v2026.9.5. No actionable patch defect was found; updated Doctor evidence resolves the direct-CLI gap, while current-candidate published-updater proof remains outstanding. Priority: P2 Review scores
Verification
How this fits togetherDoctor plans and executes migrations of older OpenClaw state. Profile configuration and filesystem paths determine whether it moves a legacy workspace or leaves existing directories intact. flowchart TD
A[Named profile] --> C[Doctor migration planning]
B[Explicit workspace configuration] --> C
C --> D[Resolve filesystem aliases]
D --> E{Either endpoint configured?}
E -->|Yes| F[Preserve paths and report notice]
E -->|No| G[Existing workspace migration]
F --> H[Continue remaining repairs]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +75, Tests +281. Total +356 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep explicit workspace choices authoritative in the existing Doctor migration owner, with published-updater compatibility demonstrated for the revised plan. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main's named-profile migration can rename an explicitly configured legacy workspace because it never receives configuration. No runtime reproduction was executed in this read-only review. Is this the best way to solve the issue? Yes: teaching the existing planner and executor to honor configured filesystem identities is a focused repair that preserves ordinary migration behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 00f51a38e804. LabelsLabel changes:
Label justifications:
EvidenceWhat 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 (5 earlier review cycles)
|
|
Addressed the needs-proof items on
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Carry the contributor fix into the extracted migration prelude. Protect both configured endpoints, dangling aliases and native case-equivalent missing targets. Consolidate preservation regressions without growing the existing oversized suites. Co-authored-by: ericcaiwx-star <[email protected]>
|
Merged via squash.
|
* fix(doctor): preserve configured profile workspaces * fix(doctor): avoid assuming workspace ownership Co-authored-by: ericcaiwx-star <[email protected]> (cherry picked from commit 1e8ba48)
* fix(update): restore Gateway after partial stop failure Adapt the service-mutation recovery invariant to the 2026.8 updater owner. (cherry picked from commit ad682b4) * fix(update): replace unsupported service Node runtimes Adapt the recorded-service runtime probe to the 2026.8 daemon install plan. (cherry picked from commit fe79d36) * fix(gateway): gateway stays offline after agent restart on Windows (#134549) * fix(gateway): keep agent restart alive on Windows * docs(gateway): clarify Windows agent restart routing --------- Co-authored-by: Josh <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit 3a0a623) * fix: published Linux upgrades leave unchanged gateways stopped (#151049) * fix(update): preserve service fingerprints across published upgrades Keep known-empty systemd override metadata out of the fingerprint retained by published updaters through 2026.9.4. Preserve full command metadata for runtime pinning and reject actual protected service changes. * test: group silence failures with error payload coverage Keep the required sealed-answer fixture field while moving its related failure-policy cases into the existing error payload test module. Preserve every case and assertion without growing the over-cap payload test file. (cherry picked from commit 4475640) * fix(doctor): preserve explicitly configured profile workspaces (#145976) * fix(doctor): preserve configured profile workspaces * fix(doctor): avoid assuming workspace ownership Co-authored-by: ericcaiwx-star <[email protected]> (cherry picked from commit 1e8ba48) * fix(plugins): stop relocated install records from shadowing bundled plugins (#144843) * fix(plugins): stop relocated install records from shadowing bundled plugins A `path` install record stores an absolute directory. When that directory is another OpenClaw installation's bundled plugin tree, the record survives the installation move and is rediscovered as an `origin: "global"` candidate. `global` outranks `bundled`, so the stale pin won the duplicate-id contest and the plugin resolved from the old installation. `resolvePluginTrust` then saw `record.source === "path"` and downgraded it to `origin-path`, which revokes trusted plugin state and fails trusted-only APIs mid-turn. `isIntentionalInstalledBundledDuplicate` also suppressed the duplicate warning, because installed-shadows-bundled is normally deliberate, so the swap was silent. Treat a plugin directory inside a *different* installation's bundled roots as stale: it no longer outranks the current bundled copy, and it no longer counts as an intentional shadow, so the existing duplicate warning reports it. * fix(plugins): name the stale install record instead of a generic duplicate The duplicate-id warning reported "global plugin will be overridden by bundled plugin", which describes the mechanism but gives an operator nothing to act on. A pin into another installation's bundled tree is a stale record rather than a deliberate override, so report it as one and name the remedy. * docs(agents): record that a stored absolute path is not provenance The stale-pin defect this branch fixes came from a persisted absolute path that kept conferring bundled status after the installation it named was replaced. Record the invariant so the next record type does not repeat it. * fix(plugins): narrow the stale-pin gate to relocated compiled trees Review of the preceding guard found two ways it misfired. It answered "foreign" by negating a membership test against the running package roots, so an install whose root resolves from neither argv nor the module URL saw every bundled tree as foreign, including its own. Compiled sibling trees and the module walk-up fallback resolve exactly that way, so the gate now fails open when the running root is unknown. It also accepted `<root>/extensions/<id>`, the documented `plugins install --link` development target, which made a deliberate local override report as a stale record and told the developer to delete it. Only compiled `dist`/`dist-runtime` trees travel with an installation, so the shape check is limited to those, and a plugin inside the configured dev source root is excluded at the call site, where importing it raises no cycle. * test(auth): pin external credential refresh timing (#152771) --------- Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit 5ec3614) * fix(plugins): archive updates fail on development-only dependencies (#143350) * fix(plugins): isolate npm manifest resolution * fix(plugins): preserve hook host dependencies * test(plugins): align npm isolation coverage with CI limits * fix(plugins): link optional-only OpenClaw host dependencies * test(gateway): settle companion databases before fixture cleanup * test(plugins): cover optional hosts in native import preparation * test(skills): close status watchers before retiring fixture roots --------- Co-authored-by: Gio Della-Libera <[email protected]> Co-authored-by: Jason (Json) <[email protected]> (cherry picked from commit cbf935b) * fix(gateway): release agent leases when shutdown completes (#151435) Drain the existing agent database lifecycle during final Gateway retirement before shared state closes. Preserve sibling ownership and surface native-close failures without dropping their lease. Four new regressions fail on the original code. The repair passes 92 focused cases and an isolated four-case rerun, changed checks, and independent P0-P2 review. (cherry picked from commit 3381de9) * fix: restore Gateway restarts after Git updates (#138781) * fix: restore Gateway restarts after Git updates * test: align update installer mock with eager import (cherry picked from commit 24d8119) --------- Co-authored-by: josh <[email protected]> Co-authored-by: Josh <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Eric Cai <[email protected]> Co-authored-by: Gio Della-Libera <[email protected]> Co-authored-by: Gio Della-Libera <[email protected]> Co-authored-by: Jason (Json) <[email protected]> Co-authored-by: Jason O'Neal <[email protected]>
…law#145976) * fix(doctor): preserve configured profile workspaces * fix(doctor): avoid assuming workspace ownership Co-authored-by: ericcaiwx-star <[email protected]>
Related: #134570
Follow-up to #122733. The broader upgrade-recovery issue remains open; this PR owns only profile workspace migration when configuration explicitly keeps the legacy path.
What Problem This Solves
Fixes an issue where
openclaw doctor --fixunder a named profile could move an explicitly configured workspace to the convention-derived profile state root. If both paths existed, Doctor instead emitted a blocking merge warning even though configuration already identified the live workspace.Why This Change Was Made
Doctor now treats explicit workspace paths in agent defaults or entries as authoritative, including paths that resolve through a symlink alias. It removes those workspaces from migration authority and leaves their contents untouched. When the convention-derived target also exists, Doctor reports only that both paths were left unchanged; it does not infer whether either path is unused.
User Impact
Named-profile users can keep an explicitly configured workspace through upgrades and Doctor repairs. The profile workspace migration no longer moves that workspace or blocks later repairs because another workspace also exists at the convention-derived target.
Evidence
Data-model compatibility
Published updater to exact-head candidate
4c9e46ab68df483b3094bd3a3491f9855ffa2875; packageddist/build-info.jsonrecorded the same commit. Tarball SHA-256:eb989f8f6aae0edb7c6447b85bb2185a4d103f1c99d34135c0451e23c9790870.[email protected]package in a one-time isolated home and npm prefix.openclaw --versionreportedOpenClaw 2026.9.4 (3a9d69d), and the isolated two-agent config passed the published CLI'sconfig validate --json.openclaw --profile work update --tag file:<candidate.tgz> --yes --no-restart --json. It completed withstatus: succeeded, moving from build2026.9.4-release-3a9d69db306c-2026-09-10T22-53-16.719Zto2026.9.4-4c9e46ab68df-2026-09-12T13-40-40.239Z.Actual Doctor CLI behavior
The isolated config explicitly assigned one agent to the legacy source and a second agent to the convention-derived target. Running the installed candidate's actual
doctor --fix --non-interactive --yes --no-workspace-suggestionscommand exited 0 and reported:Both marker files remained at their original paths with unchanged hashes after the published update and a second direct Doctor pass:
The two explicit workspace values also remained in the updated config. A separate fresh named profile ran the installed candidate Doctor to completion with exit 0; neither its legacy source nor its convention-derived workspace target was created.
All proof used synthetic files under a disposable temporary root. No production state, credentials, channel, database, or user identifiers were used.
Automated validation
2e4391ac95ae2fb01be79378bbb4452345e8c9c3: the new regression moved the configured source, causingENOENTat its original path; the two-directory case returned no preservation notice and blocked on the existing target.4c9e46ab68df483b3094bd3a3491f9855ffa2875: focused defaults, agent-entry, symlink, two-agent target ownership, and read-only-plan regressions pass (5 tests).node scripts/check-changed.mjs --base upstream/main -- src/infra/state-migrations.state-dir.ts src/infra/state-migrations.doctor.ts src/commands/doctor-state-migrations.test.ts src/infra/state-migrations.caller-mode.test.tspassed core/coreTests formatting, type checks, lint, import-cycle, and migration guards.patch is correct, confidence 0.94).Exact-head CI note
The exact-head GitHub matrix completed with two unrelated flaky test failures; neither failing file is in this PR's state-migration/Doctor surface:
src/agents/cli-runner/execute.executable-invocation.test.ts: a fixture process produced no output within its 1-second timeout under the full CI load. The same exact-head file passed locally (2/2 tests).src/gateway/server-methods/models-auth-refresh.catalog.integration.test.ts: one learned-catalog assertion observed an empty transient result under the full CI load. The same exact-head test passed locally (1/1 test).Their shards otherwise passed 3,204 and 2,547 tests respectively.
openclaw/ci-gatefailed only as their downstream aggregate. A failed-jobs rerun was attempted after both focused reproductions passed, but GitHub restricts workflow reruns to repository administrators; no code or proof SHA was changed merely to retrigger CI.Current-candidate proof (September 19)
The evidence above remains the historical published-updater proof for
4c9e46ab68df483b3094bd3a3491f9855ffa2875; it is not represented as an updater run of the new revision.The published signed head is
ce7f2f12dbfb54c57ac9994a9320cb252119bac2, preserving the original contributor commits. Current-main runtime verification used build revision4202b0e0448f647e8ab5e314b0a620c6e2379a23: both commits have the identical complete Git tree0f01c793d76283657c5763d48e63df811b937695. The 3 changed files also match the independently API-reviewed source byte-for-byte. Current-main composition passed 131 tests across profile-workspace, caller-mode, and Doctor migration suites; changed-file checks and a fresh-cache production typecheck passed. The exact-head hosted matrix remains required; no CI failure is waived.Actual current-tree Doctor, isolated macOS filesystem: built through the supported
pnpm openclaw --profile workspace145976 doctor --helprunner, then invoked the real public CLI:97e11c92e1e8b74b2e55d537b0354c23a55e78402645bb6a8ee1f2c6f9bdf90a); the target remained absent. Both symlink texts and the explicit configured workspace value remained unchanged. Sanitized real output:06630bb3f33156ac9fb9e469534936010daa38c0da87c8913fdc4fec235ccf47. Explicit workspace values remained absent. This verifies the guard did not disable ordinary migration.Doctor complete.; both conventional workspace paths were absent before and after.Current-tree Doctor aggregate receipt SHA-256:
66ca49733cea150b9e7b1c917cedb6ef3e9785d82dfa8fa147b016a8d3d22c5f. Fresh-profile receipt SHA-256:09742fdfe2ee054ec356bcf01c56484e2b2f2a21f4061682a49ad0451deadcae. These checks used synthetic isolated homes/state/config with plugins disabled and external service-repair policy; no live gateway was updated or restarted. The current-candidate published-updater check is now completed by the v2026.9.5 proof below; the separate v2026.9.4 timeout limitation is retained explicitly.Published updater × current signed candidate: passed
Used the unmodified public
[email protected]package (registry integrity verified; baseline build2026.9.5-release-ec9c1a13db89-2026-09-18T18-51-37.323Z) in a fresh isolated npm prefix/home. Built the candidate from signed headce7f2f12dbfb54c57ac9994a9320cb252119bac2through the canonical self-contained package workflow; its tarball integrity/import-graph check passed, and packageddist/build-info.jsonrecorded that exact commit. Candidate tarball SHA-256:0acbd0fd873601a84f4666b80e068fd42b274a3474fb5d98018fb59123a6b402.Ran the actual published updater, without modifying its source or verification guards:
Sanitized terminal result:
The actual installed candidate's build metadata records
ce7f2f12dbfb54c57ac9994a9320cb252119bac2. The fixture configured a two-link dangling alias pointing to the convention-derived missing target, with an existing legacy source. Before and after the full updater transaction:A subsequent actual installed-candidate
doctor --fix --non-interactive --no-workspace-suggestionsalso exited 0 and preserved these same invariants, with the neutral configured-workspace notice. Current-tree fresh-profile and ordinary unconfigured-migration behavior are documented above. These runs use synthetic isolated state/config and disabled plugins; the only gateway process was the updater's temporary loopback canary. No live service was updated or restarted.Preserved limitation: an initial v2026.9.4-published-updater attempt on this same candidate passed migration rehearsal, Doctor lint, configuration, plugin resolution, migration continuation, and gateway canary, but failed at swap because that published binary hard-caps its integrity scan at 30 seconds. Its baseline remained installed and the fixture stayed unchanged. That failed attempt is not claimed as successful proof. Published v2026.9.5 already removes the hard clamp and honors the supplied timeout; the successful run above uses that public binary unchanged. The older successful v2026.9.4 →
4c9e46ab...evidence remains historical evidence only.Updater result receipt SHA-256:
f5bfb02a16dfbaa85ba7f5d5cdb7851bb9e64267ff0a96789c8ee6d4f30f7cb6. Exact-head hosted CI attempt 2 passed after the transient npm audit-service outage recovered: https://github.com/openclaw/openclaw/actions/runs/35458064583/attempts/2 . No source change or CI waiver was used for the retry.