sandbox explain: show effective mounts#63003
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 63c18b757a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| SandboxContext, | ||
| "workspaceDir" | "agentWorkspaceDir" | "workspaceAccess" | "containerWorkdir" | "docker" | ||
| > as unknown as SandboxContext; | ||
| const mounts = buildSandboxFsMounts(sandboxLikeContext); |
There was a problem hiding this comment.
Omit mounts when runtime is direct
This computes and emits sandbox.mounts before checking whether the selected session is actually sandboxed, so openclaw sandbox explain can report read-only mount boundaries even when sessionIsSandboxed is false (for example mode=off or mode=non-main on the main session). In those cases there is no sandbox mount enforcement at all, and the JSON/text output becomes misleading for users or automation that relies on this command to understand current file access constraints.
Useful? React with 👍 / 👎.
| const scopeKey = resolveSandboxScopeKey(sandboxCfg.scope, sessionKey); | ||
| const sandboxWorkspaceDir = | ||
| sandboxCfg.scope === "shared" | ||
| ? sandboxCfg.workspaceRoot |
There was a problem hiding this comment.
Normalize shared workspace root before building mounts
In shared scope this uses sandboxCfg.workspaceRoot directly, but runtime sandbox setup resolves the same field via resolveUserPath first. If a user configures a home-relative or relative path (for example ~/sandboxes), this command will build hostRoot from the unexpanded value and report a different mount path than the one actually used at runtime, which defeats the purpose of showing the effective mounts.
Useful? React with 👍 / 👎.
Greptile SummaryAdds effective-mounts introspection to Confidence Score: 5/5Safe to merge; the change is additive and all remaining findings are P2. No logic errors or regressions introduced. The new code correctly reuses buildSandboxFsMounts and passes the right context fields. Both JSON and text paths work as expected. Remaining comments are style suggestions (line length, missing text-output test). No files require special attention.
|
|
Addressed review notes:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d61a50efdc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Follow-up: addressed the agent-workspace override note.
|
697ecf0 to
21ff1e3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21ff1e33f4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const mounts = (() => { | ||
| if (!sessionIsSandboxed) { | ||
| return []; | ||
| } | ||
|
|
There was a problem hiding this comment.
Handle global session main alias before deriving mounts
This new mount derivation path can report sandbox mounts for --session global when session.scope=global and sandbox.mode=non-main, because it trusts sessionIsSandboxed from the local compare against resolveAgentMainSessionKey instead of the runtime canonicalization used by resolveSandboxRuntimeStatus (which treats global as the main/direct session). In that configuration, openclaw sandbox explain now prints non-empty sandbox.mounts even though runtime sandboxing is not active, so users and automation get an incorrect boundary report.
Useful? React with 👍 / 👎.
f53f67f to
82c13cc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82c13cce68
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| containerWorkdir: sandboxCfg.docker.workdir, | ||
| docker: sandboxCfg.docker, |
There was a problem hiding this comment.
Derive mounts from active sandbox backend
sandbox explain now always builds mounts with buildSandboxFsMounts using sandboxCfg.docker.workdir, which only matches Docker semantics. For sandbox.backend=ssh, runtime paths come from the SSH backend (remoteWorkspaceDir/remoteAgentWorkspaceDir), so this prints container roots that are never used by the actual sandbox and misreports effective file boundaries for users/automation relying on this command.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad0542b417
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ? false | ||
| : sessionKey.trim() !== mainSessionKey.trim(); |
There was a problem hiding this comment.
Canonicalize main-session aliases before sandboxing check
The non-main check compares raw strings (sessionKey.trim() !== mainSessionKey.trim()), so aliases like --session main (when session.mainKey is customized) are treated as non-main even though runtime canonicalization resolves them to the main session. Since this commit now uses sessionIsSandboxed to decide whether to emit mounts, openclaw sandbox explain can report sandbox mounts for sessions that actually run direct, which is misleading for users and scripts that trust this boundary report.
Useful? React with 👍 / 👎.
| containerWorkdir: sandboxCfg.docker.workdir, | ||
| docker: sandboxCfg.docker, |
There was a problem hiding this comment.
Derive effective mounts from the selected sandbox backend
Mount generation hardcodes Docker fields (sandboxCfg.docker.workdir and docker bind semantics), but runtime mount roots differ by backend. In sandbox.backend=ssh, the effective container roots come from ssh runtime paths (for example remote workspace directories), so this output can show host/container roots that are never used by the actual sandbox and misstate real file-access boundaries.
Useful? React with 👍 / 👎.
|
Codex automated review: keeping this open. Current main still lacks the requested Best possible solution: Keep this PR open as the active implementation candidate. Revise it to compute sandboxed status through What I checked:
Remaining risk / open question:
Codex Review notes: model gpt-5.5, reasoning high; reviewed against f0b327cf686e. |
Fixes #62988
Purpose
Make
openclaw sandbox explainimmediately show the sandbox file-system exposure (effective mounts), so users can reason about permission boundaries at a glance.Changes
sandbox.mounts: Array<{ source, hostRoot, containerRoot, writable }>Effective mounts:section afterEffective sandbox:Test plan
pnpm -s test src/commands/sandbox-explain.test.tsLocal output (manual spot-check)
Made with Cursor