Repository navigation
Conversation
When sandbox is enabled, build skills prompt from sandbox workspace entries (not cached snapshot) so Read uses paths under the sandbox root. Updates prompt resolution order and adjusts tests.\n\nRefs: openclaw#6346
| it("prefers entries when provided (even if snapshot exists)", () => { | ||
| const entry: SkillEntry = { | ||
| skill: { | ||
| name: "demo-skill", |
There was a problem hiding this comment.
[P1] This test uses SkillEntry without importing the type, so it will fail TypeScript compilation under typical TS/Vitest settings.
| it("prefers entries when provided (even if snapshot exists)", () => { | |
| const entry: SkillEntry = { | |
| skill: { | |
| name: "demo-skill", | |
| import type { SkillEntry } from "./skills/types.js"; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/skills.resolveskillspromptforrun.test.ts
Line: 29:32
Comment:
[P1] This test uses `SkillEntry` without importing the type, so it will fail TypeScript compilation under typical TS/Vitest settings.
```suggestion
import type { SkillEntry } from "./skills/types.js";
```
How can I resolve this? If you propose a fix, please make it concise.| const shouldLoadSkillEntries = | ||
| sandbox?.enabled === true || !params.skillsSnapshot || !params.skillsSnapshot.resolvedSkills; | ||
| const skillEntries = shouldLoadSkillEntries | ||
| ? loadWorkspaceSkillEntries(effectiveWorkspace) | ||
| : []; | ||
| restoreSkillEnv = params.skillsSnapshot | ||
| ? applySkillEnvOverridesFromSnapshot({ | ||
| snapshot: params.skillsSnapshot, | ||
| restoreSkillEnv = shouldLoadSkillEntries | ||
| ? applySkillEnvOverrides({ | ||
| skills: skillEntries ?? [], | ||
| config: params.config, | ||
| }) | ||
| : applySkillEnvOverrides({ | ||
| skills: skillEntries ?? [], | ||
| : applySkillEnvOverridesFromSnapshot({ | ||
| snapshot: params.skillsSnapshot, | ||
| config: params.config, | ||
| }); | ||
|
|
||
| const skillsPrompt = resolveSkillsPromptForRun({ | ||
| skillsSnapshot: params.skillsSnapshot, | ||
| skillsSnapshot: sandbox?.enabled ? undefined : params.skillsSnapshot, | ||
| entries: shouldLoadSkillEntries ? skillEntries : undefined, | ||
| config: params.config, | ||
| // Note: tools enforce sandbox paths against the host-side sandbox workspace root, | ||
| // so skill <location> should stay within that host path (not the container mount path). | ||
| workspaceDir: effectiveWorkspace, | ||
| }); |
There was a problem hiding this comment.
[P1] When sandbox.enabled is true, effectiveWorkspace can be sandbox.workspaceDir (the host-side sandbox root), but this change loads skills from loadWorkspaceSkillEntries(effectiveWorkspace). If sandbox.workspaceDir is not the project workspace, this will look in the sandbox root’s skills/ directory rather than the user’s intended workspace, and may silently drop workspace skills.
If the intent is “build prompt from entries using host-side paths” but still resolve skills from the original workspace, consider loading entries from resolvedWorkspace (or whichever path actually contains the workspace skills) and only using effectiveWorkspace when building <location> paths.
Also appears in src/agents/pi-embedded-runner/compact.ts around the same logic.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-runner/run/attempt.ts
Line: 167:189
Comment:
[P1] When `sandbox.enabled` is true, `effectiveWorkspace` can be `sandbox.workspaceDir` (the host-side sandbox root), but this change loads skills from `loadWorkspaceSkillEntries(effectiveWorkspace)`. If `sandbox.workspaceDir` is *not* the project workspace, this will look in the sandbox root’s `skills/` directory rather than the user’s intended workspace, and may silently drop workspace skills.
If the intent is “build prompt from entries using host-side paths” but still resolve skills from the *original* workspace, consider loading entries from `resolvedWorkspace` (or whichever path actually contains the workspace skills) and only using `effectiveWorkspace` when building `<location>` paths.
Also appears in `src/agents/pi-embedded-runner/compact.ts` around the same logic.
How can I resolve this? If you propose a fix, please make it concise.|
Thanks for the review!
|
sunnoy
left a comment
There was a problem hiding this comment.
Greptile review follow-up:
1. SkillEntry import (P1) - Already fixed in commit 6f91855.
2. Sandbox effectiveWorkspace loading skills from wrong dir (P1) - This is a false positive. When sandbox.enabled is true and workspaceAccess !== "rw", resolveSandboxContext() explicitly calls syncSkillsToWorkspace() (see src/agents/sandbox/context.ts lines 53-59) to copy skills from the agent workspace to sandbox.workspaceDir before returning. So loadWorkspaceSkillEntries(effectiveWorkspace) correctly finds the synced skills. The comments in both attempt.ts and compact.ts already document why effectiveWorkspace is used for <location> paths (tool path enforcement against the host-side sandbox root).
bfc1ccb to
f92900f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
Greptile SummaryThis PR fixes issue #6346 by ensuring skill
The change ensures that the Confidence Score: 4/5
Last reviewed commit: 2c91f47 |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
|
Thanks for fixing the sandbox I found a regression: in sandbox mode, the new code path rebuilds prompt/env from runtime entries and drops Two related findings:
Suggested fix: In sandbox mode, filter A regression test covering sandbox + restrictive |
|
Closing as stale. Please reopen with an updated branch if you still want to pursue this work. |
Fixes #6346.
When sandbox is enabled, build the skills prompt from sandbox workspace entries (not cached snapshot) so skill paths stay under the host-side sandbox root and Read no longer fails with 'Path escapes sandbox root'.
Commit: 05ca190
Greptile Overview
Greptile Summary
This PR changes how the embedded runner builds the skills prompt and applies skill env overrides when sandboxing is enabled. Instead of preferring a cached skills snapshot, it forces a fresh load of workspace skill entries and prefers entries over snapshot prompts so that generated skill
<location>paths remain under the host-side sandbox workspace root (avoidingReadfailures like “Path escapes sandbox root”).The behavior change is implemented in both the run attempt path and the compaction path, and
resolveSkillsPromptForRunis updated to preferentriesover a snapshot prompt with a corresponding unit test update.Confidence Score: 3/5
SkillEntry) which can fail compilation.(2/5) Greptile learns from your feedback when you react with thumbs up/down!
Context used:
dashboard- CLAUDE.md (source)dashboard- AGENTS.md (source)