Repository navigation
fix(agents): give plugin harnesses the sandbox's materialized skill paths - #4
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:Cause:
run-attempt-dispatch.tshands plugin harnesses the session's host-resolved skills snapshot and remapped only swarm library selections into sandbox paths. The Codex plugin rendersskillsSnapshot.promptverbatim. The embedded runner already rebuilds its prompt from the materialized skills workspace inprepareEmbeddedSkills; 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 existingresolveSandboxSkillRuntimeInputs; 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 preservingskillFilter,skillOverrides, andversion. 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.mdand no host path. Fails on the original dispatch code, passes after.pnpm tsgo:coreclean,oxfmt --checkandoxlintclean on changed files,git diff --checkclean. 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