Skip to content

fix(sandbox): isolate materialized skills mount target - #126775

Closed
LiuwqGit wants to merge 2 commits into
openclaw:mainfrom
LiuwqGit:feat/issue-126631-sandbox-skills-bind-mount-root-owned
Closed

LiuwqGit wants to merge 2 commits into
openclaw:mainfrom
LiuwqGit:feat/issue-126631-sandbox-skills-bind-mount-root-owned

Conversation

@LiuwqGit

@LiuwqGit LiuwqGit commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted: yes

What Problem This Solves

Fresh writable Docker sandboxes can lose access to generated skills. Docker creates the missing nested target under /workspace as root:root. A non-root sandbox user then cannot traverse /workspace/.openclaw, so skill reads fail with Permission denied.

Upgrading an OpenClaw build on a machine with a recently used (hot) writable Docker or Podman sandbox must not break that running sandbox: the retained container still has the old nested skills mount, so advertising the new direct path would make every skill command and working-directory reference fail until the container is recreated.

Closes #126631.

Why This Change Was Made

The earlier patch tried to create and change ownership on the nested host path. That added a privileged filesystem walk inside an attacker-writable workspace. An opened directory can be renamed outside the workspace before a later descriptor-relative create or ownership change.

This repair removes that walk. Docker and Podman now mount the generated skill workspace at a direct child of the configured workdir. With the default workdir, the model-visible skill path is /workspace/.openclaw-skills/skills/<name>/SKILL.md. Docker does not create the bind target in the writable host workspace. SSH keeps its existing remote workspace layout.

The container lifecycle deliberately retains hot containers across config changes (requireCurrentConfig stays unset for normal run setup). To keep prompts and file mapping aligned with such a retained container, ensureSandboxContainer now reports the skills mount layout the container actually has — probed from its live mount list — and prompt mapping, skill usage paths, and the filesystem bridge follow that layout until the container's normal safe recreation installs the new one. Freshly created containers always use the direct layout.

Sandbox bind validation reserves the generated path. Direct, descendant, and covering custom binds are rejected by default. The existing explicit dangerous override remains available for trusted runtimes.

The generated-skills path is backend-specific: Docker and Podman use <workdir>/.openclaw-skills/skills (derived from the configured workdir), while SSH and OpenShell keep the nested <workdir>/.openclaw/sandbox-skills/skills layout. The sandboxing docs now state the distinction, identify /workspace as the default workdir, and document the reserved bind destination including relocation guidance for binds that an upgrade can invalidate.

The mount resolver preserves the nested layout for the context shape shipped with plugin-sdk v2026.9.3 and earlier: SandboxFsBridgeContext carried neither backendId nor skillsMountLayout, and the resolver itself accepted neither field. An omitted backendId therefore no longer selects the Docker direct mount — unchanged remote SDK callers keep mapping local materialized skills to the nested remote destination they upload to. Docker and Podman consumers select the direct layout explicitly via their backend id (or the probed skillsMountLayout), matching the prompt-side mapping that already required an explicit docker/podman backend for the direct layout.

User Impact

  • Non-root writable sandboxes can read generated managed, bundled, and plugin skills.
  • The writable workspace no longer receives a root-owned .openclaw mount target.
  • The generated Docker and Podman skill path changes from /workspace/.openclaw/sandbox-skills/skills to /workspace/.openclaw-skills/skills for the default workdir.
  • After upgrading, a recently used writable Docker or Podman sandbox keeps working: OpenClaw advertises the skills path the retained container actually has until the container is safely recreated (openclaw sandbox recreate), instead of advertising a path that only fresh containers have.
  • Workspace skills remain at /workspace/skills and /workspace/.agents/skills.
  • Remote plugins built against the shipped plugin-sdk context shape keep reading materialized skills after the upgrade: their local materialized skill still maps to the nested remote destination the remote layout uploads to, instead of a direct Docker destination that never exists on the remote side.

Evidence

Real Docker red/green: On main 5d8ef653cd7198797983a957cd7b850f9880a8e9, a real writable Docker sandbox ran as UID 1000. Docker created .openclaw as root:root mode 0700, and the materialized skill read failed with Permission denied. On repaired head 8b577f1a6ad91523c65a5377744a0fc563e24025, the same resolver and Docker flow read the unique skill marker from /workspace/.openclaw-skills/skills, while /workspace remained writable and the old host target stayed absent. A second run with workdir /openclaw-skills read the marker from /openclaw-skills/.openclaw-skills/skills.

Race proof: During exact-head Docker provisioning, a worker replaced .openclaw with a symlink to an outside directory 90,252 times. The outside directory listing, sentinel hash, mode, UID, and GID stayed unchanged. No outside sandbox-skills path was created. The sandbox still read its unique skill marker and wrote through /workspace.

Upgrade transition (retained hot container) — real Docker:

  • Real environment tested: local Docker daemon (two real containers simulating a retained pre-upgrade sandbox with only the nested mount /workspace/.openclaw/sandbox-skills/skills:ro, and a fresh direct-mount container with /workspace/.openclaw-skills:ro), driven through the real execContainer CLI path, the new readContainerSkillsMountLayout probe, and resolveSandboxSkillRuntimeInputs from this branch.
  • Exact steps or commands run after this patch: docker inspect -f '{{range .Mounts}}{{println .Destination}}{{end}}' on the retained container (shows only the nested destination); probe the retained container's layout; probe the fresh container's layout; map skill paths with the pre-fix mapping (backend id only) and the fixed mapping (probed layout); verify each advertised path inside the real retained container with docker exec test/cat.
  • Evidence after fix: the captured transition log from the real retained and fresh containers is reproduced below.
=== probed layout of retained pre-upgrade container ===
"nested"

=== probed layout of fresh direct-mount container ===
"direct"

=== BEFORE fix — advertised path inside retained container ===
{
  "advertised": "/workspace/.openclaw-skills/skills/demo/SKILL.md",
  "existsInRetainedContainer": false
}

=== AFTER fix — advertised path inside retained container ===
{
  "advertised": "/workspace/.openclaw/sandbox-skills/skills/demo/SKILL.md",
  "existsInRetainedContainer": true,
  "content": "# demo skill"
}

=== fresh container — advertised path ===
{
  "advertised": "/workspace/.openclaw-skills/skills/demo/SKILL.md",
  "existsInFreshContainer": true
}
  • Observed result after fix: the retained pre-upgrade container is probed as nested and its advertised skill path exists and is readable inside it; the pre-fix mapping advertised a path that does not exist in that container; fresh containers keep advertising and reading the direct path.
  • What was not tested: a full end-to-end gateway upgrade against a real pre-upgrade OpenClaw installation (the retained-container lifecycle decision — keep the container, probe its mounts — is covered by the docker.skills-mount-layout and docker.config-hash-recreate unit tests against the mocked engine CLI); the /skills prompt-inspection command path, which does not create a container and therefore always shows the current direct layout; and Podman on a real machine (Podman shares the same lifecycle and probe code path).

Shipped-SDK compatibility (remote bridge, v2026.9.3 context shape):

  • Real environment tested: the real createRemoteShellSandboxFsBridge and resolveReadOnlyWorkspaceSkillMounts production modules driven with the exact shipped SDK context shape (SandboxFsBridgeContext without backendId and without skillsMountLayout, as exported by plugin-sdk v2026.9.3), over a real on-disk workspace, materialized skills workspace, and remote workspace directory; the shell runner executes real scripts locally.
  • Exact steps or commands run after this patch: construct the remote bridge with the old-shaped context; resolve the local materialized skill path; resolve the nested remote container path; attempt a write through it.
  • Evidence after fix: the captured old-shape mapping and protection results are reproduced below.
old-shaped context (no backendId, no skillsMountLayout):
  local materialized skill -> containerPath: <remote-workspace>/.openclaw/sandbox-skills/skills/demo/SKILL.md   (nested, matches the shipped remote upload layout)
  nested container path resolves inside the mounts
  write through the nested path: rejected (read-only)

explicit docker/podman backend, no skillsMountLayout:
  materialized skills mount -> containerPath: <workdir>/.openclaw-skills   (direct, unchanged)
  • Observed result after fix: the shipped-SDK context shape keeps the nested layout — the local materialized skill maps to <remote-workspace>/.openclaw/sandbox-skills/skills/... (the path the remote layout uploads to), and the Docker-only direct destination is selected only by an explicit docker/podman backend or skillsMountLayout: "direct". Before this repair, the omitted-backend shape selected the direct layout, so an unchanged remote plugin mapped its local materialized skill to <remote-workspace>/.openclaw-skills/skills/..., a path that never exists on the remote side — reads failed.
  • What was not tested: a real SSH server round trip (the bridge tests drive the real bridge modules with a local script runner, per the repository's established remote-bridge test pattern); a real unchanged third-party plugin binary (the shipped SDK context shape is reproduced exactly instead).

Regression tests: docker.skills-mount-layout.test.ts covers the retained-hot-container probe for both layouts plus fresh creation; docker.config-hash-recreate.test.ts covers hot-container retention without recreation; sandbox-skills.test.ts covers nested/direct prompt-path selection; workspace-mounts.test.ts covers the nested mapping for retained Docker containers, the nested default for the shipped SDK context shape, and the explicit docker/podman direct selection; workspace-skills-bridge-readonly.test.ts covers the old-shaped remote bridge mapping (local materialized skill → nested remote destination) and keeps remote protection covered.

Validation:

  • Exact-head pnpm install --frozen-lockfile and full pnpm build passed.
  • Exact-head focused mount, prompt, filesystem, workdir, context, command, CLI, and diagnostic tests passed across five Vitest shards.
  • Exact-head real Docker workspace isolation E2E passed.
  • Exact-head changed-scope type checks, lint, dead-code scan, and repository ratchets passed with exit 0.
  • pnpm docs:list and pnpm docs:check-mdx passed; the MDX check covered 791 files.
  • Changed files passed oxfmt and git diff --check.
  • Follow-up head (rebased onto current main): tsgo:core clean; focused Vitest runs green across the affected sandbox, embedded-agent, agents-tools, auto-reply, and CLI shards (330+ tests), including the rebase-conflict resolution in commands-system-prompt.test.ts; changed files pass oxfmt/oxlint.
  • Current head (rebased onto latest main, adds the shipped-SDK nested-layout default): validate.sh fully green (oxfmt, oxlint, same-directory Vitest, tsgo:core); focused Vitest runs green across the affected sandbox, embedded-agent, agents-tools, auto-reply, and CLI shards (640+ tests, 5 shards), including the new shipped-SDK-shape regressions. Before the repair, both new regressions fail on the pre-fix condition (RED confirmed by reverting the resolver change: 2 failed / 33 passed).

Line count: production +43/-19, tests and test support +120/-106, docs +1/-1 for the original repair. The follow-up adds the layout probe (+41 source lines including the new skills-mount-layout.ts probe module), layout-aware prompt/file mapping, and the two documentation corrections.

@LiuwqGit
LiuwqGit requested a review from a team as a code owner August 20, 2026 18:05
@clawsweeper

clawsweeper Bot commented Aug 20, 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 docker Docker and sandbox tooling agents Agent runtime and tooling labels Aug 20, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 20, 2026
@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

Moves generated Docker and Podman skills to a direct read-only mount while preserving retained-container and remote-plugin layouts.

Example: A fresh writable Docker sandbox runs as UID 1000 and reads the demo skill.

  • Before: Reading /workspace/.openclaw/sandbox-skills/skills/demo/SKILL.md fails with Permission denied.
  • After: Reading /workspace/.openclaw-skills/skills/demo/SKILL.md succeeds while /workspace remains writable.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong behavioral evidence supports the core repair; a low-impact diagnostic defect remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Real Docker provisioning and reads exercise the changed mount owner as UID 1000, including a custom workdir, writable workspace, and outside-path protection; real inspect/exec traces exercise nested retained and direct fresh containers, and production bridge output covers the older SDK context shape.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A non-root writable sandbox cannot read generated skills because Docker creates an inaccessible nested mount ancestor.
Reason: Restores established skill readability with maintainer-supported direction and concrete Docker evidence.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this PR open: it provides a proven repair for unreadable sandbox skills that current main still needs, with one prior diagnostic finding and a reported merge conflict remaining.

Priority: P1
Reviewed head: 132d4e552e3cace7086f23a561a4ac1944b63b4d

Before merge

  • Pass the backend into sandbox explain's mount projection (P3) - For a fresh writable Docker or Podman sandbox with materialized skills, this caller supplies neither backendId nor skillsMountLayout to buildSandboxFsMounts. The introduced resolver therefore selects its nested compatibility default, and sandbox explain reports /workspace/.openclaw/sandbox-skills/skills in text and JSON even though new containers mount /workspace/.openclaw-skills. Pass sandboxCfg.backend here and cover generated-skills diagnostics while preserving the omitted-backend default for older remote SDK callers. This prior finding remains unfixed.
  • Complete next step - Resolve the GitHub-reported merge conflict against current main.

Findings

  • [P3] Pass the backend into sandbox explain's mount projection — src/commands/sandbox-explain.ts:247-254

Tests

  • Missing end-to-end proof: Generated-skills output from sandbox explain lacks focused coverage demonstrating the correct Docker and Podman destination.
Agent review details

How this fits together

Sandbox provisioning turns workspace and materialized-skill directories into container mounts; prompts, file tools, working-directory validation, and diagnostics must project those same mounts.

flowchart TD
  A[Sandbox configuration] --> B[Workspace and skill preparation]
  B --> C[Container lifecycle]
  C --> D[Actual skills mount layout]
  D --> E[Prompt and file mapping]
  E --> F[Agent skill reads]
Loading

Technical review

Best possible solution:

Retain the direct-mount repair and compatibility handling, and pass the resolved backend into sandbox explain's existing mount projection.

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

The report, current-main mount topology, and supplied real Docker red/green traces establish the skill-read failure; this read-only review executed no target code.

Is this the best way to solve the issue?

Moving the generated mount fixes its topology at the provisioning owner without a privileged workspace ownership walk, while live-layout propagation preserves retained containers.

Full review comments:

  • [P3] Pass the backend into sandbox explain's mount projection — src/commands/sandbox-explain.ts:247-254
    For a fresh writable Docker or Podman sandbox with materialized skills, this caller supplies neither backendId nor skillsMountLayout to buildSandboxFsMounts. The introduced resolver therefore selects its nested compatibility default, and sandbox explain reports /workspace/.openclaw/sandbox-skills/skills in text and JSON even though new containers mount /workspace/.openclaw-skills. Pass sandboxCfg.backend here and cover generated-skills diagnostics while preserving the omitted-backend default for older remote SDK callers. This prior finding remains unfixed.
    Confidence: 0.99

Overall correctness: patch is correct
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Materialized-skills mount destination changes intended behavior with a stated reason (3b6bcbf: Expose non-workspace skills read-only in writable sandboxes without advertising inaccessible host paths.)
  • Hot-container retention keeps the original intent (79d8267: Retain recently used running containers during configuration drift instead of disrupting active work.)
  • Reserved bind destinations keeps the original intent (c070be1: Prevent custom binds from shadowing protected sandbox mount destinations.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Verified introduced changes: The pinned introduction changes mount creation, layout propagation, prompt mapping, bind validation, documentation, and regression coverage. (src/agents/sandbox/workspace-mounts.ts:119, 132d4e552e3c)
  • Current main retains the affected topology: Current main still mounts the materialized skills child at the nested .openclaw/sandbox-skills/skills destination; it does not contain this direct-mount repair. (src/agents/sandbox/workspace-mounts.ts, 137e7b2abc87)
  • Prior diagnostic finding remains: sandboxExplainCommand calls buildSandboxFsMounts without backendId; the introduced resolver consequently selects its compatibility-preserving nested default. (src/commands/sandbox-explain.ts:247, 132d4e552e3c)
  • Maintainer-supported direction and Docker proof: Collaborator obviyus confirmed real UID-1000 skill reads, custom-workdir behavior, workspace writes, and unchanged outside metadata during ancestor swaps in fix(sandbox): isolate materialized skills mount target #126775 (comment), and requested sandbox security-owner review.
  • Retained-container and SDK compatibility evidence: The complete PR body supplies real Docker inspect/exec output showing readable nested paths in retained containers and direct paths in fresh containers, plus production remote-bridge output preserving the shipped SDK context shape. (src/agents/sandbox/skills-mount-layout.ts:12, 132d4e552e3c)
  • Live merge and check state: GitHub reports mergeable=false and mergeable_state=dirty for the reviewed head; all paginated check runs have successful, skipped, or neutral conclusions. (132d4e552e3c)

Likely related people:

  • Peter Steinberger: Raw commit 0d4eb03 adds src/agents/sandbox/workspace-mounts.ts:96 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0d4eb03c0357; files: src/agents/sandbox/workspace-mounts.ts)
  • Vincent Koc: Raw commit 30346f9 adds src/agents/sandbox/docker.ts:569 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 30346f97883c; files: src/agents/sandbox/docker.ts)
  • brokemac79: Raw commit 3b6bcbf adds src/agents/sandbox/workspace-mounts.ts:92 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 3b6bcbfb5045; files: src/agents/sandbox/workspace-mounts.ts)

PR surface

Source +174, Tests +507, Docs 0, Other +1. Total +682 across 32 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 15 201 27 +174
Tests 14 597 90 +507
Docs 2 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 32 801 119 +682

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #126631
Summary: This PR repairs the canonical permission failure; concurrent catalog reads and replaced bind-source directories are separate mechanisms.

Members:

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

Labels

Label changes:

  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P1: Fresh non-root writable sandboxes can lose access to generated skills, breaking an existing agent workflow.
  • merge-risk: 🚨 compatibility: The generated container destination changes; the maintainer-supported repair preserves retained-container layouts and older remote SDK callers, with those compatibility paths explicitly exercised.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (48 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-03T22:24:41.800Z sha 8b577f1a6ad91523c65a5377744a0fc563e24025 :: blocked before merge. :: [P2] Document backend-specific generated-skill paths | [P3] Document the generated-skills bind reservation
  • reviewed 2026-09-07T06:36:03.426Z sha e5f14dd51190dcd0ce610caecf11b83d4b0b51df :: blocked before merge. :: [P1] Keep skill paths aligned with retained running containers | [P2] Document backend-specific generated-skill paths | [P3] Document the generated-skills bind reservation
  • reviewed 2026-09-10T02:14:24.695Z sha 7ccfba42a7a6e4e6cf85390c657d48ee9fb11777 :: blocked before merge. :: [P1] Preserve the nested layout for existing SDK callers
  • reviewed 2026-09-10T02:33:46.559Z sha af77293f986d4f946d52a4aa4721227eae73e761 :: blocked before merge. :: [P1] [P1] Preserve the nested layout for existing SDK callers
  • reviewed 2026-09-10T04:13:50.774Z sha ae529b8b485181bd9b45176262e13aa7e3fb2c95 :: blocked before merge. :: [P3] [P3] Pass the backend into sandbox explain's mount projection
  • reviewed 2026-09-10T04:45:43.682Z sha 132d4e5 :: blocked before merge. :: [P3] [P3] Pass the backend into sandbox explain's mount projection
  • reviewed 2026-09-25T20:03:39.364Z sha 132d4e5 :: blocked before merge. :: [P3] Pass the backend into sandbox explain’s mount projection
  • reviewed 2026-10-06T12:35:14.927Z sha 132d4e5 :: blocked before merge. :: [P3] Pass the backend into sandbox explain's mount projection

Reviewed October 18, 2026, 1:01 AM ET / 05:01 UTC (Revision 49).

@LiuwqGit
LiuwqGit force-pushed the feat/issue-126631-sandbox-skills-bind-mount-root-owned branch 2 times, most recently from 1aaa9bf to f0e05b8 Compare August 20, 2026 18:38
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 20, 2026
@LiuwqGit
LiuwqGit force-pushed the feat/issue-126631-sandbox-skills-bind-mount-root-owned branch from f0e05b8 to 48b8d05 Compare August 21, 2026 00:38
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Aug 21, 2026
@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI is fully green on the latest head (48b8d05): check-lint, check-lint-core-1..5, all Critical Quality / Security High / boundary / Scan changed paths shards pass; the earlier checks-node-compact-small-25 (server-restart-sentinel) failure was flaky and passes locally and on this rerun.

Real-behavior proof was strengthened in the PR body with three captured Docker runs:

  1. Deterministic root-cause — Docker materializes the missing host bind target as root:root.
  2. Exact reported symptom — host bind source forced to root:root 0770 reproduces ls: ... Permission denied / cat: ... Permission denied for uid 1000.
  3. Fix — orchestrator pre-creates + chowns the host bind target (and session-scoped chain) to the sandbox user (1000:1000); uid 1000 reads the mounted skill (sandbox-skill-readable).

Regression test now asserts the materialized skills mount destination AND its session-scoped ancestor are both provisioned and owned by the sandbox user. Local: 90 tests pass across the affected sandbox suites.

@clawsweeper

clawsweeper Bot commented Aug 21, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit
LiuwqGit force-pushed the feat/issue-126631-sandbox-skills-bind-mount-root-owned branch from 48b8d05 to 47ac65b Compare August 21, 2026 00:52
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 21, 2026
@LiuwqGit
LiuwqGit force-pushed the feat/issue-126631-sandbox-skills-bind-mount-root-owned branch from 47ac65b to 6298f1c Compare August 21, 2026 01:51
@LiuwqGit
LiuwqGit force-pushed the feat/issue-126631-sandbox-skills-bind-mount-root-owned branch from 6298f1c to 85879e1 Compare August 21, 2026 01:52
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 21, 2026
@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Revised head 85879e1d addresses the three prior P1s:

  1. Effective container user (compatibility) — alignMaterializedSkillsMountOwnership now runs in resolveProvisionedSandboxContext after resolveSandboxDockerUser, so ownership follows the resolved docker.user (honoring an explicit config like 2000:2000), not the agent workspace owner.
  2. Nonfatal provisioning (availability) — every fs op is caught; a stale/inaccessible state path no longer aborts sandbox provisioning. The canonical skill-sync leaf creation is reused (only an idempotent best-effort mkdir remains).
  3. Shared-scope stability (compatibility) — shared scope (one materializedSkillsRoot across workspaces) keeps ownership stable (mode 0755, no per-caller chown); a later caller cannot break an already-running shared sandbox.

Regression coverage: two resolveSandboxContext tests — session-scope effective-user ownership, and shared-scope stability across two callers. L2 Docker proof (deterministic root-cause + exact Permission-denied symptom + fix) is in the PR body.

CI on this head: check-lint, check-lint-core-1..5, Critical Quality, Security High, boundaries, Scan changed paths all pass. The only red is checks-node-changed-extensions-config-14 → extensions/codex/src/app-server/remote-workspace-media.test.ts shares one configured deadline across an entire attachment batch failing with batch timed out — a timing test in the codex extension with no code path to this sandbox change; it passes locally on this head (216ms). It is unrelated flakiness, not a regression from this patch.

@clawsweeper

clawsweeper Bot commented Aug 21, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased head d64c2f0 onto latest main (1 ahead, 0 behind) addresses the two prior findings:

  1. [P2] Parse numeric Docker users exactly — docker.user is now parsed by the new exported resolveEffectiveDockerUser: only a full "uid" or "uid:gid" of non-negative integers counts as numeric. "1000node" is a named user (mode 0755), not UID 1000; malformed forms (":gid", "uid:", "uid:gid:extra") are also rejected. Deterministic unit coverage: resolveEffectiveDockerUser parses 1000 / 2000:2000; rejects 1000node, node, 1000:node, :1000, 1000:, 1000:1000:1000.

  2. [P1] Anchor creation below a pinned no-follow root — the walk now re-lstats the immediate parent right before each mkdir and re-lstats the created child immediately after, so an ancestor swapped to a symlink between iterations cannot redirect the mkdir outside the workspace; a symlinked/non-directory parent or created child stops provisioning without mutating anything beneath. Ownership is still applied only via a no-follow fd (O_NOFOLLOW | O_DIRECTORY) after a realpath-containment check (isPathStrictlyInside(workspaceReal, realEntry)), so the privileged fchown/fchmod cannot escape the workspace. Added regression: a symlinked .openclaw intermediate ancestor (not just the leaf) leaves the outside target uncreated and unmodified.

Nonfatal and bounded to the .openclaw/sandbox-skills subtree; the caller's project root is never touched.

Local verification (Node 26.7.0, satisfies the SQLite WAL gate):

  • src/agents/sandbox.126631-bind-target.test.ts: 16 passed (incl. the new resolveEffectiveDockerUser unit cases + the symlinked-intermediate-ancestor refusal + the numeric-prefix-named-user mode).
  • src/agents/sandbox.resolveSandboxContext.test.ts: 17 passed.
  • tsgo -p tsconfig.core.json: clean (no type errors in the changed source/test).

@clawsweeper

clawsweeper Bot commented Aug 22, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI is fully green on head add06ac6 (rebased onto latest main, 1 ahead / 0 behind): openclaw/ci-gate pass, check-dependencies (incl. production Knip deadcode:dependencies/deadcode:exports), check-lint + oxfmt, check-test-types, Critical Quality, Security High, and all boundary shards pass. No outstanding lint/type/deadcode issues.

This head keeps the two prior fixes and adds the deadcode compliance repair:

  1. [P2] Parse numeric Docker users exactly — docker.user is parsed by resolveEffectiveDockerUser (now in src/agents/sandbox/docker-user.ts, a production module consumed by context.ts): only a full "uid" or "uid:gid" of non-negative integers counts as numeric, so "1000node" is a named user (mode 0755), never UID 1000; ":gid", "uid:", "uid:gid:extra", and any non-digit are rejected.
  2. [P1] Anchor creation below a pinned no-follow root — the walk re-lstats the immediate parent before each mkdir and the created child after, so an ancestor swapped to a symlink between iterations cannot redirect the mkdir outside the workspace; ownership is applied only via a no-follow fd (O_NOFOLLOW | O_DIRECTORY) after a realpath-containment check, so the privileged fchown/fchmod cannot escape the workspace. Regression: a symlinked .openclaw intermediate ancestor leaves the outside target uncreated and unmodified.

Local verification (Node 26.7.0): sandbox.126631-bind-target.test.ts 16 passed; sandbox.resolveSandboxContext.test.ts 17 passed; context.user-fallback.test.ts 6 passed; tsgo -p tsconfig.core.json clean; production Knip scan clean (no unused exports); oxfmt --check clean.

@clawsweeper

clawsweeper Bot commented Aug 22, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI fully green on head 92ac88c (rebased onto latest main, 1 ahead / 0 behind): openclaw/ci-gate pass, check-dependencies (incl. production Knip deadcode:dependencies/deadcode:exports), check-lint + oxfmt, check-test-types, Critical Quality, Security High, all boundary shards pass.

This head addresses the remaining P1 — Pin the full host-path walk to a no-follow descriptor — with a descriptor-rooted traversal for both creation and metadata:

  • The workspace root is pinned once with O_NOFOLLOW | O_DIRECTORY (a descriptor a writable-workspace actor cannot swap).
  • On Linux, every segment is then created (mkdirSync("/proc/self/fd/<parentFd>/<segment>")) and reopened (openSync("/proc/self/fd/<parentFd>/<segment>", O_NOFOLLOW | O_DIRECTORY)) relative to that pinned parent descriptor. /proc/self/fd/<fd> is a kernel-managed magic-link guaranteed to point at the fd's directory; an ancestor replaced with a symlink after the root was pinned does not redirect the fd-relative lookup, and O_NOFOLLOW on every step refuses a symlinked segment. So the privileged fchown/fchmod (applied via the leaf fd) only ever mutates a real descendant of the pinned workspace root — an intermediate-ancestor swap is rejected at its open, before any metadata change.
  • Non-Linux hosts (no /proc/self/fd) fall back to a pathname O_NOFOLLOW walk; the root-owned bind-target bug is specific to rootful Docker on Linux.
  • Ownership is applied only to descriptors this walk CREATES, so a configured docker.user never re-owns pre-existing workspace metadata. Nonfatal throughout.

Regression coverage already includes the symlinked intermediate-ancestor case (does not follow a symlinked .openclaw intermediate ancestor): with the fd-rooted walk, /proc/self/fd/<rootFd>/.openclaw is a symlink → O_NOFOLLOW refuses → provisioning stops, the outside target is never created or owned. Plus the resolveEffectiveDockerUser unit cases (P2) and named/numeric-prefix named docker.user mode.

Local verification (Node 26.7.0, Linux): sandbox.126631-bind-target.test.ts 16 passed; sandbox.resolveSandboxContext.test.ts 17 passed; context.user-fallback.test.ts 6 passed; tsgo -p tsconfig.core.json clean; production Knip scan clean; oxfmt --check clean. The descriptor-rooted walk was also validated directly (fd-relative mkdir/open via /proc/self/fd/<fd>/<segment>; symlinked segment refused with ENOTDIR).

@clawsweeper

clawsweeper Bot commented Aug 22, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

PR body updated on the current head 92ac88ca with the final-head adversarial proof requested by the bot: a deterministic ancestor-replacement race (pin the workspace root with O_NOFOLLOW|O_DIRECTORY while .openclaw is a real dir, then swap .openclaw to a symlink pointing at an outside dir, then continue the descriptor-rooted walk). Result: the outside target is never created, never chown'd, and the symlink is never followed — the pinned root fd + /proc/self/fd/<fd>/<segment> fd-relative opens with O_NOFOLLOW reject the swapped ancestor at its open before any outside mkdir/chmod/chown. The "Real behavior proof" section now documents this on the exact current head, alongside the deterministic root-cause reproduction and the clean-case fix proof.

@clawsweeper

clawsweeper Bot commented Aug 22, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Head ccd86ee1 (rebased onto latest main, 1 ahead / 0 behind) addresses the two follow-up P1s from the last review, and the PR body is updated to this exact head:

  1. [P1] Remove the non-Linux pathname fallback — provisioning is now Linux-only: alignMaterializedSkillsMountOwnership returns early when process.platform !== "linux". The non-Linux pathname fallback (whose lstat-to-mkdir gap could redirect creation or the privileged metadata change outside the workspace) is removed entirely; the walk is solely the descriptor-rooted /proc/self/fd path. The root-owned bind-target bug is specific to rootful Docker on Linux.

  2. [P1] Preserve host ownership for rootless Podman — host ownership is now backend-specific. Rootless Podman (keep-id) maps the invoking host user into the container, so the host bind target stays owned by the host user (process uid/gid), never chowned to the literal container docker.user (which would break the keep-id mapping when host/container IDs differ). Docker and rootful Podman do not remap uids, so the container docker.user is the correct host owner there. Regression: preserves host ownership for rootless Podman (keep-id) — dockerUser: "2000:2000" on a podman backend leaves the bind target owned by the process uid, not uid 2000.

CI green on ccd86ee1; body updated with the final-head adversarial ancestor-replacement proof. Local: sandbox.126631-bind-target.test.ts 17 passed; tsgo -p tsconfig.core.json clean; production Knip clean; oxfmt clean.

@clawsweeper

clawsweeper Bot commented Aug 22, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Head d53f7397 (rebased onto latest main, 1 ahead / 0 behind) addresses the three findings from the last review with a single unified ownership mechanism, and the PR body is updated to this head:

  1. [P1] Use the actual Podman rootless state + [P1] Handle failed ownership changes for numeric users — both are resolved by one mechanism: the walk tries fchown to the numeric docker.user; if that is not permitted (a non-root process cannot chown to a distinct uid, and rootless Podman keep-id would break if the host bind target were chowned to the literal container id) it falls back to fchmod 0755. 0755 keeps the mount target traversable under any user-namespace mapping, so rootless Podman, rootful Podman driven by a non-root controller, and rootful Docker are all covered without inferring rootless state from the process uid (the process.getuid heuristic is removed). A named docker.user gets 0755 directly. The previous hostOwner/isRootlessPodman heuristic is gone.

  2. [P2] Keep Linux-only assertions off non-Linux hosts — the dir-asserting ownership tests are gated with itLinux (process.platform === "linux" ? it : it.skip), so they skip rather than fail on macOS/Windows; the resolveEffectiveDockerUser parser tests stay platform-neutral.

Regression: preserves host ownership for rootless Podman (keep-id) now asserts the 0755 fallback for dockerUser: "2000:2000" on a podman backend (fchown to 2000 not permitted for a non-root host → 0755, entry stays owned by the host process, not uid 2000).

CI green on d53f7397. Local: sandbox.126631-bind-target.test.ts 17 passed; tsgo -p tsconfig.core.json clean; oxlint clean; production Knip clean; oxfmt clean.

@clawsweeper

clawsweeper Bot commented Aug 22, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Head 263f1313 is the same logic as d53f7397 (Loop 5: unified fchown→fchmod 0755 fallback, removed the process.uid rootless heuristic, Linux-gated ownership tests) plus an oxfmt formatting fix for the gated itLinux(...) callbacks (the format check is now clean with the default formatter threads). No logic change from d53f7397. PR body updated to this head.

@clawsweeper

clawsweeper Bot commented Aug 22, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact-head CI is now fully green on 263f1313: openclaw/ci-gate pass, check-dependencies (production Knip deadcode:dependencies/deadcode:exports), check-lint + oxfmt, check-test-types, all Critical Quality / Security High / boundary / Scan changed paths shards pass — 0 pending, 0 failures. The only previously-open "Before merge" item was "wait for the queued exact-head checks"; those are now complete on this head. No code changes since the last review — this is a green-CI confirmation on the exact reviewed head.

@clawsweeper

clawsweeper Bot commented Aug 22, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@obviyus

obviyus commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks @LiuwqGit!

Proof: A real writable Docker sandbox ran as UID 1000. On current main, Docker created the nested generated-skills target as root:root mode 0700, and the skill read failed with Permission denied. On exact head 8b577f1a, the same flow read the unique skill marker from /workspace/.openclaw-skills/skills. A custom /openclaw-skills workdir also passed. During 90,252 ancestor swaps, no outside path or metadata changed.

  • Bug: A fresh non-root writable sandbox could not read generated managed, bundled, or plugin skills.
  • Fix: The mount owner now places one generated read-only skills mount below the configured workdir and reserves that target from custom binds.

Example

Before After
Reading the generated skill returns Permission denied. The same non-root sandbox reads the skill and keeps its workspace writable.

Validation

  • pnpm build
  • Focused pnpm test run for the changed prompt, filesystem, mount, security, workdir, CLI, and diagnostic files: 5 shards passed.
  • OPENCLAW_SANDBOX_TEST_IMAGE=<built-image> pnpm test test/e2e/qa-lab/runtime/openclaw-sandbox-workspace-isolation.e2e.test.ts: 1 passed.
  • pnpm docs:list, pnpm docs:check-mdx, pnpm check:changed, and git diff --check: passed.
  • Exact-head CI: run 33235978930 passed. Exact-head local ClawSweeper reached 🐚 platinum hermit with no findings, security concerns, maintainer decision, or Rank-up moves.

The old-head Rank-up move asked for the custom-workdir collision repair plus separate Docker, Podman, and browser creation tests. The dynamic target and real custom-workdir Docker proof are complete. I skipped separate Podman/browser creation tests because all three creation paths consume the same tested resolveReadOnlyWorkspaceSkillMounts result; the real Docker E2E covers the container bind boundary.

@openclaw/openclaw-secops, please review the sandbox security boundary before landing.

@LiuwqGit

LiuwqGit commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased onto latest main as head e5f14dd5119 (base 8e41baff, 1 ahead / 0 behind). The Docker/Podman fix is unchanged; the rebase required one semantic repair against upstream evolution:

Backend-aware materialized skills layout. Main reworked the remote filesystem bridge to derive its protected skill roots from resolveReadOnlyWorkspaceSkillMounts. After the plain rebase, that made the remote (SSH/OpenShell) layout lose its read-only skill protection, which the existing workspace-skills-bridge-readonly tests caught deterministically (write under .openclaw/sandbox-skills/skills no longer rejected). The mount target is now selected per backend:

  • Docker and Podman mount the generated skills workspace directly at <workdir>/.openclaw-skills (the fix for the root-owned nested target).
  • Remote backends keep the existing nested remote layout .openclaw/sandbox-skills/skills, matching sandbox-skills.ts's existing usesContainerMount split.

Coverage added: a workspace-mounts regression test asserting the remote layout survives for backendId: "ssh", and the remote bridge tests now run with the remote backend id.

Local verification on the rebased head: the nine affected test files pass (workspace-mounts, workspace-skills-bridge-readonly, validate-sandbox-security, sandbox-skills, workspace-paths, exec-workdir, commands-system-prompt, prepare, plus the two E2E files handed to CI), tsgo:core passes, and oxfmt/oxlint are clean on all changed files.

@clawsweeper

clawsweeper Bot commented Sep 7, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Follow-up for the three actionable findings and the merge-risk notes from the latest review (head e5f14dd), pushed as 7ccfba42a7a on top of a rebase onto current main:

[P1] Keep skill paths aligned with retained running containers — fixed. ensureSandboxContainer now reports the skills mount layout the ensured container actually has: a retained hot container is probed through its live mount list (docker/podman inspect), and prompt mapping (resolveSandboxSkillRuntimeInputs), skill usage paths, and the filesystem bridge follow that layout until the container's normal safe recreation installs the direct mount. Freshly created containers always use the direct layout. The hot-container retention policy itself is unchanged, per the review's "preserve the active layout" recommendation.

Real Docker transition evidence (retained pre-upgrade container with only the nested mount, fresh direct-mount container, both driven through the real CLI path):

probed layout of retained pre-upgrade container: "nested"
BEFORE fix — advertised /workspace/.openclaw-skills/skills/demo/SKILL.md — existsInRetainedContainer: false
AFTER fix  — advertised /workspace/.openclaw/sandbox-skills/skills/demo/SKILL.md — existsInRetainedContainer: true (content: "# demo skill")
fresh container — advertised /workspace/.openclaw-skills/skills/demo/SKILL.md — existsInFreshContainer: true

Covered by new regression tests in docker.skills-mount-layout.test.ts (retained nested/direct + fresh creation), sandbox-skills.test.ts (layout-driven prompt paths), and workspace-mounts.test.ts (nested mapping for retained Docker containers).

[P2] Document backend-specific generated-skill paths — fixed. The workspace-access skills note now states that Docker/Podman mount at <workdir>/.openclaw-skills/skills (with /workspace identified as the default workdir), that SSH/OpenShell keep the nested layout, and that a container created before an upgrade keeps its original layout until recreated.

[P3] Document the generated-skills bind reservation — fixed. The bind-security section now documents the <workdir>/.openclaw-skills reservation (direct, descendant, and covering binds rejected), advises relocating binds that an upgrade invalidates, and explains the existing dangerous override as an exceptional-case flag rather than the default remedy.

Merge-risk notes: the obsolete mount-version claim was removed from the PR body (the base already uses version 4). The custom-binds-covering-reservation risk is now covered by the P3 documentation.

Validation on the new head: tsgo:core clean; focused Vitest runs green across the affected sandbox, embedded-agent, agents-tools, auto-reply, and CLI shards (430+ tests, including the e2e agent-tools.before-tool-call suite); changed files pass oxfmt/oxlint.

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Follow-up for the remaining P1 — Preserve the nested layout for existing SDK callers — pushed as head ae529b8b (rebased onto latest main, 2 ahead / 0 behind):

Omitted-backend default restored to nested. resolveReadOnlyWorkspaceSkillMounts no longer selects the Docker direct layout when both backendId and skillsMountLayout are omitted — that is the context shape shipped with plugin-sdk v2026.9.3 and earlier, whose SandboxFsBridgeContext carries neither field. Unchanged remote SDK callers keep mapping their local materialized skill to the nested remote destination they upload to (.openclaw/sandbox-skills/skills), instead of a Docker-only direct destination that never exists on the remote side. Docker and Podman consumers (container creation, browser sandbox, the e2e bind-conflict script) already pass their backend id explicitly and keep the direct layout; the prompt-side mapping (resolveSandboxSkillRuntimeInputs) already required an explicit docker/podman backend for the direct layout, so prompt and file mapping now agree on the same default.

Old-shape remote read coverage. New regressions:

  • workspace-mounts.test.ts: omitted backendId + skillsMountLayout → nested layout (shipped SDK shape); explicit docker/podman → direct layout.
  • workspace-skills-bridge-readonly.test.ts: the real createRemoteShellSandboxFsBridge driven with the exact v2026.9.3 context shape resolves the local materialized skill to <remote-workspace>/.openclaw/sandbox-skills/skills/demo/SKILL.md and rejects writes through that path.

RED confirmed by reverting the resolver change on this head: both new regressions fail (2 failed / 33 passed). With the repair: all green.

Validation on head ae529b8b: validate.sh fully green (oxfmt, oxlint, same-directory Vitest, tsgo:core); focused Vitest runs green across the affected sandbox, embedded-agent, agents-tools, auto-reply, and CLI shards (640+ tests, 5 shards). PR body updated with the shipped-SDK compatibility evidence section.

Upgrading a recently used writable Docker or Podman sandbox retained the
container with its old nested skills mount, while prompts and file mapping
already advertised the new direct path. Shell commands and working
directories referencing that path failed until the container was recreated.

The container lifecycle now reports the skills mount layout the ensured
container actually has, probing the mount list of a retained hot container,
and prompt mapping, skill usage paths, and the filesystem bridge follow that
layout until the container's normal safe recreation installs the new one.
Freshly created containers always use the direct layout.

The mount resolver also preserves the nested layout for the context shape
shipped with plugin-sdk v2026.9.3 and earlier, whose SandboxFsBridgeContext
carries neither backendId nor skillsMountLayout: an omitted backendId no
longer selects the Docker direct mount, so unchanged remote SDK callers keep
mapping local materialized skills to the nested remote destination they
upload to. Docker and Podman consumers select the direct layout explicitly.

Also documents the backend-specific generated-skills paths and the reserved
bind destination, including relocation guidance for binds that an upgrade
can invalidate.

Refs openclaw#126631
@LiuwqGit

LiuwqGit commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing this PR: the root-owned mountpoint issue (#126631) was fixed on main via a different approach (#152641 and follow-ups #182412/#180840/#186247), which pre-creates the .openclaw/sandbox-skills/skills mountpoint as the workspace owner before container creation, keeping the nested layout. The sandbox mount code has since been restructured, so the direct-layout migration proposed here no longer applies.

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

Labels

agents Agent runtime and tooling clawtributor-review Clawtributor pull request awaiting prioritized maintainer review clawtributors PR from a clawtributor docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Sandbox skills bind-mount creates root-owned /workspace/.openclaw, locking out the sandbox user (uid 1000)

5 participants