-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat: Environment-level tool sandboxing for sub-agents (enforce tool_restrictions) #4042
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or requestlane-fleetv0.9.0 delivery lane (retired)v0.9.0 delivery lane (retired)reliabilityReliability, flaky behavior, retries, fallbacks, and robustnessReliability, flaky behavior, retries, fallbacks, and robustnesssandboxSandbox, container, or OS-level isolation behaviorSandbox, container, or OS-level isolation behaviorsecuritySecurity, isolation, permissions, or trust-boundary workSecurity, isolation, permissions, or trust-boundary worksubagentsSub-agent orchestration, lifecycle, and completion handlingSub-agent orchestration, lifecycle, and completion handlingtoolsTool execution, tool schemas, tool UX, and built-in tool behaviorTool execution, tool schemas, tool UX, and built-in tool behaviorv0.9.0Targeting v0.9.0Targeting v0.9.0
Milestone
Description
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or requestlane-fleetv0.9.0 delivery lane (retired)v0.9.0 delivery lane (retired)reliabilityReliability, flaky behavior, retries, fallbacks, and robustnessReliability, flaky behavior, retries, fallbacks, and robustnesssandboxSandbox, container, or OS-level isolation behaviorSandbox, container, or OS-level isolation behaviorsecuritySecurity, isolation, permissions, or trust-boundary workSecurity, isolation, permissions, or trust-boundary worksubagentsSub-agent orchestration, lifecycle, and completion handlingSub-agent orchestration, lifecycle, and completion handlingtoolsTool execution, tool schemas, tool UX, and built-in tool behaviorTool execution, tool schemas, tool UX, and built-in tool behaviorv0.9.0Targeting v0.9.0Targeting v0.9.0
Projects
StatusShow more project fields
Done
Context
This issue tracks the runtime enforcement of tool restrictions across CodeWhale's different execution contexts — sessions, sub-agents, Fleet workers, and MCP servers.
What We've Confirmed (Without Checking the Code Directly)
--disallowed-toolsexists and works — It was implemented in PR v0.8.58: Headless exec hardening — --allowed-tools/--disallowed-tools, --max-turns, --append-system-prompt, stream-json input #3027. The flag is wired into the gate chain and filters the advertised tool catalog before the model sees it. Deny wins over allow. This is structural enforcement: the LLM never even sees the restricted tools.--disallowed-toolsflows down to child agents automatically.codewhale execprocesses and do not inherit flags from the parent session. However,FleetExecConfighas a dedicateddisallowed_toolsfield, meaning tool restrictions can be configured per Fleet worker — just not via inheritance from the parent CLI flag.--disallowed-tools) interact with runtime-expanded capabilities.The Problem
The constitutional crisis (#4032) arises because the "no temp scripts" rule currently lives in the
SKILL.mdprompt, which the LLM can rationalize its way around.--disallowed-toolsprovides a structural solution for session-wide and sub-agent contexts, but the scope inconsistencies (especially with Fleet workers and MCP servers) leave gaps.What This Issue Covers
Rather than building a new mechanism from scratch, this issue focuses on:
--disallowed-toolsapplies (session, sub-agent, Fleet) and where it doesn't.--disallowed-toolsflagFleetExecConfig.disallowed_tools(explicit per-task)python -cviaexecute) bypass the restriction.Dependencies
tool_restrictionswould be a natural extensionOut of Scope for This Issue
SKILL.mdparsing (the constraint is moving from prompts to structural enforcement)Acceptance Criteria
--disallowed-tools write_file,execute_python— the LLM cannot write temp scripts viawrite_fileorexecutewithpython -c.disallowed_tools = ["write_file", "execute_python"]— the worker cannot write temp scripts.What This Issue Is Not
This is not "we need to build
tool_restrictionsfrom scratch." The mechanism (--disallowed-tools+ gate chain) already exists. This issue is about:Happy to help test once there's a build available. 🐋