Skip to content

Commit cb9d59a

Browse files
fix(cli): show effective workspace root in sandbox explain when rw
1 parent d17b970 commit cb9d59a

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/commands/sandbox-explain.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "@openclaw/normalization-core/string-coerce";
1111
import { formatDocsLink } from "../../packages/terminal-core/src/links.js";
1212
import { colorize, isRich, theme } from "../../packages/terminal-core/src/theme.js";
13-
import { resolveAgentConfig } from "../agents/agent-scope.js";
13+
import { resolveAgentConfig, resolveAgentWorkspaceDir } from "../agents/agent-scope.js";
1414
import { resolveSandboxConfigForAgent } from "../agents/sandbox.js";
1515
import { resolveSandboxToolPolicyForAgent } from "../agents/sandbox/tool-policy.js";
1616
import { normalizeAnyChannelId } from "../channels/registry.js";
@@ -196,6 +196,11 @@ export async function sandboxExplainCommand(
196196
const elevatedAgentEnabled = elevatedAgent?.enabled !== false;
197197
const elevatedEnabled = elevatedGlobalEnabled && elevatedAgentEnabled;
198198

199+
const effectiveWorkspaceRoot =
200+
sandboxCfg.workspaceAccess === "rw"
201+
? resolveAgentWorkspaceDir(cfg, resolvedAgentId)
202+
: sandboxCfg.workspaceRoot;
203+
199204
const globalAllow = channel ? elevatedGlobal?.allowFrom?.[channel] : undefined;
200205
const agentAllow = channel ? elevatedAgent?.allowFrom?.[channel] : undefined;
201206

@@ -265,6 +270,7 @@ export async function sandboxExplainCommand(
265270
scope: sandboxCfg.scope,
266271
workspaceAccess: sandboxCfg.workspaceAccess,
267272
workspaceRoot: sandboxCfg.workspaceRoot,
273+
effectiveWorkspaceRoot,
268274
sessionIsSandboxed,
269275
tools: {
270276
allow: toolPolicy.allow,
@@ -316,7 +322,9 @@ export async function sandboxExplainCommand(
316322
lines.push(
317323
` ${key("workspaceAccess:")} ${value(
318324
payload.sandbox.workspaceAccess,
319-
)} ${key("workspaceRoot:")} ${value(payload.sandbox.workspaceRoot)}`,
325+
)} ${key("workspaceRoot:")} ${value(
326+
payload.sandbox.workspaceRoot,
327+
)} ${key("effectiveWorkspaceRoot:")} ${value(payload.sandbox.effectiveWorkspaceRoot)}`,
320328
);
321329
lines.push("");
322330
lines.push(heading("Sandbox tool policy:"));

0 commit comments

Comments
 (0)