Skip to content

fix: isolate external workspaces during adoption - #96

Merged
jalehman merged 2 commits into
mainfrom
pe/fix-release-validation-workspace-import
Aug 19, 2026
Merged

jalehman merged 2 commits into
mainfrom
pe/fix-release-validation-workspace-import

Conversation

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Summary

  • copy configured external workspaces into the disposable adopted environment
  • rewrite only fixture configuration to the copied workspace
  • preserve source paths and fail closed for unsafe includes

Validation

  • cargo test --test migrate_command_tests (36 passed)
  • external-workspace migration regression coverage

Fixes release-validation imports where ~/.openclaw points at a repo-backed or symlinked workspace.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 19, 2026, 7:31 PM ET / 23:31 UTC.

ClawSweeper review

What this changes

The PR copies configured external OpenClaw workspaces into an adopted OCM environment and rewrites imported configuration to use those isolated copies.

Merge readiness

⛔ Blocked until real behavior proof is added - 6 items remain

Keep this PR open: its workspace copy preserves symlinks verbatim, so an adopted environment can still reference files outside the copied workspace; it also needs real adoption proof before merge.

Priority: P2
Reviewed head: 96938b1b893fae4dd917c71771656e0650943699

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has useful focused coverage, but a P1 symlink-containment defect and missing real adoption proof prevent merge readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR reports focused tests but provides no after-fix real adoption output; add redacted terminal evidence showing the copied workspace and rewritten configuration. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR reports focused tests but provides no after-fix real adoption output; add redacted terminal evidence showing the copied workspace and rewritten configuration. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items External workspace copy: The new migration plan copies each configured external workspace into the adopted state directory.
Symlink escape remains possible: The copy helper preserves symlink targets verbatim; an absolute link, or a relative link escaping the workspace, remains a live reference to the old filesystem after adoption.
Existing copy-helper provenance: History identifies Shakker's recursive-copy maintenance commit as the established behavior behind the helper used by this new migration path.
Findings 1 actionable finding [P1] Keep copied workspace symlinks inside the adopted environment
Security None None.

Live Verification

Command: cargo run --quiet -- adopt import

Result: FAIL (failed) — execution before step 1 run: sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.22.0.tgz

sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.22.0.tgz

Assertions:

  • FAIL expect_output: copied workspace
  • FAIL expect_output: workspaces/default

How this fits together

OCM adoption imports a plain OpenClaw home into a managed environment. It reads workspace configuration, copies durable state, rewrites paths for the new environment, and then prepares the managed runtime.

flowchart LR
  A[Plain OpenClaw home] --> B[Read workspace configuration]
  B --> C[Validate migration paths]
  C --> D[Copy external workspace]
  D --> E[Adopted OCM environment]
  E --> F[Rewrite imported configuration]
  F --> G[Managed runtime]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR reports focused tests but provides no after-fix real adoption output; add redacted terminal evidence showing the copied workspace and rewritten configuration. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Keep copied workspace symlinks inside the adopted environment (P1) - copy_dir_recursive preserves symlinks verbatim, so a workspace link to an absolute path—or a relative path escaping the workspace—still targets the original filesystem after adoption. That defeats the new isolation behavior; reject escaping links and rebase contained absolute links, with regression coverage.
  • Resolve merge risk (P1) - Merging as-is can leave an adopted environment dependent on the original checkout when a copied workspace contains an absolute or escaping symlink.
  • Complete next step (P2) - A narrow mechanical containment repair is available, but the contributor must still provide real adoption proof after it lands on the branch.
  • Improve patch quality - Reject or rebase workspace symlinks that escape the copied workspace and add regression coverage.
  • Improve patch quality - Add redacted terminal output from a real adoption import after the repair; updating the PR body should trigger re-review.

Findings

  • [P1] Keep copied workspace symlinks inside the adopted environment — src/migrate.rs:127
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 7 files affected; 429 additions, 24 deletions This changes migration path validation, copied state, and configuration rewriting.
Production versus tests production +343, tests +79 The substantial migration-path expansion needs a focused containment regression alongside the added happy-path coverage.

Merge-risk options

Maintainer options:

  1. Contain copied workspace links (recommended)
    Reject symlinks that resolve outside the source workspace and rebase any contained absolute links into the copied workspace before rewriting configuration.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Add workspace-copy containment handling and regression coverage for absolute and escaping symlinks; preserve contained links within the adopted workspace.

Technical review

Best possible solution:

Use a workspace-specific copy routine that rebases contained links into the copied tree and rejects links that resolve outside it, then demonstrate a real import with redacted terminal output.

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

Yes—source-reproducible: configure an external workspace containing a symlink that resolves outside that workspace, then adopt it and inspect the copied link; the helper preserves its original target.

Is this the best way to solve the issue?

No: copying configured workspaces is appropriate, but verbatim symlink preservation defeats the stated isolation guarantee; contained links must be rebased and escaping links rejected.

Full review comments:

  • [P1] Keep copied workspace symlinks inside the adopted environment — src/migrate.rs:127
    copy_dir_recursive preserves symlinks verbatim, so a workspace link to an absolute path—or a relative path escaping the workspace—still targets the original filesystem after adoption. That defeats the new isolation behavior; reject escaping links and rebase contained absolute links, with regression coverage.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: not found in the target repository.

Codex review notes: model internal, reasoning high; reviewed against a101e103dea5.

Labels

Label justifications:

  • P2: The defect affects adoption imports with symlinked workspace content and has a bounded compatibility blast radius.
  • merge-risk: 🚨 compatibility: The PR changes existing import behavior and can silently retain references to a user's original repository workspace.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports focused tests but provides no after-fix real adoption output; add redacted terminal evidence showing the copied workspace and rewritten configuration. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] cargo test --test migrate_command_tests.
  • [P1] Run a disposable ocm adopt import against an external workspace with contained and escaping symlink fixtures; verify copied paths are contained or the import fails closed.

What I checked:

  • External workspace copy: The new migration plan copies each configured external workspace into the adopted state directory. (src/migrate.rs:127, 96938b1b893f)
  • Symlink escape remains possible: The copy helper preserves symlink targets verbatim; an absolute link, or a relative link escaping the workspace, remains a live reference to the old filesystem after adoption. (src/store/common.rs:81, 96938b1b893f)
  • Existing copy-helper provenance: History identifies Shakker's recursive-copy maintenance commit as the established behavior behind the helper used by this new migration path. (src/store/common.rs:55, 147f9853e81b)
  • Focused tests do not cover nested links: The added tests cover an external workspace and a source-home workspace symlink, but neither creates a symlink inside the copied workspace that resolves outside its copied root. (tests/migrate_command_tests.rs:949, 96938b1b893f)

Likely related people:

  • Shakker: History shows sustained ownership of configured workspace resolution, migration hardening, and the recursive-copy helper. (role: workspace and migration feature owner; confidence: high; commits: f7e0a4bace91, 147f9853e81b, 9da72d56f639; files: src/migrate.rs, src/store/openclaw_workspaces.rs, src/store/common.rs)
  • Vincent Koc: Recent history includes plain-home import and runtime hardening relevant to failure-safe adoption behavior. (role: adjacent migration-hardening contributor; confidence: medium; commits: 332178976722, fce19122169a; files: src/migrate.rs, src/store/common.rs)

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 (1 earlier review cycle)
  • reviewed 2026-08-19T23:16:57.913Z sha 329e46b :: needs real behavior proof before merge. :: [P1] Preserve or reject internal workspace symlinks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants