Repository navigation
Run agent.run_command under its calling run's posture - #2081
Merged
Merged
Conversation
An agent that reached agent.run_command through its MCP tool fabric got a sandbox of its own, narrowed only by the deployment ceiling. A run whose own network was off could ask the tool for "network": true and get the host network, and every command it ran was uncapped. The run's MCP endpoint now stamps the run's id, autonomy tier and permissions onto every tool call (AgentRunPosture), server-side and never from the model's arguments. NodeAgentTool carries it onto the node context, the node into its RunCommandRequest, and RunCommandService.BuildSpec narrows the spec to it, narrow-only: the network stays only when the command asked, the deployment ceiling allows it and the run has it; an allowlisted run's command reaches only the operator-named extra hosts, and is severed when there are none; memory and cpu ceilings follow the run's tier clamped by the deployment ceiling and narrowed by the host memory budget. A workflow node's command has no calling run and keeps exactly the posture it had. Those ceilings sit on a cgroup leaf of the command's own, beside the agent's, so they bound the command and not the run. The run token lets an agent open as many endpoint connections as it likes, so commands it started at once would each hold a full tier row. A run's commands now queue (CallerCommandLanes), so the ones it has running never hold more than one row between them; the agent and its one running command can together still hold two, and the docs now say so. When the run's posture takes or narrows the network a command asked for, the result carries networkNarrowed saying which, so the agent and the approver are not left reading a connection error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent.run_commandgot a sandbox narrowed only by the deployment ceiling. A network-off run could ask for"network": trueand get the host network, and its commands were uncapped.AgentRunPosture(run id, tier, permissions) onto every tool call, server-side.RunCommandService.BuildSpecnarrows the command to it, narrow-only. The network stays only if the command asked, the deployment ceiling allows it, and the run has it. An allowlisted run's command reaches only the operator's extra hosts, and is severed when there are none. Ceilings are the run's tier row.CallerCommandLanes): one runs at a time per run, so they never hold more than one tier row between them.SandboxSpecandRunCommandServicedocs say so.networkNarrowed, for exampleoff: the calling run (Standard) has no network — severed only where the sandbox confines. The agent and the approver can then see why the command could not connect.run_commandcalls now wait their turnTest plan
networkNarrowedrowsnetworkNarrowed; two connections of one run never run commands at once while two runs do; a workflow node keeps its network through the real engineMaxMemoryMb = 0fails the cgroup cap test