Repository navigation
fix(gateway): preview sandbox skill files mounted from outside the session root - #7
Merged
Merged
Conversation
…ssion root A sandboxed agent links materialized skills by container path, e.g. /workspace/.openclaw/sandbox-skills/skills/<skill>/SKILL.md. The mount table translates that to ~/.openclaw/sandbox/skills-workspaces/<scope>/..., but that source is outside the session root; the workspace only holds the empty mountpoint. Root containment rejected the file and the Control UI answered "session file not found" for a link it had just rendered. When the root lookup misses, sessions.files.get now opens the backing mount's own host root through the same fs-safe reader, for mounts sourced from the Gateway-owned sandbox state dir only. Custom binds are excluded: their sources are daemon-host paths and a same-named Gateway-local path could be a different file. The entry has no hash or workspacePath, so the UI shows it read-only; sessions.files.set is unchanged. The positive case fails on the previous source; the custom-bind guard fails when the state-dir gate is removed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…reviews With no registered container, as after every deploy recreates sandboxes, sessions.files derived the mount table without the materialized skills workspace. The skills mount then fell back to the empty scaffold inside the workspace, so skill links still answered "session file not found" on the live Gateway after the previous fix. Resolve the sandbox layout once and pass its scope key to the registry lookup and its skillsWorkspaceDir to the derived mapping, matching what the runtime mounts. The regression test now runs without a registered container and fails on the previous source. Co-Authored-By: Claude Opus 5.5 (1M context) <[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.
Problem
Chat from a sandboxed agent links skill files by their container path, for example
/workspace/.openclaw/sandbox-skills/skills/kleinanzeigen-publish-onedrive/SKILL.md. The Control UI shows the link, but clicking it gives "session file not found".The fix from e0e95c9 translates container paths through the sandbox mount table. It only helped when the mount source sits inside the session root. Materialized skills live in
~/.openclaw/sandbox/skills-workspaces/workspace-<hash>/. The workspace only has an empty folder where they are mounted, so the root check rejected the translated path.A second gap showed up after the first deploy. When no sandbox container is registered, the Gateway derives the mount table from config, and that happens after every deploy recreates the sandboxes. The derived table was built without
skillsWorkspaceDir, so the skills mount pointed at the empty folder in the workspace.Solution
getSessionWorkspaceFilegets a fallback for when the session-root lookup misses. It resolves the container path to its mount (resolveSandboxContainerPathMount), opens that mount's host root with the same fs-safe reader, and returns a read-only entry (nohash, noworkspacePath).SANDBOX_STATE_DIR. Customdocker.bindsare excluded because their sources are daemon-host paths, so a Gateway-local path with the same name could be a different file. Secret mounts are not in the mount table.resolveSessionSandboxPathsresolves the sandbox layout once. It passes the layout's scope key to the registry lookup and itsskillsWorkspaceDirtoderiveSandboxContainerMounts.sessions.files.setis unchanged, so writes still stay inside the session root.Evidence
openclaw gateway call sessions.files.getreturned "session file not found" for the SKILL.md path, while/workspace/AGENTS.mdopened.3aba99b: SKILL.md returns 11,562 bytes of text with no hash./workspace/AGENTS.mdstill opens./run/secrets/GH_TOKENand/mediaare still refused.sessions-files.sandbox-paths.test.ts, the new skills test runs with no registered container. It fails on the previous source and passes now. The new custom-bind guard fails when the state-dir gate is removed. All 93 tests in the 5 session-files suites pass.--maxWorkers=1, mostly startup; each new case runs in under 15 ms.pnpm tsgo:coreis clean.check-fork-features: 71 present.check-changedfails on the config-docs baseline drift.🤖 Generated with Claude Code