Repository navigation
feat(multi): computers as child envs of a multi env (FD-4935) - #539
Merged
Merged
Conversation
A multi env holds computer_envs beside its MCP servers and websites. Each computer deploys on a sandbox of its own, as it would alone, with its child_envs entry; the gateway fronts it by its name on the one /mcp, its tools served under its name and "_". In VM mode the services start without the gateway while the computers deploy, then the gateway starts and waits for each. The multi env's record holds each computer's own, so reattach, close and teardown reach it; a computer that fails fails the deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is no route of the gateway's A later deploy of a multi env deploys fresh computers, so its failure closes only them and leaves the earlier deployment's running; its success keeps the earlier ones for close(). A computer may not be named mcp-<server>, the gateway's route to that MCP server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the fix It says to set child_envs.<name>.sandbox_type to a sandbox type whose URLs take no credentials, which the hub's default (beta_scale) doesn't. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…corded in a typed field The computers' rules and lifecycle move from multi_env.py into _multi_computers.py: a Computers holder whose begin, rollback and commit keep a deploy's computers its own, as deploy_through_provider keeps its provider and sandbox. Each computer's record moves from metadata["computers"] into DeployedGatewayEnv.child_envs, a field the record round-trips. The test fake binds its calls to ComputerEnv's signatures, and a test keeps every compose service independent of the gateway, which a VM deploy with children starts last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…redeploy, a mid-deploy failure and refused entries Two computers keep serving through the gateway while one is killed and started again and while the gateway restarts; a redeploy whose gateway fails leaves the earlier deployment serving, and close() ends it all. A computer that fails mid-deploy, and a child_envs entry the multi env refuses, leave nothing up. One deployment carries the restarts and the redeploy, to keep the tier's time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… computer tests' Regenerated with .github/scripts/slow_test_durations.py from main's last green Local backends run (b1ee404), plus multi_env_computers_test.py's 395 s from this branch's run. The table had the slow tier at 107 min of tests against 134 measured, which left shards from 9.5 to 17.4 min; it now predicts 11.0 to 12.1 min on the same 12 shards, whose floor is chromium_app_test.py's 12 min. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
PR 3 of the four in the FD-4930 + FD-4935 design note: a multi env holds computers.
computer_envs = ["desktop"]sits besidemcp_server_envsandwebsite_envs, any number of them. Each computer deploys on a sandbox of its own, as it would alone, with itschild_envsentry (PR 1). The gateway fronts it by its name on the one/mcp, its tools served asdesktop_computer_screenshot(PR 2). Routing the multi env's websites into the computer, andload_artifact,snapshot_envandreset_envthrough the multi env, are PR 4.Deploy order (decision 5, as refined on Nov 8): in VM mode the VM comes up first. Its services start without the gateway while every computer deploys: created, its driver answering, its
toolsfield applied. Then the gateway starts with each computer inINTERNAL_MCP_SERVERSandREST_PROXY_URLS, and waits for each to answer, as it does for its MCP servers. The gateway itself is unchanged. In container mode the computers start beside the server containers, and the gateway, created last, has no address to give them.agent-env
MultiEnv.computer_envs, inenv.toml,to_dictandto_toml, the bundle plan's checks andagent-env env multi put --computer. A computer's name must make a tool prefix (at most 15 characters) and be no other child env's, refused at save.child_envsentry is checked by the computer's owndeploy_refusal, on the entry'ssandbox_typeor else the multi env's. A computer with no entry is checked the same way.env_params.site_routingandsitesare refused for now, since PR 4 routes the multi env's websites. A sandbox provider whose URLs take credentials (REQUEST_HEADERS) is refused too: the gateway doesn't send them to a child env.deploy()takeschildren, a callback that starts the env's children on sandboxes of their own given the gateway's address, and returns each as anExternalChild. A provider whosedeploy()takes nochildrenis refused for a multi env with computers.networklists the hosts allowed (reach).DeployedGatewayEnv.child_envsfield, and its sandbox insandbox_ids, under the backend that made it. Sofrom_deployed_envreattaches it,close()closes it first, and teardown reaches it by id.envs/_multi_computers.py. ItsComputersholder keeps a deploy's computers its own, asdeploy_through_providerkeeps its provider and sandbox: a redeploy deploys fresh ones, its failure closes only those, and its success keeps the earlier ones forclose().Two choices to look at
save_refusal). Whether a sandbox provider runs a computer natively is checked at the deploy_env step's preflight and at deploy, with the step's sandbox fields.beta_scale, so on the hub each computer'schild_envsentry sets asandbox_typewhose URLs take none, which the refusal says. Sending a child its provider's headers, after a design note on holding that token in the gateway, is FD-5334.Test plan
test_multi_env_computers.py: the field, names,child_envs, deploy order and options, the record, a failure, a retry, close, reattach, the CLI.reachintest_computer_env.py, and the bundle plan's checks incomputer_env_folder_test.py.egress_hosts_test,test_disk_recipeand the sail_vm routing test.tst/integration/computer/multi_env_computers_test.py(slow tier): the desktop example's computer and the items MCP server in one multi env, deployed by a deploy_env step with achild_envsentry./mcp, the server's tools anddesktop_computer_*are listed, with no unprefixedcomputer_*. A screenshot answers by its prefixed name.desktop_computer_screenshotsees only it./svc/desktop/serves the computer's card.close()ends it all.child_envsentry the multi env refuses (site routing, an unknown key, a provider whose URLs take credentials) is refused at preflight and makes no sandbox.tst/integration/slow_durations.jsonis refreshed with.github/scripts/slow_test_durations.pyfrom main's last green run plus that file, since the table had the tier at 107 min against 134 measured. Its slowest shard went from 16.1 min on main to 14.4 min here, on the same 12 shards; a 13th wouldn't help, sincechromium_app_test.py's 12 min is the floor.child_envsand tool-prefix integration tests it builds on passed. The unit tier on Linux passed but for the 5 tests that fail on a VM from an archive, as before.desktop, andlaptopwithtools = "standard"): 31 tools, both screenshots answer.toolscan't be applied mid-deploy: the deploy fails and leaves no container.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues were found.Summary
Adds computers as children of
MultiEnv, each on its own sandbox and served through the shared gateway.Diagram
sequenceDiagram participant Multi as MultiEnv participant Provider as Gateway provider participant Computers as Child computers participant Gateway as Gateway Multi->>Provider: Deploy with children callback Provider->>Computers: Deploy each on its own sandbox Computers-->>Provider: Named MCP and base URLs Provider->>Gateway: Start with child routes Gateway-->>Multi: Ready deployment Multi->>Multi: Save child records and sandbox IDs Multi->>Computers: Close children Multi->>Provider: Close gateway deploymentReviews (10) · Last reviewed commit: "ci: refresh the shard durations from mai..." · Reviewed by Greptile