Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(code): setting a folder workspace no longer "escapes the allowed workspace"

purpleef78683d4c8a
diff --git a/src/api/mcp/builtin-tools.ts b/src/api/mcp/builtin-tools.ts
index 2cc42a34..92e275d1 100644
--- a/src/api/mcp/builtin-tools.ts
+++ b/src/api/mcp/builtin-tools.ts
@@ -717,6 +717,14 @@ async function executeFileList(args: Record<string, any>): Promise<string> {
recursive: args.recursive || false,
pattern: args.pattern || null,
...chatCtx(),
+ // The file-tree browser (FileTree.tsx) points the picker at an arbitrary
+ // folder and lists it as its OWN root. Pass that through so the Rust
+ // containment jail uses the picked folder instead of the per-chat sandbox
+ // — otherwise selecting any folder outside ~/agent-workspace fails with
+ // "path escapes the allowed workspace". Overrides chatCtx()'s stale value.
+ ...(typeof args.workingDirectory === 'string' && args.workingDirectory.trim()
+ ? { workingDirectory: args.workingDirectory }
+ : {}),
})
if (Array.isArray(data.entries)) {
return data.entries
diff --git a/src/components/chat/FileTree.tsx b/src/components/chat/FileTree.tsx
index dbf4c760..4dc2c03c 100644
--- a/src/components/chat/FileTree.tsx
+++ b/src/components/chat/FileTree.tsx
@@ -19,7 +19,11 @@ export function FileTree() {
setLoading(true)
setError(null)
try {
- const result = await toolRegistry.execute('file_list', { path: dir })
+ // List the picked folder as its OWN workspace root so the Rust
+ // containment jail accepts it. Without workingDirectory the list is
+ // checked against the stale per-chat sandbox and every folder outside
+ // ~/agent-workspace fails with "path escapes the allowed workspace".
+ const result = await toolRegistry.execute('file_list', { path: dir, workingDirectory: dir })
const lines = result.split('\n').filter(Boolean)
const nodes: FileTreeNode[] = lines.map(line => {
const isDir = line.startsWith('[DIR]')