Skip to content

fix(update): keep the rehearsal Doctor from retiring workspace files outside the rehearsal root - #145606

Merged
steipete merged 1 commit into
mainfrom
steipete/upd-workspace-state-stale-copies
Sep 12, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/upd-workspace-state-stale-copies

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users updating from 2026.9.3 could lose active Workshop skill files during candidate rehearsal even though the update reported success. Copied proposal records retained absolute live-workspace paths, so the rehearsal retired the original setup files and moved live skills into its disposable directory.

#145084 already provides the standalone Doctor recovery for the historical-workspace shape in #142585. This PR fixes update-path isolation.

Why This Change Was Made

The rehearsal owner now shares its existing filesystem namespace contract with Doctor. Persisted paths outside the copied root remain read-only inventory, with both lexical and physical containment checked. This includes setup import, pending rollback recovery, sidecar/index migration, skill relocation, collection backups, and prepared relocation receipts. Paths inside the copied root still migrate normally.

Doctor records a typed count and a notice: rehearsal: N legacy files outside the rehearsal root left untouched. The post-swap real Doctor retains the existing import, archival, and relocation behavior.

This is candidate-side: the 9.3/9.4 drivers run the candidate's Doctor, including their pre-plugin phase. Their installed snapshot producer supplies no new marker or workspace map, so the guard recognizes the complete isolation environment they already ship. The current producer uses that same shared contract; no new environment option is introduced.

User Impact

Update rehearsal preserves the operator's workspace files and recovery history. The real Doctor then records the correct receipts in the real database, preserves archived setup bytes, and keeps Workshop skills available after the update.

Evidence

  • Regression tests fail before the guards: rehearsal changes original file hashes, consumes recovery metadata, rewrites external backups, and replays an external relocation receipt. The owned-path control passes before and after.
  • Final targeted run: 50 tests passed, including older, identical, newer, and interrupted-claim setup sources, external rollback/sidecar/backup preservation, and successful migration within the copied root. The broader Workshop suite also passed (54 tests).
  • Published 9.3 Docker baseline reproduces the original standalone refusal. Candidate standalone Doctor recovers the same preserved schema-16 fixture with two completed/removed receipts, archived bytes, three relocated skills, and Gateway /readyz 200.
  • Two independent local Linux arm64 Docker cells recorded 51 rehearsal-child exits each: all five original workspace files remained byte-identical, including after Doctor and the canary Gateway. Both then hit the installed 9.3 driver's separate 30-second baseline-fingerprint timeout before swap (30,001 ms / 30,059 ms; fix(update): continue after baseline fingerprint timeouts #144758). The old package, schema 16, and original sources remained present. These are retained failures, not successful full-hop claims.
  • The complete Linux x64 Docker cell passed on Blacksmith Testbox tbx_01m29zt3crcg8r1myrdq8sd3sq (run): unchanged published 9.3 updater exit 0 / status: ok in 28.903 seconds; swap 5.714 seconds; real Doctor exit 0. All 51 rehearsal observations preserved five original files. Final verification found 2 completed/removed receipts, both archive hashes preserved, 3 applied skills intact, correct separate workspace milestones, and Gateway /readyz 200. Source commit da7f3f22f06ca17eefb78b11b83fdb8f48ed344a was verified by tree 220c95506a465d7fe7282305a09987af95f05e2c; the Testbox carrier commit is an intentional wrapper identity. The command exited 0 and the lease completed; Testbox teardown stops its backing workflow. No product assertions or driver timeouts changed.
  • node scripts/check-changed.mjs, pnpm build, and package tarball integrity checks passed. Fresh P1 autoreview on the final helper split: no accepted/actionable findings.

Known limitation: the two local arm64 runs still expose the installed driver's #144758 timeout, which candidate code cannot repair in that running parent. The independent x64 full hop and standalone candidate control pass. No timeout, assertion, schema, dependency, or baseline changes are included in this PR. Previous-head CI completed red in checks-node-compact-large-4: src/gateway/worker-environments/worker-turn-detached-context.test.ts timed out at worker functional launch observation after 5,000 ms. That test was added on main by #145591 (aa7eabb1f6d) after this branch's base and is absent from the previous PR head; no worker-launch code is changed here. That run's aggregate openclaw/ci-gate reflected the failure; other checks passed or skipped. The unrelated test was not altered or manually rerun.

Rebased onto current main to resolve its independent receipt-field addition. Head d5702e9108db181518df58c9089d0e2cc41c2cb0 preserves the same implementation delta; range-diff shows only adjacent receipt context changed. The 10 rehearsal regressions, node scripts/check-changed.mjs, and fresh P1 autoreview all passed after reconciliation. The Docker artifact above remains accurately pinned to its pre-rebase source. Exact-head CI is green: node scripts/watch-pr-ci.mjs 145606 d5702e9108db181518df58c9089d0e2cc41c2cb0 exited 0 with GREEN, zero pending checks, and six superseded contexts identified. The previous-head failure above remains historical evidence.

Thanks @xbb19730559 for the evidence and @itilys for the related reproduction details. #142585 is assigned to @RomneyDa; this keeps the repair at the rehearsal and migration owners for review.

Refs #142585. Refs #145084.

ClawSweeper review

The review of d5702e9108db181518df58c9089d0e2cc41c2cb0 found no actionable introduced defect. Its remaining compatibility-proof request is addressed by the recorded published-9.3 upgrade cell above and the preservation/control regressions; no code fixup is needed.

Compatibility risk Disposition and evidence
Copied records retain absolute live-workspace paths Rehearsal never mutates files outside its root. Lexical and physical containment preserve external setup files, skills, backups, and recovery records; 51 recorded rehearsal observations preserved all five live fixture files.
Deferring rehearsal migration could prevent real migration Real Doctor behavior is unchanged. The published-9.3 x64 update completed; post-update Doctor produced two completed/removed receipts, preserved both archives, retained three applied skills, and reached Gateway readiness 200.
Older installed drivers cannot supply a new candidate marker The guard recognizes isolation values already shipped in 9.3/9.4. No new configuration, schema, retention policy, or recovery format is introduced.
Historical-workspace recovery overlaps another repair #145084 already provides standalone recovery. This PR confines candidate rehearsal writes and leaves that real-Doctor repair intact.

No Rank-up code changes remain. The existing arm64 installed-driver timeout limitation remains recorded above; it does not alter the rehearsal isolation result.

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: XL maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 04:57
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 12, 2026, 2:10 AM ET / 06:10 UTC (Revision 4).

ClawSweeper review

What this changes

The PR confines rehearsal Doctor migrations to copied state, preserving live workspace files and recovery records until the real post-install migration.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a necessary update data-loss fix. No actionable introduced defect was found, and the recorded published-updater upgrade satisfies the previous compatibility-proof request.

Priority: P0
Reviewed head: d5702e9108db181518df58c9089d0e2cc41c2cb0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused preservation fix with strong published-updater evidence, meaningful regressions, and no actionable introduced findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded Linux x64 Docker evidence exercises published 9.3 update through rehearsal Doctor and post-install Doctor: external files remain unchanged, then real migration completes with preserved archives, intact skills, and readiness 200. The preservation guards match the tested revision; this resolves the prior compatibility request.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded Linux x64 Docker evidence exercises published 9.3 update through rehearsal Doctor and post-install Doctor: external files remain unchanged, then real migration completes with preserved archives, intact skills, and readiness 200. The preservation guards match the tested revision; this resolves the prior compatibility request.
Evidence reviewed 8 items Current main still needs the isolation fix: Current main processes pending recovery and executes planned filesystem moves without the rehearsal containment checks added here. The merged historical-workspace repair addresses discovery, not this isolation defect.
Shared containment contract: The helper recognizes the existing complete rehearsal environment and checks both lexical and resolved physical containment. Normal Doctor environments leave migration enabled; no new user configuration is introduced.
Published-driver compatibility: The latest supplied release, v2026.9.4, already supplies the filesystem namespace and service-repair settings recognized by the new guard. The v2026.9.3 source was also inspected and supplies these settings.
Findings None None.
Security None None.

How this fits together

OpenClaw rehearses updates using copied state before replacing the installed package. Doctor processes retained workspace and skill records during that rehearsal and again against real state after installation.

flowchart TD
  A[Installed updater] --> B[Copied state and retained paths]
  B --> C[Rehearsal Doctor]
  C --> D{Path inside copied root?}
  D -->|Yes| E[Migrate copied state]
  D -->|No| F[Preserve files and recovery records]
  E --> G[Install candidate]
  F --> G
  G --> H[Real Doctor migrates operator state]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +265, Tests +532, Docs +7. Total +804 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 12 766 501 +265
Tests 2 532 0 +532
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 1305 501 +804

Review metrics

Metric Value Why it matters
Production and regression coverage Production net +265 lines; tests +532 lines Production growth implements shared containment and guards across migration paths; the tests protect file and recovery-state preservation.
Upgrade configuration 0 new configuration options or environment knobs The candidate recognizes isolation settings already supplied by published 9.3 and 9.4 updaters.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-skill-workshop-collection-backups.ts, migration/backfill/repair: src/commands/doctor-skill-workshop-relocation.ts, migration/backfill/repair: src/commands/doctor-skill-workshop-sidecars.ts, migration/backfill/repair: src/commands/doctor-skill-workshop-sqlite.ts, migration/backfill/repair: src/commands/doctor-skill-workshop-workspaces.ts, unknown-data-model-change: src/commands/doctor-skill-workshop-collection-backups.ts, and 3 more. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one Doctor migration owner with phase-specific write scope, preserving live recovery state until installation completes.

Do we have a high-confidence way to reproduce the issue?

Yes: copied proposal records retain live absolute paths that current-main Doctor can recover or relocate without rehearsal containment. Source and recorded regressions establish the mechanism; this review did not execute it.

Is this the best way to solve the issue?

Yes: sharing the shipped rehearsal contract with existing migration owners avoids rewriting persisted paths or requiring changes to an already-installed updater.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c0c032415550.

Labels

Label justifications:

  • P0: The reported update path can move active skill files into disposable rehearsal state and retire live workspace sources.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded Linux x64 Docker evidence exercises published 9.3 update through rehearsal Doctor and post-install Doctor: external files remain unchanged, then real migration completes with preserved archives, intact skills, and readiness 200. The preservation guards match the tested revision; this resolves the prior compatibility request.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded Linux x64 Docker evidence exercises published 9.3 update through rehearsal Doctor and post-install Doctor: external files remain unchanged, then real migration completes with preserved archives, intact skills, and readiness 200. The preservation guards match the tested revision; this resolves the prior compatibility request.

Evidence

What I checked:

  • Current main still needs the isolation fix: Current main processes pending recovery and executes planned filesystem moves without the rehearsal containment checks added here. The merged historical-workspace repair addresses discovery, not this isolation defect. (src/commands/doctor-skill-workshop-sqlite.ts:359, c0c032415550)
  • Shared containment contract: The helper recognizes the existing complete rehearsal environment and checks both lexical and resolved physical containment. Normal Doctor environments leave migration enabled; no new user configuration is introduced. (src/infra/update-rehearsal-paths.ts:33, d5702e9108db)
  • Published-driver compatibility: The latest supplied release, v2026.9.4, already supplies the filesystem namespace and service-repair settings recognized by the new guard. The v2026.9.3 source was also inspected and supplies these settings. (src/infra/update-candidate-rehearsal.ts:155, 3a9d69db306c)
  • Preservation and real-migration controls: The reviewed tests cover older, identical, newer, and interrupted setup files; pending rollback metadata; sidecars; collection backups; and prepared relocation receipts. They also verify successful owned-path migration and subsequent real Doctor archival, receipts, skill availability, and readiness. Tests were inspected, not executed during this read-only review. (src/infra/update-candidate-workspace-rehearsal.test.ts:107, d5702e9108db)
  • Published-updater runtime evidence: The captured PR body records a Linux x64 Docker update using unchanged published 9.3: exit 0 in 28.903 seconds, 51 rehearsal observations preserving five original files, then real Doctor exit 0, two completed source-removal receipts, preserved archive hashes, three intact skills, and Gateway readiness 200. Evidence: https://github.com/openclaw/openclaw/actions/runs/34674465303 . Its cancelled carrier workflow is explicitly distinguished from the completed Testbox command. The raw job-log download was blocked by the review host's network allowlist; the retained body observations remain the evidence assessed. The two arm64 baseline-fingerprint timeouts are reported failures, not full-hop successes. (da7f3f22f06c)
  • Proof continuity after rebase: The rehearsal guard blob matches the Docker-tested revision exactly: 87b93ec35c764539c30b911bc5fbcf3a9332c59f. The Workshop migration owner also matches exactly: 3e9c16b864fa720ddec83998ef2c52caa1d30322. This supports retaining the earlier runtime proof rather than requiring another identical demonstration. (src/infra/update-rehearsal-paths.ts:33, d5702e9108db)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-12T05:04:47.975Z sha da7f3f2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T05:23:42.850Z sha da7f3f2 :: blocked before merge. :: none
  • reviewed 2026-09-12T05:47:18.757Z sha d5702e9 :: blocked before merge. :: none

Keep persisted paths outside the rehearsal namespace as read-only inventory
until the real Doctor runs. Cover setup import, proposal recovery, sidecars,
collection backups, and prepared relocation receipts through one path scope.

The standalone historical-workspace recovery already exists in #145084.
This fixes the update rehearsal that otherwise consumed the live sources.

Refs #142585. Refs #145084.
Thanks to @xbb19730559 and @itilys for the reproduction evidence.
@steipete
steipete force-pushed the steipete/upd-workspace-state-stale-copies branch from da7f3f2 to d5702e9 Compare September 12, 2026 05:38
@steipete
steipete merged commit fde9435 into main Sep 12, 2026
198 of 200 checks passed
@steipete
steipete deleted the steipete/upd-workspace-state-stale-copies branch September 12, 2026 06:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
…nclaw#145606)

During an update, the candidate's rehearsal Doctor no longer follows absolute workspace paths stored in the copied state back into the live workspace. Files outside the rehearsal root are read-only inventory and are recorded as such; the real post-update Doctor migrates them as before.

Recognize the isolation contract already shipped by the 2026.9.3 and 2026.9.4 update drivers. Preserve external setup files, Workshop skills, backups, and recovery records through rehearsal without changing normal Doctor migration.

Proof: preservation regressions and owned-path migration controls, recorded published-2026.9.3 Docker upgrade with all five live fixture files preserved through 51 rehearsal observations, successful real Doctor migration, and exact-head CI.

Refs openclaw#142585 openclaw#145084.

Thanks @xbb19730559 and @itilys for the reports and reproduction evidence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant