Skip to content

fix(agents): give plugin harnesses the sandbox's materialized skill paths - #4

Merged
tomorrowflow merged 1 commit into
mainfrom
fix/sandbox-harness-skill-paths
Sep 11, 2026
Merged

tomorrowflow merged 1 commit into
mainfrom
fix/sandbox-harness-skill-paths

Conversation

@tomorrowflow

Copy link
Copy Markdown
Owner

Follow-up to #3 (merged). Found while verifying the restructured daily cron jobs.

Problem

A sandboxed cron run for a Codex-backed agent (Codex app-server harness) began by trying to read /usr/lib/node_modules/openclaw/skills/obsidian/SKILL.md, got "Path escapes sandbox root", and the run was marked errored, even though that skill was materialized inside the sandbox at /workspace/.openclaw/sandbox-skills/skills/obsidian. A throwaway sandboxed turn asked to echo its <location> lines confirmed the prompt listed host paths for every bundled, managed, and plugin skill:

/usr/lib/node_modules/openclaw/skills/blogwatcher/SKILL.md
~/.openclaw/plugin-skills/browser-automation/SKILL.md
~/.agents/skills/find-skills/SKILL.md
...

Cause: run-attempt-dispatch.ts hands plugin harnesses the session's host-resolved skills snapshot and remapped only swarm library selections into sandbox paths. The Codex plugin renders skillsSnapshot.prompt verbatim. The embedded runner already rebuilds its prompt from the materialized skills workspace in prepareEmbeddedSkills; the plugin-harness path did not, so every sandboxed Codex run advertised skills the model could not read.

Solution

resolveSandboxHarnessSkillsSnapshot (sandbox-skills.ts) runs the existing resolveSandboxSkillRuntimeInputs; when that yields no snapshot (a host snapshot in a sandbox), it loads workspace-only skill entries from the materialized skills workspace, remaps them to the container path, and builds a fresh snapshot preserving skillFilter, skillOverrides, and version. Library selections and explicitly empty snapshots behave as before. Dispatch uses it for every enabled plugin sandbox without remote resource mounts; the remote-mount path is unchanged.

Impact

Sandboxed plugin-harness runs see and can read the same skill catalog the embedded runner shows, at the paths the docs describe (/workspace/.openclaw/sandbox-skills/skills). No change for non-sandboxed runs, remote resource mounts, or swarm library selections.

Evidence

  • sandbox-skills.harness-snapshot.test.ts: helper rebuilds a host snapshot into container paths and remaps usage paths; an explicitly empty snapshot stays empty.
  • run-attempt-dispatch.owner.test.ts: new materialized-skills variant asserting the dispatched snapshot carries /workspace/.openclaw/sandbox-skills/skills/demo/SKILL.md and no host path. Fails on the original dispatch code, passes after.
  • pnpm tsgo:core clean, oxfmt --check and oxlint clean on changed files, git diff --check clean. Sandbox-skills and dispatch-owner suites: 14 tests passed.

Proof gap: no live sandboxed run on the fixed build yet. Verify after deploy by repeating the throwaway probe (openclaw agent --agent <sandboxed-agent> --session-key <diag-key> --message "copy every <location> line from your skills section") and checking the paths start with /workspace/.openclaw/sandbox-skills/.

🤖 Generated with Claude Code

…aths

Plugin harnesses (Codex app-server) render the skills catalog from the
snapshot dispatch hands them. For a sandboxed run dispatch kept the session's
host-resolved snapshot and remapped only swarm library selections, so the
model saw locations such as /usr/lib/node_modules/openclaw/skills/*/SKILL.md
and ~/.openclaw/plugin-skills/*/SKILL.md that "escape sandbox root" when read,
although the same skills were already materialized inside the sandbox at
/workspace/.openclaw/sandbox-skills/skills. The embedded runner already
rebuilds its prompt from that workspace; the plugin-harness path did not.

resolveSandboxHarnessSkillsSnapshot rebuilds the snapshot from the
materialized skills workspace with container paths (keeping library
selections and explicitly empty snapshots as they are), and dispatch uses it
for every enabled plugin sandbox without remote resource mounts.

Observed on a sandboxed cron run whose first tool call read a host skill path
and failed, marking the run as errored.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant