Skip to content

fix(sandbox): materialize protected skill mount roots - #96028

Closed
momothemage wants to merge 1 commit into
mainfrom
feature/fix-sandbox-skill-mount-ro
Closed

momothemage wants to merge 1 commit into
mainfrom
feature/fix-sandbox-skill-mount-ro

Conversation

@momothemage

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #94425.

A first-launch rw sandbox can currently skip the read-only overlays for /workspace/skills and /workspace/.agents/skills when the corresponding host directories do not exist yet. Because /workspace itself is writable, the sandbox can create those paths before the next container recreation applies the intended read-only mount.

Why This Change Was Made

This materializes the protected skill mount roots during rw sandbox workspace setup, before Docker/browser/fs-bridge mount resolution runs. The mount-source predicate remains validation-only: it still requires an existing directory and the same canonical-root containment check, so missing paths under symlinked parents are not accepted as protected mounts.

This differs from the earlier candidate in #94820 by creating missing roots before mount resolution while preserving the existing canonical containment validation after creation.

User Impact

New rw sandbox launches get read-only skill overlays on the first container creation, even for fresh workspaces that did not already have skills or .agents/skills directories. Existing symlink and non-directory rejection behavior stays intact.

Evidence

  • node scripts/run-vitest.mjs src/agents/sandbox/workspace-mounts.test.ts
    • 15 tests passed, including missing-root materialization and symlink-parent regression coverage.
  • pnpm tsgo:test:src
    • Passed. Local environment warns that Node is v22.18.0 while the repo requests >=22.19.0.
  • node scripts/run-oxlint.mjs src/agents/sandbox/context.ts src/agents/sandbox/workspace-mounts.ts src/agents/sandbox/workspace-mounts.test.ts
    • Passed.
  • pnpm exec tsx -e '<helper proof script>'
    • Confirmed the helper creates all three protected roots and resolveReadOnlyWorkspaceSkillMounts returns mounts for /workspace/skills, /workspace/.agents/skills, and /workspace/.openclaw/sandbox-skills/skills.

Proof gap: I attempted local Docker proof, but Docker could not connect because Colima was stopped, and colima start failed while starting the VM. I could not produce first-launch container write-failure proof from this machine.

@momothemage
momothemage requested a review from a team as a code owner June 23, 2026 07:56
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jun 23, 2026
@momothemage

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@momothemage

Copy link
Copy Markdown
Contributor Author

@clawsweeper automerge

@clawsweeper

clawsweeper Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper automerge is enabled.

  • Head: 5c8969ca8467
  • Label: clawsweeper:automerge
  • Action: exact-head review queued (workflow sweep.yml, event repository_dispatch).
  • Flow: review this head, repair/rebase only if needed, then re-review the exact repaired head before merge.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-06-23 08:19:15 UTC review queued 5c8969ca8467 (queued)

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label Jun 23, 2026
@momothemage

Copy link
Copy Markdown
Contributor Author

@clawsweeper stop

@clawsweeper

clawsweeper Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞✅
Got it. ClawSweeper will leave this item for human review.

I added clawsweeper:human-review, removed clawsweeper:automerge, and paused the automation trail until a maintainer asks again.

@clawsweeper clawsweeper Bot added clawsweeper:human-review Needs maintainer review before ClawSweeper can continue and removed clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge labels Jun 23, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: mattermost Channel integration: mattermost gateway Gateway runtime scripts Repository scripts channel: qqbot extensions: qa-lab extensions: memory-wiki extensions: copilot size: XL and removed size: S labels Jun 23, 2026
@momothemage
momothemage force-pushed the feature/fix-sandbox-skill-mount-ro branch from 50ff8d3 to d4d68ef Compare June 23, 2026 10:01
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation channel: mattermost Channel integration: mattermost gateway Gateway runtime scripts Repository scripts channel: qqbot extensions: qa-lab labels Jun 23, 2026
@clawsweeper

clawsweeper Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 6:59 PM ET / 22:59 UTC.

ClawSweeper review

What this changes

The PR creates absent sandbox skill mount source directories before first writable sandbox startup so their container overlays can be read-only.

Merge readiness

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

This PR remains necessary: current main still excludes missing protected skill roots from first-launch rw mount overlays. Keep it in human review because its June head is conflict-dirty, the linked security report is protected, and supplied evidence lacks an inspectable fresh-container write-failure proof.

Priority: P1
Reviewed head: 5b6e0e4dca9b528ecc5e51741196986a5e82e4d8
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has a credible focused repair direction, but its stale conflict state and missing current-head container proof prevent merge readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The supplied PR body explicitly lacks a fresh Docker/container run showing protected-path writes fail after first launch; add redacted terminal, logs, or live output after rebasing. 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 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The supplied PR body explicitly lacks a fresh Docker/container run showing protected-path writes fail after first launch; add redacted terminal, logs, or live output after rebasing. 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 6 items Current main retains the missing-root behavior: The mount resolver returns only candidates whose host path already exists as a directory, while rw sandbox setup creates only the workspace and syncs skills; it does not materialize the three protected mount roots before mount resolution.
The same resolver feeds the affected sandbox surfaces: Docker and browser execution obtain their protected overlays from the shared resolver; the remote filesystem bridge applies the same existing-source predicate to its protected mount list.
The branch uses the appropriate lifecycle owner: The proposed change adds a setup-time materialization helper after skill sync and leaves later mount resolution validation-only. That is a better owner boundary than giving the resolver filesystem side effects.
Findings None None.
Security None None.

How this fits together

Sandbox setup prepares an agent workspace and a separate materialized-skills workspace before selecting Docker, browser, or remote filesystem execution. Mount resolution turns existing canonical skill directories into narrow read-only overlays inside an otherwise writable workspace.

flowchart LR
  A[Agent workspace] --> B[Sandbox workspace setup]
  C[Materialized skills workspace] --> B
  B --> D[Protected skill mount roots]
  D --> E[Canonical mount validation]
  E --> F[Docker, browser, or bridge runtime]
  F --> G[Writable workspace with read-only skill overlays]
Loading

Decision needed

Question Recommendation
After rebasing, should setup-time creation of missing protected skill roots be the canonical first-launch sandbox hardening, subject to explicit symlink-boundary and runtime-proof review? Rebase and harden: Adopt the setup-time approach after validating its symlink boundary and proving fresh sandbox writes to protected roots fail.

Why: The linked report is security-sensitive, the patch changes filesystem creation semantics at a protected mount boundary, and the PR carries protected human-review signals.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The supplied PR body explicitly lacks a fresh Docker/container run showing protected-path writes fail after first launch; add redacted terminal, logs, or live output after rebasing. 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.
  • Resolve merge risk (P1) - The June branch is conflict-dirty against current main, so it cannot be merged without integrating current sandbox workspace and mount refactors.
  • Resolve merge risk (P1) - This first-launch sandbox-protection change needs redacted runtime proof that all protected paths reject writes in a newly created container.
  • Resolve merge risk (P1) - The rebased implementation must preserve existing symlink-parent rejection when creating security-sensitive host paths.
Agent review details

Security

None.

PR surface

Source +70, Tests +82. Total +152 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 79 9 +70
Tests 1 83 1 +82
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 162 10 +152

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #94425
Summary: This PR is a candidate fix for the linked security report; the earlier candidate PR was closed unmerged and is not a safe replacement.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Rebase with first-launch proof (recommended)
    Reapply the canonical materialization flow to current main, add backend-aware regression coverage, and post redacted evidence that first-launch protected-path writes fail.
  2. Pause for sandbox-owner direction
    Keep the PR in human review if owners prefer a different lifecycle owner for materializing security-sensitive workspace paths.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Rebase onto current main; preserve canonical symlink containment before creating roots; add current-head coverage and redacted first-launch container write-failure proof.

Technical review

Best possible solution:

Rebase the setup-time root-materialization design onto current main, preserve canonical containment at the creation boundary, add current-head shared-runtime coverage, and attach a redacted fresh-container write-failure proof before merge.

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

Yes from source: current main filters a missing protected root out of the rw mount list, while context setup does not create it before backend mount resolution. This read-only review did not run a live container reproduction.

Is this the best way to solve the issue?

Yes in direction: materializing roots during setup before the pure mount resolver is narrower and more maintainable than making the resolver create directories, but the stale patch needs current-main integration and security review.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: On a new writable sandbox, missing skill roots can leave executable skill paths writable until a later container recreation.
  • merge-risk: 🚨 compatibility: Materializing paths during rw sandbox setup changes first-launch workspace contents and must retain existing symlink and non-directory behavior.
  • merge-risk: 🚨 security-boundary: The PR changes how paths intended to be read-only are created and protected before sandbox startup.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.

Evidence

What I checked:

  • Current main retains the missing-root behavior: The mount resolver returns only candidates whose host path already exists as a directory, while rw sandbox setup creates only the workspace and syncs skills; it does not materialize the three protected mount roots before mount resolution. (src/agents/sandbox/workspace-mounts.ts:50, eb8c22ed13f9)
  • The same resolver feeds the affected sandbox surfaces: Docker and browser execution obtain their protected overlays from the shared resolver; the remote filesystem bridge applies the same existing-source predicate to its protected mount list. (src/agents/sandbox/browser.ts:282, eb8c22ed13f9)
  • The branch uses the appropriate lifecycle owner: The proposed change adds a setup-time materialization helper after skill sync and leaves later mount resolution validation-only. That is a better owner boundary than giving the resolver filesystem side effects. (src/agents/sandbox/context.ts:128, 5b6e0e4dca9b)
  • The PR cannot be merged as its current stale head: The head is not an ancestor of current main; local comparison shows substantial changes in all three touched files, and supplied GitHub state reports a dirty merge result. It requires a rebase and fresh review. (src/agents/sandbox/context.ts:77, eb8c22ed13f9)
  • Feature-history ownership is only weakly available: Available blame attributes the current mount resolver to the shallow/grafted current-main root commit; deeper history lookup could not retrieve missing promisor objects because the GitHub host was unavailable. (src/agents/sandbox/workspace-mounts.ts:50, 9aceb1620d4f)
  • Supplied proof does not show the affected runtime outcome: The PR body reports focused tests and helper output but expressly says Docker/Colima failure prevented a first-launch container proof that writes to protected paths fail. (5b6e0e4dca9b)

Likely related people:

  • Jesse Merhi: The available shallow blame attributes the current workspace mount resolver and setup path to the current-main root commit; deeper feature history is unavailable in this checkout. (role: current implementation provenance; confidence: low; commits: 9aceb1620d4f; files: src/agents/sandbox/context.ts, src/agents/sandbox/workspace-mounts.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase the three touched sandbox files onto current main and resolve the dirty merge state.
  • Run a fresh rw sandbox/container proof that attempts writes to all protected roots and post redacted output.
  • Refresh coverage for the shared Docker, browser, and filesystem-bridge mount decision surface.

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 (2 earlier review cycles)
  • reviewed 2026-06-30T21:35:17.578Z sha 5b6e0e4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-30T10:44:44.188Z sha 5b6e0e4 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jun 23, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 30, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 18, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks for the PR. We're closing older pull requests that have gone stale against current main.

This branch has been conflicting and unchanged since June, with no behavior proof. The underlying issue stays tracked in #94425, and a fresh PR against current main would be welcome.

If this change is still needed, please open a fresh PR against current main and we'll review it there.

@steipete

Copy link
Copy Markdown
Contributor

Continued in #182412 (credited replacement built on this PR's commits) as part of an old-bug repair sweep. Thank you for the original work.

steipete added a commit that referenced this pull request Oct 24, 2026
…182412)

Materialize the existing managed skill roots at workspace preparation before
mount selection, retaining canonical containment, filesystem mutation guards,
and current workspace custody. Continue the original first-launch repair
from PR #96028 on the current sandbox lifecycle.

Co-authored-by: momothemage <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…penclaw#182412)

Materialize the existing managed skill roots at workspace preparation before
mount selection, retaining canonical containment, filesystem mutation guards,
and current workspace custody. Continue the original first-launch repair
from PR openclaw#96028 on the current sandbox lifecycle.

Co-authored-by: momothemage <[email protected]>
@RomneyDa
RomneyDa deleted the feature/fix-sandbox-skill-mount-ro branch November 30, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:human-review Needs maintainer review before ClawSweeper can continue maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security/Bug] Sandbox 'skills' directory lacks initial read-only protection if host directory is missing upon agent creation

3 participants