OpenClaw's sandbox mode is critical infrastructure for safely running AI agents in constrained environments. It controls which tools an agent can access — preventing sandboxed agents from executing arbitrary commands, sending messages, or accessing the browser without explicit permission.
This PR fixes a bug where two important sandbox config options were silently ignored:
alsoAllow — for adding tools to the sandbox allowlist
Operators configuring tools.sandbox.tools.alsoAllow: ["message", "tts"] expected their sandboxed agents to use those tools. But the sandbox resolver only read allow and deny — completely ignoring alsoAllow. Agents were more restricted than configured.
The fix introduces a unified effective sandbox policy resolver that all sandbox-related code paths now share:
openclaw sandbox explain outputThis ensures the sandbox behaves consistently everywhere — what you configure is what you get.
alsoAllow works: Tools listed in alsoAllow are now additive to the sandbox allowlist.browser) now removes it from the deny list.openclaw sandbox explain now reports the same effective policy used at runtime.allow: [] semantics preserved: Empty allow array plus alsoAllow still means allow-all (not an empty allowlist).# Before: alsoAllow was silently ignored
agents:
defaults:
sandbox:
mode: all
list:
- id: my-agent
tools:
sandbox:
tools:
alsoAllow: ["message", "tts"] # Didn't work!
# After: alsoAllow works as documented
# Same config now correctly grants message + tts access
The PR includes comprehensive test coverage to prevent future regressions:
src/agents/tool-policy-sandbox.test.ts — unit tests for policy resolutionsrc/agents/pi-tools.sandbox-policy.test.ts — integration testssrc/commands/sandbox-explain.test.ts — CLI output tests