diff --git a/src/agent_env/bundle/plan.py b/src/agent_env/bundle/plan.py index f9e93ec6c..fe8e76278 100644 --- a/src/agent_env/bundle/plan.py +++ b/src/agent_env/bundle/plan.py @@ -39,6 +39,7 @@ from agent_env.env.envs.computer.driver_env import ComputerDriverEnv from agent_env.env.envs.computer.utils import sites from agent_env.env.envs.mcp_server import MCPServerEnv +from agent_env.env.envs import _multi_computers from agent_env.env.envs.multi_env import MultiEnv from agent_env.env.envs.website import WebsiteEnv from agent_env.env.published_images import published_bundle_image @@ -894,7 +895,8 @@ def _check_multi_names(self, closure: set[_Key], store_latest: dict[tuple[Entity """Each env of a multi runs as containers its environment_name names: an MCP server as one by that name, a website as its backend's and frontend's. No two of a multi's envs may name one container, and a provider other than the core's, which gives a multi one env card, can't tell an MCP server and a website of one name - apart. Nor may two of its websites claim one name.""" + apart. Nor may two of its websites claim one name. A computer runs on a sandbox of its own, which the gateway + knows by its name alone, and serves its tools under it (``_multi_computers.name_problems``).""" for key in sorted(closure, key=self.rank.__getitem__): source = self.nodes[key] if isinstance(source, BundleImage) or source.entry.kind is not BundleKind.ENV: @@ -904,6 +906,7 @@ def _check_multi_names(self, closure: set[_Key], store_latest: dict[tuple[Entity where = self._path(source.entry) taken: dict[str, str] = {} # each container a child runs as, by the field naming the child named: dict[str, set[str]] = {} # the environment_names of each list's envs + computers: list[str] = [] # the computers' environment_names, in order claimed = [sites.Claim(domain, sites.SYNTHETIC, ref.where) for ref in source.references if ref.where.startswith("website_envs[") for domain in dict.fromkeys(self._domains(ref, store_latest))] @@ -916,6 +919,9 @@ def _check_multi_names(self, closure: set[_Key], store_latest: dict[tuple[Entity continue group = ref.where.partition("[")[0] named.setdefault(group, set()).add(name) + if group == "computer_envs": + computers.append(name) + continue containers = [name] if group == "mcp_server_envs" else [ f"{name}-{AGENT_ENV_WEBSITE_BACKEND_SUFFIX}", f"{name}-{AGENT_ENV_WEBSITE_FRONTEND_SUFFIX}"] clash = next((container for container in containers if container in taken), None) @@ -924,6 +930,8 @@ def _check_multi_names(self, closure: set[_Key], store_latest: dict[tuple[Entity f"{clash!r}, as {taken[clash]}'s does; each env of a multi needs its own") else: taken.update(dict.fromkeys(containers, ref.where)) + self.problems += [f"{where}: computer_envs: {problem}" for problem in _multi_computers.name_problems( + computers, mcp_servers=named.get("mcp_server_envs", ()), websites=named.get("website_envs", ()))] provider_type = source.config.get("env_provider_type", EnvironmentGatewayProvider.type) try: provider = _env_provider_class(provider_type) @@ -935,6 +943,8 @@ def _check_multi_names(self, closure: set[_Key], store_latest: dict[tuple[Entity website_names=named.get("website_envs", ())) if reason is not None: self.problems.append(f"{where}: env_provider_type {provider_type!r} {reason}; rename one") + if (reason := provider_refusal(provider, MultiEnv, computer_names=computers)) is not None: + self.problems.append(f"{where}: env_provider_type {provider_type!r} {reason}") def _check_environment_names(self, closure: set[_Key], store_latest: dict[tuple[EntityKind, str], int] | None) -> None: diff --git a/src/agent_env/cli/env/multi.py b/src/agent_env/cli/env/multi.py index 282e63b7b..489ee1baa 100644 --- a/src/agent_env/cli/env/multi.py +++ b/src/agent_env/cli/env/multi.py @@ -5,6 +5,7 @@ from agent_env.artifact import EnvironmentArtifact, EnvironmentUniverseArtifact from agent_env.cli.utils import detect_base_metadata, env_provider_type_option from agent_env.env import Env, MultiEnv +from agent_env.env.envs.computer import COMPUTER_ENV_TYPE def parse_env_ref(ref: str) -> tuple[str, int | None]: @@ -25,40 +26,25 @@ def multi(): @click.option("--id", "env_id", required=True, help="Env id") @click.option("--mcp-server", "mcp_servers", multiple=True, help="MCPServerEnv id[:version]") @click.option("--website", "websites", multiple=True, help="WebsiteEnv id[:version]") +@click.option("--computer", "computers", multiple=True, + help="ComputerEnv id[:version], deployed on a sandbox of its own; its tools are served under its " + "environment_name and '_'") @click.option("--metadata", "metadata_pairs", multiple=True, help="Metadata key=value pair (repeatable)") @click.option("--name", default=None, help="Name agents see this env's MCP server under, e.g. crm -> mcp__crm__ (default: env + 4 random digits per deploy)") @env_provider_type_option("What deploys the env: 'gateway' (a gateway in front of its servers and websites, whatever their own " "env_provider_type), or the type of an installed agent_env.env_providers plugin, which deploys them all", "multi") @click.option("--validate", "run_validation", is_flag=True, default=False, help="Validate the environment after registering it") -def put(env_id: str, mcp_servers: tuple[str, ...], websites: tuple[str, ...], metadata_pairs: tuple[str, ...], name: str | None, env_provider_type: str, - run_validation: bool): - """Create a MultiEnv from MCPServerEnv and/or WebsiteEnv ids.""" +def put(env_id: str, mcp_servers: tuple[str, ...], websites: tuple[str, ...], computers: tuple[str, ...], + metadata_pairs: tuple[str, ...], name: str | None, env_provider_type: str, run_validation: bool): + """Create a MultiEnv from MCPServerEnv, WebsiteEnv and ComputerEnv ids.""" - if not mcp_servers and not websites: - click.echo("Error: At least one of --mcp-server or --website must be provided.", err=True) + if not mcp_servers and not websites and not computers: + click.echo("Error: At least one of --mcp-server, --website or --computer must be provided.", err=True) raise SystemExit(1) - mcp_server_envs = [] - for ref in mcp_servers: - server_id, server_version = parse_env_ref(ref) - click.echo(f"Fetching MCPServerEnv: id={server_id} version={server_version or 'latest'}...") - env = Env.get(server_id, version=server_version) - if env.type != "mcp_server": - click.echo(f"Error: {server_id} is type '{env.type}', expected 'mcp_server'", err=True) - raise SystemExit(1) - mcp_server_envs.append(env) - click.echo(f" Found: id={env.id} version={env.version}") - - website_envs = [] - for ref in websites: - website_id, website_version = parse_env_ref(ref) - click.echo(f"Fetching WebsiteEnv: id={website_id} version={website_version or 'latest'}...") - env = Env.get(website_id, version=website_version) - if env.type != "website": - click.echo(f"Error: {website_id} is type '{env.type}', expected 'website'", err=True) - raise SystemExit(1) - website_envs.append(env) - click.echo(f" Found: id={env.id} version={env.version}") + mcp_server_envs = _fetch(mcp_servers, "mcp_server", "MCPServerEnv") + website_envs = _fetch(websites, "website", "WebsiteEnv") + computer_envs = _fetch(computers, COMPUTER_ENV_TYPE, "ComputerEnv") user_metadata = {} for pair in metadata_pairs: @@ -69,14 +55,17 @@ def put(env_id: str, mcp_servers: tuple[str, ...], websites: tuple[str, ...], me metadata = detect_base_metadata() metadata.update(user_metadata) - refusal = MultiEnv(id=env_id, version=None, mcp_server_envs=mcp_server_envs, website_envs=website_envs, name=name, - env_provider_type=env_provider_type).deploy_refusal() + try: + refusal = MultiEnv(id=env_id, version=None, mcp_server_envs=mcp_server_envs, website_envs=website_envs, name=name, + env_provider_type=env_provider_type, computer_envs=computer_envs).save_refusal() + except ValueError as e: + refusal = str(e) if refusal: click.echo(f"Error: {refusal}", err=True) raise SystemExit(1) click.echo("Creating MultiEnv...") multi_env = MultiEnv.put(id=env_id, mcp_server_envs=mcp_server_envs, website_envs=website_envs, metadata=metadata if metadata else None, name=name, - env_provider_type=env_provider_type) + env_provider_type=env_provider_type, computer_envs=computer_envs) click.echo(f"Created MultiEnv: id={multi_env.id} version={multi_env.version} env_provider_type={multi_env.env_provider_type}") if run_validation: click.echo("\nValidating environment...") @@ -84,6 +73,21 @@ def put(env_id: str, mcp_servers: tuple[str, ...], websites: tuple[str, ...], me click.echo(f"Validation task: {instance_id}") +def _fetch(refs: tuple[str, ...], env_type: str, label: str) -> list[Env]: + """The env each of ``refs`` (id[:version]) names, exiting unless each is an ``env_type`` env.""" + envs = [] + for ref in refs: + env_id, version = parse_env_ref(ref) + click.echo(f"Fetching {label}: id={env_id} version={version or 'latest'}...") + env = Env.get(env_id, version=version) + if env.type != env_type: + click.echo(f"Error: {env_id} is type '{env.type}', expected '{env_type}'", err=True) + raise SystemExit(1) + envs.append(env) + click.echo(f" Found: id={env.id} version={env.version}") + return envs + + @multi.command(name="load-environment-universe-artifact") @click.option("--env-instance-id", "env_instance_id", required=True, help="Deployed env instance ID") @click.option("--environment-universe-artifact-id", "environment_universe_artifact_id", diff --git a/src/agent_env/env/env.py b/src/agent_env/env/env.py index 2afe8ee84..7d0faa1d9 100644 --- a/src/agent_env/env/env.py +++ b/src/agent_env/env/env.py @@ -235,6 +235,9 @@ class DeployedGatewayEnv(DeployedSandboxEnv): # Ids of the EnvStateInstance record(s) this deploy's state was provisioned into # (one today — one backend per deploy). The forward pointer deploy -> state store. env_state_instance_ids: list[str] = field(default_factory=list) + # Each child env on a sandbox of its own, which the gateway fronts (a multi env's computers): its own deploy record, + # by its environment name. + child_envs: dict[str, dict] = field(default_factory=dict) @classmethod def _fields_from(cls, data: dict) -> dict: @@ -248,6 +251,7 @@ def _fields_from(cls, data: dict) -> dict: "website_frontend_urls": data.get("website_frontend_urls"), "vnc_url": data.get("vnc_url"), "env_state_instance_ids": data.get("env_state_instance_ids") or [], + "child_envs": data.get("child_envs") or {}, } @@ -562,4 +566,5 @@ def _record_class(data: dict) -> type[DeployedEnv]: # A record carrying any of these is a gateway's. Not gateway_mode: an older kernel writes its default into any record it round-trips. -_GATEWAY_ONLY_FIELDS = ("gateway_url", "db_web_url", "db_mcp_url", "website_frontend_urls", "vnc_url", "env_state_instance_ids") +_GATEWAY_ONLY_FIELDS = ("gateway_url", "db_web_url", "db_mcp_url", "website_frontend_urls", "vnc_url", "env_state_instance_ids", + "child_envs") diff --git a/src/agent_env/env/envs/_deployment.py b/src/agent_env/env/envs/_deployment.py index 95c8450c6..755d78261 100644 --- a/src/agent_env/env/envs/_deployment.py +++ b/src/agent_env/env/envs/_deployment.py @@ -297,17 +297,19 @@ def deploy_refusal(env: Env, provider: EnvironmentProvider | type[EnvironmentPro provider_class = provider if isinstance(provider, type) else type(provider) reason = provider_refusal(provider_class, type(env), mcp_names=[child.environment_name for child in getattr(env, "mcp_server_envs", ())], - website_names=[child.environment_name for child in getattr(env, "website_envs", ())]) + website_names=[child.environment_name for child in getattr(env, "website_envs", ())], + computer_names=[child.environment_name for child in getattr(env, "computer_envs", ())]) if reason is not None: return f"env '{env.id}' has env_provider_type '{env.env_provider_type}', which {reason}" return option_refusal(env, provider, options) def provider_refusal(provider_class: type[EnvironmentProvider], env_class: type[Env], *, mcp_names: Iterable[str] = (), - website_names: Iterable[str] = ()) -> str | None: + website_names: Iterable[str] = (), computer_names: Iterable[str] = ()) -> str | None: """Why a provider of provider_class can't deploy an env of env_class, a multi's with children of these environment_names, worded - to follow the provider's type, or None: the server provider deploys one MCP server, and a plugin's provider gives a multi one - env card, which can't tell an MCP server and a website of one name apart. It needs no env, so a bundle checks it before writing one.""" + to follow the provider's type, or None: the server provider deploys one MCP server, a plugin's provider gives a multi one + env card, which can't tell an MCP server and a website of one name apart, and only a provider whose deploy() takes + ``children`` deploys a multi's computers. It needs no env, so a bundle checks it before writing one.""" from agent_env.env.envs.mcp_server import MCPServerEnv from agent_env.env.envs.multi_env import MultiEnv from agent_env.providers.env_providers.env_provider import _SandboxEnvironmentProvider @@ -315,6 +317,9 @@ def provider_refusal(provider_class: type[EnvironmentProvider], env_class: type[ if issubclass(provider_class, EnvironmentServerProvider) and not issubclass(env_class, MCPServerEnv): return f"deploys one MCP server, not a {env_class.type} env" + computer_names = list(computer_names) + if computer_names and "children" not in inspect.signature(provider_class.deploy).parameters: + return f"deploys no computers, so not its {', '.join(map(repr, computer_names))}" if issubclass(env_class, MultiEnv) and not issubclass(provider_class, _SandboxEnvironmentProvider): if shared := set(mcp_names) & set(website_names): return (f"gives a multi one env card, so it can't tell an MCP server and a website apart by name, and both are named " diff --git a/src/agent_env/env/envs/_multi_computers.py b/src/agent_env/env/envs/_multi_computers.py new file mode 100644 index 000000000..907f0acba --- /dev/null +++ b/src/agent_env/env/envs/_multi_computers.py @@ -0,0 +1,144 @@ +"""A multi env's computers: each on a sandbox of its own, deployed as it would be alone, which the multi env's gateway +fronts by its name. ``Computers`` holds them across deploys; the rules a computer's name and child_envs entry follow are +here too. Nothing here imports the computer env, which imports the env providers that import this package.""" +from __future__ import annotations + +import asyncio +import dataclasses +import logging +from collections import Counter +from collections.abc import Awaitable, Callable, Iterable +from typing import TYPE_CHECKING, Optional + +from agentenv_protocol.computer import tool_prefix_problem + +from agent_env.env.env import DeployedEnv, DeployedGatewayEnv, Env +from agent_env.env.gateway import ExternalChild +from agent_env.providers.sandbox_providers.sandbox_provider import build_sandbox_provider, get_env_sandbox_provider + +if TYPE_CHECKING: + from agent_env.attribution import Attribution + from agent_env.env.envs.computer.env import ComputerEnv + +logger = logging.getLogger(__name__) + + +def name_problems(computers: Iterable[str], *, mcp_servers: Iterable[str] = (), websites: Iterable[str] = ()) -> list[str]: + """What's wrong with ``computers``, the environment names of a multi env's computers, beside the names of its + ``mcp_servers`` and ``websites``: a computer serves its tools under its name and ``_``, which must make a tool prefix, + and the gateway knows a computer by its name alone, which no other child env and no route of the gateway's to an + MCP server (``mcp-``) may have.""" + computers, mcp_servers = list(computers), list(dict.fromkeys(mcp_servers)) + problems = [f"computer {name!r} serves its tools under its name and '_': {problem}" + for name in dict.fromkeys(computers) if (problem := tool_prefix_problem(f"{name}_"))] + counts = Counter([*computers, *dict.fromkeys([*mcp_servers, *websites])]) + routes = {f"mcp-{server}": server for server in mcp_servers} + problems += [f"{name!r} names {counts[name]} of its child envs, and the gateway knows a computer by its name alone" + for name in dict.fromkeys(computers) if counts[name] > 1] + problems += [f"{name!r} is the gateway's route to MCP server {routes[name]!r}, and the gateway knows a computer by its " + "name alone" for name in dict.fromkeys(computers) if name in routes] + return problems + + +def deploy_options(entry: Optional[dict], sandbox_type: str | None) -> dict: + """A computer's deploy options from its child_envs entry: on ``sandbox_type``, the multi env's, unless it names one.""" + return {"sandbox_type": sandbox_type, **(entry or {})} + + +def refusal(computer: ComputerEnv, entry: dict, sandbox_type: str | None) -> str | None: + """Why ``computer`` wouldn't deploy in a multi env with ``entry``, its child_envs entry: why it wouldn't alone, a + site it would route, which only a later change routes to the multi env's websites, or a sandbox provider whose URLs + take credentials, which the gateway doesn't send to a child env.""" + options = deploy_options(entry, sandbox_type) + params = options.get("env_params") + if isinstance(params, dict) and (routed := [key for key in ("site_routing", "sites") if params.get(key)]): + return (f"env_params.{routed[0]}: a computer in a multi env doesn't route sites yet; deploy it beside the multi " + "env to route them") + links = (build_sandbox_provider(options["sandbox_type"]) if options["sandbox_type"] else get_env_sandbox_provider()).links + if headed := [type(link).__name__ for link in links if link.REQUEST_HEADERS]: + return (f"{', '.join(headed)} takes credentials on each request to a sandbox's URL, which the multi env's gateway " + f"doesn't send to a child env; set child_envs.{computer.environment_name}.sandbox_type to a sandbox type " + "whose URLs take none") + return computer.deploy_refusal(**options) + + +class Computers: + """A multi env's computers, and those of each deployment a later deploy replaced, which ``close`` ends too. + + A deploy's computers are its own, as its provider and sandbox are (``deploy_through_provider``): ``begin`` gives it + fresh ones when these already have a deployment and sets the earlier ones aside, so its failure closes only what it + made and ``rollback`` puts them back; ``commit`` keeps them for ``close``.""" + + def __init__(self, envs: list[ComputerEnv], owner: str) -> None: + self.envs = envs + self._owner = owner # the multi env's id, for what's logged + self._replaced: list[ComputerEnv] = [] + self._earlier: Optional[tuple[list[ComputerEnv], list[ComputerEnv]]] = None + + def begin(self) -> None: + self._earlier = (self.envs, self._replaced) + if any(env._deployed is not None for env in self.envs): + self.envs = [Env.get(env.id, env.version) for env in self.envs] + self._replaced = [] + + def rollback(self) -> None: + (self.envs, self._replaced), self._earlier = self._earlier, None + + def commit(self) -> None: + (earlier, replaced), self._earlier = self._earlier, None + self._replaced = [*replaced, *(earlier if self.envs is not earlier else [])] + + def deployer(self, child_envs: Optional[dict], *, sandbox_type: str | None, ttl_seconds: int, + attribution: Optional[Attribution]) -> Callable[[Optional[str]], Awaitable[list[ExternalChild]]]: + """The gateway's ``children``: every computer deployed as its child_envs entry says, its tools served under its + name and ``_``, and its network allowing ``reach``, the gateway's address when the gateway has one yet; then each + as the gateway fronts it. A gateway deploy tried again deploys them again, after closing the earlier try's.""" + tries = 0 + + async def deploy(reach: Optional[str]) -> list[ExternalChild]: + nonlocal tries + if tries: + await self.close() + tries += 1 + results = await asyncio.gather(*(env.deploy( + ttl_seconds=ttl_seconds, attribution=attribution, tool_prefix=f"{env.environment_name}_", + reach=reach or "", **deploy_options((child_envs or {}).get(env.environment_name), sandbox_type)) + for env in self.envs), return_exceptions=True) + if failed := [result for result in results if isinstance(result, BaseException)]: + for error in failed[1:]: + logger.warning(f"multi env '{self._owner}': another computer failed to deploy too: {error!r}") + raise failed[0] + return [ExternalChild(env.environment_name, record.mcp_url, record.environment_url) + for env, record in zip(self.envs, results)] + return deploy + + async def record(self, deployed: DeployedEnv) -> None: + """Keep each computer's own record in ``deployed``, the multi env's, before it is registered: whole in its + ``child_envs``, for ``reattach``, and its sandbox in its ``sandbox_ids`` under the backend that made it, for + teardown.""" + if not isinstance(deployed, DeployedGatewayEnv): + raise TypeError(f"multi env '{self._owner}': its computers are recorded in a gateway's record, not a " + f"{type(deployed).__name__}") + records = {env.environment_name: env._deployed for env in self.envs} + deployed.child_envs = {name: dataclasses.asdict(record) for name, record in records.items()} + for name, record in records.items(): + deployed.sandbox_ids.setdefault(record.sandbox_type, {})[name] = record.sandbox_id + + async def reattach(self, deployed: DeployedEnv) -> None: + """Each computer ``deployed``, the multi env's record, holds, reattached from its own record.""" + records = getattr(deployed, "child_envs", None) or {} + reattached = await asyncio.gather(*(type(env).from_deployed_env(DeployedEnv.from_dict(records[env.environment_name])) + for env in self.envs if env.environment_name in records)) + by_name = {env.environment_name: env for env in reattached} + self.envs = [by_name.get(env.environment_name, env) for env in self.envs] + + async def close(self) -> None: + """Close each computer, and those of the deployments a later deploy replaced, their recordings ended first; one + that fails to close is logged.""" + envs = [*self._replaced, *self.envs] + results = await asyncio.gather(*(env.close() for env in envs), return_exceptions=True) + for env, result in zip(envs, results): + if isinstance(result, Exception): + logger.warning(f"multi env '{self._owner}': failed to close computer {env.environment_name!r}: {result!r}") + elif isinstance(result, BaseException): + raise result diff --git a/src/agent_env/env/envs/computer/__init__.py b/src/agent_env/env/envs/computer/__init__.py index 350712890..3676941e9 100644 --- a/src/agent_env/env/envs/computer/__init__.py +++ b/src/agent_env/env/envs/computer/__init__.py @@ -1 +1,4 @@ """The computer env type: a base computer and a driver, composed at put into an image for each form and arch.""" + +#: The computer env's type, which a multi env names its computers by without importing the env. +COMPUTER_ENV_TYPE = "computer" diff --git a/src/agent_env/env/envs/computer/env.py b/src/agent_env/env/envs/computer/env.py index 8043efe5a..4b039e9c8 100644 --- a/src/agent_env/env/envs/computer/env.py +++ b/src/agent_env/env/envs/computer/env.py @@ -31,6 +31,7 @@ deploy_through_provider, provider_or_class, ) +from agent_env.env.envs.computer import COMPUTER_ENV_TYPE from agent_env.env.envs.computer.utils import boot, composer, gate, inside, sites from agent_env.env.envs.computer.utils.composed import stale from agent_env.env.envs.computer.utils.composer import Composing @@ -69,7 +70,7 @@ class ComputerEnv(Env): - type: ClassVar[str] = "computer" + type: ClassVar[str] = COMPUTER_ENV_TYPE description = "A computer: a base computer and a driver, composed at put into an image for each form and arch" env_provider_type: ClassVar[str] = "computer" toml_refs: ClassVar[tuple[EntityRef, ...]] = (EntityRef.artifact("computer", artifact_type="computer"), @@ -277,13 +278,14 @@ async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, *, attribution: Optional[Attribution] = None, - env_params: Optional[dict] = None, tool_prefix: str = "") -> DeployedEnv: - """With ``tool_prefix``, its driver serves its tools under it, as a multi env's computers serve theirs.""" + env_params: Optional[dict] = None, tool_prefix: str = "", reach: str = "") -> DeployedEnv: + """With ``tool_prefix``, its driver serves its tools under it, and with ``reach``, a network that restricts its + egress allows that URL's host too: what a multi env gives each of its computers.""" return await deploy_through_provider( self, environment_name=self.environment_name, ttl_seconds=ttl_seconds, sandbox_type=sandbox_type, then=self._give_tools, disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb, env_state_type=env_state_type, env_state_instance_id=env_state_instance_id, attribution=attribution, - env_params=env_params, tool_prefix=tool_prefix) + env_params=env_params, tool_prefix=tool_prefix, reach=reach) async def run_env_params(self, env_params: Optional[dict], deployed_envs: list[DeployedEnv]) -> Optional[dict]: """With ``site_routing`` and no ``sites``, ``env_params`` naming as its sites the websites the run deployed diff --git a/src/agent_env/env/envs/multi_env.py b/src/agent_env/env/envs/multi_env.py index 5b303c644..df7a769a3 100644 --- a/src/agent_env/env/envs/multi_env.py +++ b/src/agent_env/env/envs/multi_env.py @@ -1,4 +1,4 @@ -"""Multi environment combining multiple MCP servers and websites.""" +"""Multi environment combining multiple MCP servers, websites and computers.""" from __future__ import annotations import logging @@ -31,16 +31,19 @@ def _snapshot_after_load_default() -> bool: from agent_env.artifact import EnvironmentArtifact, EnvironmentUniverseArtifact from agent_env.bundle.authoring import AuthoringContext from agent_env.entity.export import ExportContext - from agent_env.env.env import DeployedEnv, LoadEnvironmentUniverseArtifactResult, LoadFileArtifactUniverseResult + from agent_env.env.envs.computer.env import ComputerEnv + from agent_env.env.env import LoadEnvironmentUniverseArtifactResult, LoadFileArtifactUniverseResult from agent_env.providers.env_state import DatabaseStateProvider from agent_env.entity.refs import EntityRef -from agent_env.env.env import Env, gateway_url_of +from agent_env.env.env import DeployedEnv, Env, gateway_url_of from agent_env.env.gateway import GatewayMode from agent_env.env.envs._deployment import ( as_builtin, builtin_provider_for, close_deployed, close_replaced, deploy_refusal, deploy_through_provider, host_staging_refusal, plugin_provider_like_a_builtin, provider_or_class, ) +from agent_env.env.envs import _multi_computers +from agent_env.env.envs.computer import COMPUTER_ENV_TYPE from agent_env.env.envs.computer.utils import sites from agent_env.env.envs.mcp_server import MCPServerEnv from agent_env.env.envs.website import WebsiteEnv @@ -50,6 +53,7 @@ def _snapshot_after_load_default() -> bool: from agent_env.store.ids import derive_id from agent_env.store.image_store.oci_registry_credentials import image_reference_problem from agent_env.providers.sandbox_providers.sandbox_provider import SANDBOX_MODE_CONTAINER +from agent_env.env.registry import get_env_registry from agent_env.attribution import Attribution @@ -74,13 +78,16 @@ def snapshot_compose(compose: str, db_image: str) -> str: class MultiEnv(Env): type: ClassVar[str] = "multi" - description = "Multi environment combining multiple MCP servers and websites, deployed through the environment provider its env_provider_type names" + description = ("Multi environment combining multiple MCP servers, websites and computers, deployed through the environment " + "provider its env_provider_type names") toml_refs: ClassVar[tuple[EntityRef, ...]] = (EntityRef.env("mcp_server_envs[]", env_type=MCPServerEnv.type), - EntityRef.env("website_envs[]", env_type=WebsiteEnv.type)) - toml_keys: ClassVar[dict[str, type]] = {"mcp_server_envs": list, "website_envs": list, "name": str, - "env_provider_type": str} + EntityRef.env("website_envs[]", env_type=WebsiteEnv.type), + EntityRef.env("computer_envs[]", env_type=COMPUTER_ENV_TYPE)) + toml_keys: ClassVar[dict[str, type]] = {"mcp_server_envs": list, "website_envs": list, "computer_envs": list, + "name": str, "env_provider_type": str} - def __init__(self, id: str, version: Optional[int], mcp_server_envs: list[MCPServerEnv], website_envs: list[WebsiteEnv] | None = None, metadata: Optional[dict[str, str]] = None, name: Optional[str] = None, env_provider_type: str = "gateway"): + def __init__(self, id: str, version: Optional[int], mcp_server_envs: list[MCPServerEnv], website_envs: list[WebsiteEnv] | None = None, metadata: Optional[dict[str, str]] = None, name: Optional[str] = None, env_provider_type: str = "gateway", + computer_envs: list[ComputerEnv] | None = None): super().__init__(id, version, metadata=metadata) if name is not None and (not name or any(ch.isspace() for ch in name)): raise ValueError("name must be non-empty with no whitespace") @@ -94,6 +101,11 @@ def __init__(self, id: str, version: Optional[int], mcp_server_envs: list[MCPSer for i, env in enumerate(self.website_envs) for name in dict.fromkeys(env.domains)]): raise sites.SiteConflict(f"multi env {id!r}: its websites claim names twice: {'; '.join(conflicts)}") + self._computers = _multi_computers.Computers(computer_envs or [], owner=id) + if problems := _multi_computers.name_problems([env.environment_name for env in self.computer_envs], + mcp_servers=[env.environment_name for env in self.mcp_server_envs], + websites=[env.environment_name for env in self.website_envs]): + raise ValueError(f"multi env {id!r}: {'; '.join(problems)}") self._sandbox = None self._gateway_url = None self._gateway_mode = GatewayMode.PERFORMANCE @@ -102,6 +114,11 @@ def __init__(self, id: str, version: Optional[int], mcp_server_envs: list[MCPSer self._deployed: Optional[DeployedEnv] = None self._replaced: list[tuple] = [] # the provider and sandbox of each deployment a later deploy replaced, for close() + @property + def computer_envs(self) -> list[ComputerEnv]: + """Its computers, each on a sandbox of its own, which the gateway fronts by its name: after a deploy, that deploy's.""" + return self._computers.envs + def to_dict(self) -> dict: base = super().to_dict() base["mcp_server_envs"] = [ @@ -112,6 +129,8 @@ def to_dict(self) -> dict: {"id": env.id, "type": env.type, "version": env.version} for env in self.website_envs ] + if self.computer_envs: + base["computer_envs"] = [{"id": env.id, "type": env.type, "version": env.version} for env in self.computer_envs] if self.name: base["name"] = self.name base["env_provider_type"] = self.env_provider_type @@ -127,18 +146,25 @@ def from_dict(cls, data: dict) -> "MultiEnv": Env.get(ref["id"], version=ref["version"]) for ref in data.get("website_envs", []) ] + computer_envs = [Env.get(ref["id"], version=ref["version"]) for ref in data.get("computer_envs", [])] return cls(id=data["id"], version=data.get("version"), mcp_server_envs=mcp_server_envs, website_envs=website_envs, metadata=data.get("metadata", {}), - name=data.get("name"), env_provider_type=data.get("env_provider_type", "gateway")) + name=data.get("name"), env_provider_type=data.get("env_provider_type", "gateway"), computer_envs=computer_envs) @classmethod def from_toml(cls, data: dict, ctx: AuthoringContext) -> MultiEnv: - """Write the env authored as ``data`` (its env.toml, with ``mcp_server_envs`` and ``website_envs`` resolved to - env ids) under ``ctx.id`` and return it, unless deploying it would be refused.""" + """Write the env authored as ``data`` (its env.toml, with ``mcp_server_envs``, ``website_envs`` and + ``computer_envs`` resolved to env ids) under ``ctx.id`` and return it, unless saving it would be refused.""" fields = cls.accept_toml(data, ctx) + computer = get_env_registry()[COMPUTER_ENV_TYPE] env = dict(mcp_server_envs=[ctx.env(ref, MCPServerEnv) for ref in fields.get("mcp_server_envs", [])], website_envs=[ctx.env(ref, WebsiteEnv) for ref in fields.get("website_envs", [])], + computer_envs=[ctx.env(ref, computer) for ref in fields.get("computer_envs", [])], name=fields.get("name"), env_provider_type=fields["env_provider_type"]) - if refusal := cls(id=ctx.id, version=None, **env).deploy_refusal(): + try: + refusal = cls(id=ctx.id, version=None, **env).save_refusal() + except ValueError as e: + refusal = str(e) + if refusal: ctx.refuse([refusal]) return cls.put(id=ctx.id, **env) @@ -147,6 +173,8 @@ def to_toml(self, out: ExportContext) -> dict: toml = {"type": self.type, "mcp_server_envs": [out.ref(env) for env in self.mcp_server_envs]} if self.website_envs: toml["website_envs"] = [out.ref(env) for env in self.website_envs] + if self.computer_envs: + toml["computer_envs"] = [out.ref(env) for env in self.computer_envs] if self.name: toml["name"] = self.name return {**toml, **self.provider_toml(out, self.env_provider_type)} @@ -155,8 +183,9 @@ def to_toml(self, out: ExportContext) -> dict: def accept_toml(cls, data: dict, ctx: AuthoringContext) -> dict: """The keys of ``data``, an env.toml, a multi env takes. Raises BundleError listing every problem.""" fields, problems = ctx.accepted_env(data, cls) - if not (fields.get("mcp_server_envs") or fields.get("website_envs")): - problems.append(ctx.config_problem("a multi env needs at least one env in mcp_server_envs or website_envs")) + if not (fields.get("mcp_server_envs") or fields.get("website_envs") or fields.get("computer_envs")): + problems.append(ctx.config_problem("a multi env needs at least one env in mcp_server_envs, website_envs or " + "computer_envs")) name = fields.get("name") if name is not None and (not name or any(ch.isspace() for ch in name)): problems.append(ctx.config_problem(f"name must be non-empty with no whitespace, not {name!r}")) @@ -166,32 +195,49 @@ def accept_toml(cls, data: dict, ctx: AuthoringContext) -> dict: async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, artifact_id: str | None = None, artifact_version: int | None = None, *, attribution: Optional[Attribution] = None, child_envs: Optional[dict] = None) -> DeployedEnv: - if refusal := self.child_envs_refusal(child_envs): + if refusal := self.child_envs_refusal(child_envs, sandbox_type=sandbox_type): raise ValueError(refusal) - deployed_env = await deploy_through_provider( - self, environment_name=None, ttl_seconds=ttl_seconds, sandbox_type=sandbox_type, - disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb, - env_state_type=env_state_type, env_state_instance_id=env_state_instance_id, attribution=attribution, - artifact_id=artifact_id, artifact_version=artifact_version, - ) + self._computers.begin() + computers = dict(children=self._computers.deployer(child_envs, sandbox_type=sandbox_type, ttl_seconds=ttl_seconds, + attribution=attribution), + then=self._computers.record) if self.computer_envs else {} + try: + deployed_env = await deploy_through_provider( + self, environment_name=None, ttl_seconds=ttl_seconds, sandbox_type=sandbox_type, + disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb, + env_state_type=env_state_type, env_state_instance_id=env_state_instance_id, attribution=attribution, + artifact_id=artifact_id, artifact_version=artifact_version, **computers, + ) + except BaseException: + self._computers.rollback() + raise + self._computers.commit() self._gateway_mode = gateway_mode self._mcp_server_name = deployed_env.mcp_server_name _hand_provider_to_child_envs(self) _hand_record_to_child_envs(self, deployed_env) return deployed_env + def save_refusal(self) -> str | None: + """Why saving the env would be refused, or None: its env_provider_type can't deploy it. How each computer fits a + sandbox is a deploy's question, as it is for a computer saved alone (``deploy_refusal``).""" + return deploy_refusal(self, provider_or_class(self), {}) + def deploy_refusal(self, *, sandbox_type: str | None = None, child_envs: Optional[dict] = None, **options) -> str | None: """Why deploy() would refuse these options before building anything, or None; raises, as deploy() does, for a type this process can't find. ``sandbox_type`` and ``child_envs`` are deploy()'s own, which no provider takes.""" - return deploy_refusal(self, provider_or_class(self), options) or self.child_envs_refusal(child_envs) - - def child_envs_refusal(self, child_envs: Optional[dict]) -> str | None: - """Why a deploy would refuse ``child_envs``, each child env's options by its environment name, or None.""" - if not child_envs: - return None - if not isinstance(child_envs, dict): + return (deploy_refusal(self, provider_or_class(self), options) + or self.child_envs_refusal(child_envs, sandbox_type=sandbox_type)) + + def child_envs_refusal(self, child_envs: Optional[dict], *, sandbox_type: str | None = None) -> str | None: + """Why a deploy would refuse ``child_envs``, each child env's options by its environment name, or None. A computer + is checked as its entry, or no entry, would deploy it on a sandbox of its own, ``sandbox_type`` (the multi env's) + unless the entry names one; any other child env runs on the multi env's sandbox and takes no entry.""" + if child_envs and not isinstance(child_envs, dict): return f"child_envs is a table of child env names, not {type(child_envs).__name__}" - names = list(dict.fromkeys(env.environment_name for env in (*self.mcp_server_envs, *self.website_envs))) + child_envs = child_envs or {} + computers = {env.environment_name: env for env in self.computer_envs} + names = list(dict.fromkeys(env.environment_name for env in (*self.mcp_server_envs, *self.website_envs, *self.computer_envs))) problems = [] for name, entry in child_envs.items(): extra = sorted(map(str, set(entry) - set(CHILD_ENV_OPTIONS))) if isinstance(entry, dict) else [] @@ -201,10 +247,15 @@ def child_envs_refusal(self, child_envs: Optional[dict]) -> str | None: elif not isinstance(entry, dict) or extra: problems.append(f"child_envs.{name}: an entry is a table of {', '.join(CHILD_ENV_OPTIONS)}, not " + (', '.join(extra) if extra else f"a {type(entry).__name__}")) - else: + elif name not in computers: problems.append(f"child_envs.{name}: {name} runs on the multi env's own sandbox, which the step's own " "fields set, so it takes no entry") - return "; ".join(problems) + for name, computer in computers.items(): + entry = child_envs.get(name) + if entry is None or (isinstance(entry, dict) and set(entry) <= set(CHILD_ENV_OPTIONS)): + if refusal := _multi_computers.refusal(computer, entry or {}, sandbox_type): + problems.append(f"child_envs.{name}: {refusal}" if name in child_envs else refusal) + return "; ".join(problems) or None @classmethod async def from_deployed_env(cls, deployed: DeployedEnv) -> MultiEnv: @@ -222,6 +273,8 @@ async def from_deployed_env(cls, deployed: DeployedEnv) -> MultiEnv: _hand_record_to_child_envs(env, deployed) env._instance_id = deployed.instance_id env._mcp_server_name = deployed.mcp_server_name + if env.computer_envs: + await env._computers.reattach(deployed) return env async def load_environment_artifact(self, environment_artifact: EnvironmentArtifact) -> None: @@ -815,6 +868,7 @@ async def validate_universe_compatibility(self, universe_artifact_id: str, unive return context.instance_id async def close(self) -> None: + await self._computers.close() await close_replaced(self) if self._env_provider is not None: try: diff --git a/src/agent_env/env/gateway/__init__.py b/src/agent_env/env/gateway/__init__.py index 6cd59de6f..7a4123f58 100644 --- a/src/agent_env/env/gateway/__init__.py +++ b/src/agent_env/env/gateway/__init__.py @@ -27,6 +27,16 @@ class InternalMCPServer: mcp_url: str +@dataclass(frozen=True) +class ExternalChild: + """A child env on a sandbox of its own, which the gateway fronts as it does an MCP server: its name, and its MCP + endpoint and base URL as the process holding it reaches them.""" + + name: str + mcp_url: str + base_url: str + + __all__ = [ "AGENT_ENV_GATEWAY_MCP_PORT", "AGENT_ENV_HIDDEN_BY_DEFAULT_META_KEY", @@ -34,6 +44,7 @@ class InternalMCPServer: "AGENT_ENV_ROLE_META_KEY", "AGENT_ENV_SESSION_META_KEY", "DEFAULT_ROLE", + "ExternalChild", "GATEWAY_TRAJECTORY_FILE", "GatewayMode", "InternalMCPServer", diff --git a/src/agent_env/providers/env_providers/env_computer_provider.py b/src/agent_env/providers/env_providers/env_computer_provider.py index 5eef882e2..4bb8be09b 100644 --- a/src/agent_env/providers/env_providers/env_computer_provider.py +++ b/src/agent_env/providers/env_providers/env_computer_provider.py @@ -8,6 +8,7 @@ import logging from datetime import datetime, timedelta, timezone from typing import TYPE_CHECKING, ClassVar, Optional +from urllib.parse import urlsplit from agentenv_protocol import client as protocol_v1 from agentenv_protocol.computer import COMPUTER_DISPLAY, COMPUTER_RECORDING, tool_prefix_problem @@ -73,10 +74,12 @@ async def deploy( attribution: Optional[Attribution] = None, env_params: Optional[dict] = None, tool_prefix: str = "", + reach: str = "", ) -> DeployedSandboxEnv: """The env's first ready build, in its base's order of forms and arches (or of ``env_params.form``), that the sandbox provider runs natively, booted, once what it boots that no compose started is composed; returns the record once - the driver is ready with the env's display. With ``tool_prefix``, its driver serves its tools under it.""" + the driver is ready with the env's display. With ``tool_prefix``, its driver serves its tools under it; with ``reach``, + a URL this process reaches, a network that restricts the computer's egress allows its host too.""" from agent_env.env.envs.computer.env import ComputerEnv if not isinstance(env, ComputerEnv): @@ -108,7 +111,7 @@ async def deploy( "computer runs inside a launcher container it can't reach; deploy a container form") attempt = functools.partial(self._boot, env, builds, params, values, ttl_seconds=ttl_seconds, disk_size_gb=disk_size_gb, cpu=cpu, memory_mb=memory_mb, attribution=attribution, - tool_prefix=tool_prefix) + tool_prefix=tool_prefix, reach=reach) return await self._run(sandbox_provider, env.id, attempt) async def install_changelog_triggers(self, environment_name: str) -> None: @@ -117,7 +120,7 @@ async def install_changelog_triggers(self, environment_name: str) -> None: async def _boot(self, env: ComputerEnv, builds: list[tuple[str, str, dict]], params: computer_params.ComputerParams, values: dict, sandbox_provider: SandboxProvider, *, ttl_seconds: int, disk_size_gb: float, cpu: float | None, memory_mb: int | None, - attribution: Optional[Attribution], tool_prefix: str = "") -> DeployedSandboxEnv: + attribution: Optional[Attribution], tool_prefix: str = "", reach: str = "") -> DeployedSandboxEnv: """One attempt on one sandbox provider: the first build it runs natively, booted and readied; its record.""" from agent_env.env.envs.computer.env import ComputerEnv @@ -142,7 +145,7 @@ async def _boot(self, env: ComputerEnv, builds: list[tuple[str, str, dict]], par values = _values(computer, values) app_settings = recorded_app_settings(env.composed_apps(), computer_params.app_settings(env, params.app_settings), env.computer.os.type) - policy = NetworkPolicy.from_dict(env.network) if env.network else None + policy = _reaching(NetworkPolicy.from_dict(env.network) if env.network else None, sandbox_provider, reach) booted = await boot( sandbox_provider, image=build["image"], port=env.driver.port, network_policy=policy, token=token, environment=_environment(env, computer, values, params, tool_prefix), timeout=ttl_seconds, @@ -306,6 +309,12 @@ async def end_recordings(record: DeployedSandboxEnv, reason: str) -> None: logger.warning(f"'{record.env_id}': its recordings weren't ended before its computer went: {e}") +def _reaching(policy: Optional[NetworkPolicy], sandbox_provider: SandboxProvider, url: str) -> Optional[NetworkPolicy]: + """``policy``, also allowing ``url``'s host as the sandbox provider's sandboxes reach it when it lists the hosts allowed.""" + host = urlsplit(sandbox_provider.url_from_sandbox(url)).hostname if url else None + return policy.with_hosts([host]) if policy is not None and host else policy + + def _values(computer: ComputerArtifact, values: dict) -> dict: """The computer's settings a boot applies: each one's default, which carries the env's value, under what ``env_params`` set.""" diff --git a/src/agent_env/providers/env_providers/env_gateway_provider.py b/src/agent_env/providers/env_providers/env_gateway_provider.py index b8df4c430..234a17ddf 100644 --- a/src/agent_env/providers/env_providers/env_gateway_provider.py +++ b/src/agent_env/providers/env_providers/env_gateway_provider.py @@ -28,7 +28,7 @@ from agent_env.artifact.artifacts.docker_image import pull_problem from agent_env.attribution import Attribution from agent_env.env.env import DeployedGatewayEnv, _mcp_url -from agent_env.env.gateway import AGENT_ENV_GATEWAY_MCP_PORT, GatewayMode +from agent_env.env.gateway import AGENT_ENV_GATEWAY_MCP_PORT, ExternalChild, GatewayMode from agent_env.env.gateway.constants import ( DEFAULT_MCP_SERVER_NAME, GATEWAY_PROVIDER_HEADERS_ENV, @@ -292,6 +292,7 @@ def create_docker_compose( host_ips: tuple[str, ...] = (), extra_hosts: tuple[str, ...] = (), mcp_server_name: str | None = None, + external_children: tuple[ExternalChild, ...] = (), ) -> str: """Generate docker-compose.yml content for a gateway deployment onto a VM/laptop/arbitrary machine. @@ -474,7 +475,7 @@ def create_docker_compose( " - MCP_HOST=0.0.0.0", f" - MCP_PORT={gateway_port}", f" - MCP_SERVER_NAME={server_name}", - f" - INTERNAL_MCP_SERVERS={','.join(mcp_server_names)}", + f" - INTERNAL_MCP_SERVERS={','.join([*mcp_server_names, *(f'{c.name}={c.mcp_url}' for c in external_children)])}", f" - INTERNAL_MCP_PORT={gateway_port}", " - GATEWAY_TRAJECTORY_FILE=/var/log/agentenv/trajectory.jsonl", ] @@ -496,6 +497,7 @@ def create_docker_compose( rest_proxy_urls.append( f"{wc.environment_name}=http://{wc.environment_name}-{AGENT_ENV_WEBSITE_BACKEND_SUFFIX}:{AGENT_ENV_WEBSITE_BACKEND_PORT}" ) + rest_proxy_urls += [f"{child.name}={child.base_url}" for child in external_children] if rest_proxy_urls: gateway_env.append(f" - REST_PROXY_URLS={','.join(rest_proxy_urls)}") gateway_env.append(f" - GATEWAY_MODE={gateway_mode.value}") @@ -615,10 +617,13 @@ async def deploy( attribution: Optional[Attribution] = None, artifact_id: str | None = None, artifact_version: int | None = None, + children: "Callable[[Optional[str]], Awaitable[list[ExternalChild]]] | None" = None, ) -> DeployedGatewayEnv: """A gateway in front of the env, with the state store it acquires (local Postgres by default); returns the record. A MultiEnv's gateway fronts its MCP servers and websites, a WebsiteEnv's its website, and any other env's its one MCP server. + ``children`` starts the env's children that run on sandboxes of their own, given the gateway's address where it's + known before the gateway starts, and returns them; the gateway starts once they have, fronting them too. """ from agent_env.config import get_config, service_db_env_id from agent_env.env.env import Env @@ -637,6 +642,7 @@ async def deploy( mcp_server_images=topology.mcp_server_images, website_configs=topology.website_configs, website_images=topology.website_images, mcp_server_name=topology.mcp_server_name, gateway_mode=gateway_mode, ttl_seconds=ttl_seconds, disk_size_gb=disk_size_gb, cpu=cpu, memory_mb=memory_mb, attribution=attribution, + children=children, ) return DeployedGatewayEnv( env_id=env.id, @@ -753,6 +759,7 @@ async def _deploy_via_vm( existing_sandbox: Sandbox | None = None, sidecars: list[SidecarConfig] | None = None, mcp_server_name: str | None = None, + children: "Callable[[Optional[str]], Awaitable[list[ExternalChild]]] | None" = None, ) -> DeployedGateway: from agent_env.env.env import Env from agent_env.config import gateway_env_id, get_config, website_browser_env_id @@ -831,7 +838,8 @@ async def _stand_up(_spec): self._all_environments(mcp_servers, website_configs), instance=state_instance ) - compose_content = self.create_docker_compose( + compose = functools.partial( + self.create_docker_compose, mcp_servers=mcp_servers, gateway_image=gateway_env.docker_image_artifact.image_name, gateway_port=gateway_port, @@ -845,6 +853,7 @@ async def _stand_up(_spec): extra_hosts=sandbox.extra_hosts, mcp_server_name=mcp_server_name, ) + compose_content = compose() logger.info(f"Generated docker-compose.yml:\n{_redact_compose_secrets(compose_content)}") # Write files to VM @@ -862,7 +871,20 @@ async def _stand_up(_spec): # Start MCP services with docker compose logger.info("Starting MCP services...") - await self._compose_up(sandbox) + if children is None: + await self._compose_up(sandbox) + else: + # Everything but the gateway, beside the children; then the gateway, which waits for every child it fronts. + # Both run to the end before either's failure is raised, so no child is still starting when the deploy closes. + up, started = await asyncio.gather(self._compose_up(sandbox, f"--scale {GATEWAY_SERVICE_NAME}=0"), + children(sandbox.tunnel_urls.get(gateway_port)), return_exceptions=True) + for result in (up, started): + if isinstance(result, BaseException): + raise result + external = tuple(ExternalChild(child.name, sandbox.url_from_sandbox(child.mcp_url), + sandbox.url_from_sandbox(child.base_url)) for child in started) + await self._write_file(sandbox, DOCKER_COMPOSE_PATH, compose(external_children=external)) + await self._compose_up(sandbox) # Wait for containers to start await asyncio.sleep(10) @@ -956,6 +978,7 @@ async def _deploy_via_containers( memory_mb: int | None = None, attribution: Optional[Attribution] = None, mcp_server_name: str | None = None, + children: "Callable[[Optional[str]], Awaitable[list[ExternalChild]]] | None" = None, ) -> DeployedGateway: from agent_env.env.env import Env from agent_env.config import gateway_env_id, get_config @@ -1010,7 +1033,10 @@ async def _deploy_via_containers( for cfg, art in zip(mcp_servers, mcp_server_images) ] aux_coros = [self._provision_sidecar(deploy, spec) for spec in sidecar_specs] - all_results = await asyncio.gather(*mcp_coros, *aux_coros, return_exceptions=True) + # The children start beside them; the gateway, created last, has no address to give them. + child_coros = [children(None)] if children is not None else [] + all_results = await asyncio.gather(*mcp_coros, *aux_coros, *child_coros, return_exceptions=True) + external: list[ExternalChild] = [] mcp_results: list[tuple[str, "Sandbox"]] = [] pgweb_sb = None @@ -1025,6 +1051,8 @@ async def _deploy_via_containers( environment_name, mcp_sb = r self._environment_sandboxes[environment_name] = mcp_sb mcp_results.append((environment_name, mcp_sb)) + elif i >= len(mcp_coros) + len(aux_coros): + external = r else: spec = sidecar_specs[i - len(mcp_coros)] if spec.name == PGWEB_SERVICE_NAME: @@ -1047,8 +1075,10 @@ async def _deploy_via_containers( # Step 3: gateway sandbox (HTTPS) with full MCP URLs in env logger.info(f"Provisioning gateway from {gateway_env.docker_image_artifact.image_name}...") gateway_env_vars = { - "INTERNAL_MCP_SERVERS": ",".join(f"{name}={url}" for name, url in internal_servers_by_name.items()), - "REST_PROXY_URLS": ",".join(f"mcp-{name}={url.removesuffix('/mcp')}" for name, url in internal_servers_by_name.items()), + "INTERNAL_MCP_SERVERS": ",".join([*(f"{name}={url}" for name, url in internal_servers_by_name.items()), + *(f"{c.name}={sandbox_provider.url_from_sandbox(c.mcp_url)}" for c in external)]), + "REST_PROXY_URLS": ",".join([*(f"mcp-{name}={url.removesuffix('/mcp')}" for name, url in internal_servers_by_name.items()), + *(f"{c.name}={sandbox_provider.url_from_sandbox(c.base_url)}" for c in external)]), "GATEWAY_MODE": gateway_mode.value, "SERVICE_DB_URL": self._state_provider.base_url(state_instance), "MCP_SERVER_NAME": mcp_server_name or DEFAULT_MCP_SERVER_NAME, @@ -1387,6 +1417,7 @@ async def _deploy_gateway( sidecars: list[SidecarConfig] | None = None, mcp_server_name: str | None = None, attribution: Optional[Attribution] = None, + children: "Callable[[Optional[str]], Awaitable[list[ExternalChild]]] | None" = None, ) -> DeployedGateway: """One gateway deploy on one (unchained) sandbox provider: a VM on one that creates VMs, else a container per server on its private network.""" @@ -1411,7 +1442,7 @@ async def _deploy_gateway( sandbox_provider, mcp_servers, mcp_server_images, gateway_port=gateway_port, website_configs=website_configs, gateway_mode=gateway_mode, ttl_seconds=ttl_seconds, disk_size_gb=disk_size_gb, - cpu=cpu, memory_mb=memory_mb, mcp_server_name=mcp_server_name, **deploy_kwargs, + cpu=cpu, memory_mb=memory_mb, mcp_server_name=mcp_server_name, children=children, **deploy_kwargs, ) earlier_sandbox = self._sandbox try: @@ -1420,7 +1451,7 @@ async def _deploy_gateway( gateway_port=gateway_port, website_configs=website_configs, website_images=website_images, gateway_mode=gateway_mode, ttl_seconds=ttl_seconds, disk_size_gb=disk_size_gb, cpu=cpu, memory_mb=memory_mb, existing_sandbox=existing_sandbox, sidecars=sidecars, - mcp_server_name=mcp_server_name, **deploy_kwargs, + mcp_server_name=mcp_server_name, children=children, **deploy_kwargs, ) except BaseException: await self._terminate_new_sandbox(earlier_sandbox=earlier_sandbox, existing_sandbox=existing_sandbox) diff --git a/tst/integration/computer/multi_env_computers_test.py b/tst/integration/computer/multi_env_computers_test.py new file mode 100644 index 000000000..150f2093f --- /dev/null +++ b/tst/integration/computer/multi_env_computers_test.py @@ -0,0 +1,231 @@ +"""The desktop example's computer as a child env of a multi env beside an MCP server, on the local backend. + +The deploy_env step deploys each computer on a sandbox of its own and the gateway in front of them all. Through the +gateway's one /mcp an agent sees the server's tools and each computer's under its name, takes screenshots by those names, +and a role rule narrows them as it would a server's; /svc// reaches the computer. A later process reattaches the +computers from the multi env's record, and the run's teardown leaves nothing up. Two computers keep serving through a +computer's restart and the gateway's, a failed redeploy leaves the earlier deployment serving, and a computer that fails +mid-deploy, or an entry the multi env refuses, leaves nothing up. Needs Docker and the local registry on localhost:5000.""" + +import asyncio +import json +import re +import uuid + +import httpx +import pytest +from agentenv_protocol.tool_access import (DISABLE, DISABLE_TOOL_EXTENSION_URI, ENABLE, ENABLE_TOOL_EXTENSION_URI, + WILDCARD) +from agentenv_protocol.tool_context import DEFAULT_ROLE +from agentenv_protocol.types import WELL_KNOWN_PATH +from mcp import ClientSession +from mcp.client.streamable_http import streamable_http_client + +from agent_env.env import Env +from agent_env.env.envs.computer.env import COMPUTER_TOOLS, ComputerEnv +from agent_env.env.envs.mcp_server import MCPServerEnv +from agent_env.env.envs.multi_env import MultiEnv +from agent_env.providers.env_providers.env_gateway_provider import EnvironmentGatewayProvider +from agent_env.providers.sandbox_providers.local_docker.provider import LocalSandboxProvider +from agent_env.store.routing import namespace_routing +from agent_env.task.teardown import teardown_run +from agent_env.task_step.context import TaskStepContext +from agent_env.task_step.task_steps.deploy_env import DeployEnvTaskStep +from tst.integration.env.envs.server_env_local_test import _put_items_image +from tst.integration.store.local_parallel_deploy_test import _docker, _seed_bootstrap_envs + +pytestmark = [pytest.mark.integration, pytest.mark.int_test_slow] + +UNPREFIXED = re.compile(r"^computer_") +CONTAINER = {"sandbox_type": "local", "env_params": {"form": "container"}} + + +@pytest.fixture(scope="module") +def items(desktop): + """The gateway's and service-db's envs, and the items MCP server under a local id, since a multi env naming the + desktop's local id must be local too and a store's id can't reference a local one.""" + with namespace_routing(): + _seed_bootstrap_envs() + uid = uuid.uuid4().hex[:8] + return MCPServerEnv.put(id=f"@local/~/office-{uid}/items", environment_name="items", + docker_image_artifact=_put_items_image(f"office-items-{uid}")) + + +def _multi(items, *computers) -> MultiEnv: + return MultiEnv.put(id=f"@local/~/office-{uuid.uuid4().hex[:8]}/office", mcp_server_envs=[items], + computer_envs=list(computers), name="office") + + +async def _tools(deployed) -> tuple[set[str], bool]: + """The tools the gateway lists to the default role, and whether a screenshot by the desktop's name answered.""" + async with streamable_http_client(deployed.mcp_url) as (read, write, _): + async with ClientSession(read, write) as session: + await session.initialize() + names = {tool.name for tool in (await session.list_tools()).tools} + shot = await session.call_tool("desktop_computer_screenshot", {}) if "desktop_computer_screenshot" in names else None + return names, shot is not None and not shot.isError and any(part.type == "image" for part in shot.content) + + +async def _answers(deployed, tools: list[str], *, until: bool = True, tries: int = 40) -> dict[str, bool]: + """Whether each of ``tools`` answers through the gateway, called again every 3 s until all answer, or with + ``until=False``, once.""" + answered: dict[str, bool] = {} + for _ in range(tries if until else 1): + try: + async with streamable_http_client(deployed.mcp_url) as (read, write, _): + async with ClientSession(read, write) as session: + await session.initialize() + answered = {tool: not (await session.call_tool(tool, {})).isError for tool in tools} + except Exception: # noqa: BLE001 - the gateway restarting + answered = dict.fromkeys(tools, False) + if all(answered.values()) or not until: + return answered + await asyncio.sleep(3) + return answered + + +def _containers(sandbox_id: str) -> list[str]: + return _docker("ps", "-aq", "--filter", f"name=agent-{sandbox_id}").stdout.split() + + +def _ours() -> set[str]: + """The containers local sandboxes run: computers' and gateway stacks'.""" + return {name for name in _docker("ps", "-a", "--format", "{{.Names}}").stdout.split() if name.startswith("agent-")} + + +def _gateway(deployed) -> str: + return next(name for name in _ours() if name.endswith("-gateway-1") and deployed.sandbox_id.removeprefix("local-") in name) + + +@pytest.mark.asyncio +async def test_a_computer_in_a_multi_env_is_served_through_its_gateway_under_its_name_and_torn_down_with_it(desktop, items): + with namespace_routing(): + office = _multi(items, Env.get(desktop.id)) + step = DeployEnvTaskStep(id="office", version=None, env_id=office.id, sandbox_type="local", ttl_seconds=900, + child_envs={"desktop": CONTAINER}) + assert step.preflight() == [] + context = TaskStepContext() + try: + [deployed] = (await step.execute(context)).deployed_envs + computer = deployed.child_envs["desktop"] + listed, shot = await _tools(deployed) + async with httpx.AsyncClient(timeout=30) as client: + card = (await client.get(f"{deployed.gateway_url}/svc/desktop{WELL_KNOWN_PATH}")).json() + await deployed.invoke(DISABLE_TOOL_EXTENSION_URI, DISABLE, {"role": DEFAULT_ROLE, "tools": [WILDCARD]}) + await deployed.invoke(ENABLE_TOOL_EXTENSION_URI, ENABLE, {"role": DEFAULT_ROLE, + "tools": ["desktop_computer_screenshot"]}) + narrowed, narrowed_shot = await _tools(deployed) + reattached = await Env.from_instance_id(deployed.instance_id) + up = _containers(computer["sandbox_id"]) + finally: + report = await teardown_run(context) + + assert not report.failed + assert deployed.get_child_env_card("desktop") is not None and card["name"] == "desktop" + assert "list_items" in listed and "desktop_computer_screenshot" in listed and shot + assert {name for name in listed if "computer_" in name} <= {f"desktop_{tool}" for tool in COMPUTER_TOOLS} + assert not any(UNPREFIXED.match(name) for name in listed) + assert narrowed == {"desktop_computer_screenshot"} and narrowed_shot + assert deployed.sandbox_ids["local"] == {"desktop": computer["sandbox_id"]} and up + assert [env._deployed.sandbox_id for env in reattached.computer_envs] == [computer["sandbox_id"]] + assert _containers(computer["sandbox_id"]) == [] + assert json.dumps(deployed.child_envs) # the record stores as JSON + + +@pytest.mark.asyncio +async def test_two_computers_keep_serving_through_restarts_and_a_failed_redeploy_and_close_ends_them(desktop, items, + monkeypatch): + """One deployment, to keep the tier's time: two computers side by side, the desktop's container killed and started + again, the gateway restarted, then a redeploy of the same env object whose gateway fails, which leaves this + deployment as it was; close() ends it all.""" + every = ["list_items", "desktop_computer_screenshot", "laptop_computer_screenshot"] + before = _ours() + with namespace_routing(): + laptop = ComputerEnv.put(id=f"{desktop.id}-laptop", computer=desktop.computer, driver=desktop.driver, + environment_name="laptop") + env = Env.get(_multi(items, Env.get(desktop.id), laptop).id) + try: + deployed = await env.deploy(sandbox_type="local", ttl_seconds=900, + child_envs={"desktop": CONTAINER, "laptop": CONTAINER}) + desktop_box = f"agent-{deployed.child_envs['desktop']['sandbox_id']}" + both = await _answers(deployed, every) + + _docker("kill", desktop_box) + killed = await _answers(deployed, every, until=False) + _docker("start", desktop_box) + started = await _answers(deployed, every) + _docker("restart", _gateway(deployed)) + restarted = await _answers(deployed, every) + + deployed_before = _ours() + real = EnvironmentGatewayProvider._compose_up + + async def no_gateway(self, sandbox, args=""): + if not args: + raise RuntimeError("the gateway didn't start") + return await real(self, sandbox, args) + + with monkeypatch.context() as patch: + patch.setattr(EnvironmentGatewayProvider, "_compose_up", no_gateway) + with pytest.raises(RuntimeError, match="the gateway didn't start"): + await env.deploy(sandbox_type="local", ttl_seconds=900, + child_envs={"desktop": CONTAINER, "laptop": CONTAINER}) + after_failure = _ours() + still = await _answers(deployed, every) + kept = [computer._deployed.sandbox_id for computer in env.computer_envs] + finally: + await env.close() + + assert all(both.values()), both + assert killed == {"list_items": True, "desktop_computer_screenshot": False, "laptop_computer_screenshot": True} + assert all(started.values()) and all(restarted.values()), (started, restarted) + assert after_failure == deployed_before and all(still.values()), (after_failure - deployed_before, still) + assert kept == [deployed.child_envs[name]["sandbox_id"] for name in ("desktop", "laptop")] + assert _ours() == before + + +@pytest.mark.asyncio +async def test_a_computer_that_fails_mid_deploy_fails_the_deploy_and_leaves_nothing_up(desktop, items, monkeypatch): + async def refuse(self, deployed): + raise RuntimeError("the computer's tools couldn't be applied") + + before = _ours() + monkeypatch.setattr(ComputerEnv, "_give_tools", refuse) + with namespace_routing(): + office = _multi(items, Env.get(desktop.id)) + context = TaskStepContext() + with pytest.raises(RuntimeError, match="the computer's tools couldn't be applied"): + await DeployEnvTaskStep(id="office", version=None, env_id=office.id, sandbox_type="local", ttl_seconds=600, + child_envs={"desktop": CONTAINER}).execute(context) + + assert context.deployed_envs == [] and _ours() == before + + +@pytest.mark.asyncio +async def test_a_computer_entry_the_multi_env_refuses_makes_no_sandbox(desktop, items, monkeypatch): + made = [] + for name in ("create_sandbox", "create_vm", "create_container"): + monkeypatch.setattr(LocalSandboxProvider, name, lambda *args, _name=name, **kwargs: made.append(_name)) + with namespace_routing(): + office = _multi(items, Env.get(desktop.id)) + refused = [ + ({"desktop": {**CONTAINER, "env_params": {"site_routing": True}}}, + "child_envs.desktop: env_params.site_routing: a computer in a multi env doesn't route sites yet; deploy it " + "beside the multi env to route them"), + ({"desktop": {"tools": "standard"}}, + "child_envs.desktop: an entry is a table of sandbox_type, cpu, memory_mb, disk_size_gb, env_params, not tools"), + ] + for child_envs, problem in refused: + step = DeployEnvTaskStep(id="office", version=None, env_id=office.id, sandbox_type="local", ttl_seconds=600, + child_envs=child_envs) + assert step.preflight() == [f"deploy_env 'office': {problem}"] + with pytest.raises(ValueError, match=re.escape(problem)): + await step.execute(TaskStepContext()) + + monkeypatch.setattr(LocalSandboxProvider, "REQUEST_HEADERS", {"*.example": {"X-Token": "secret"}}) + [problem] = DeployEnvTaskStep(id="office", version=None, env_id=office.id, sandbox_type="local", + ttl_seconds=600).preflight() + + assert "takes credentials on each request to a sandbox's URL" in problem + assert "set child_envs.desktop.sandbox_type to a sandbox type whose URLs take none" in problem + assert made == [] diff --git a/tst/integration/slow_durations.json b/tst/integration/slow_durations.json index 9ecdc197d..c6eff13d1 100644 --- a/tst/integration/slow_durations.json +++ b/tst/integration/slow_durations.json @@ -7,37 +7,41 @@ "tst/integration/env/gateway/gateway_test.py" ], "seconds": { - "packages/agentenv-protocol/tests/test_a2a_agent.py": 1.1, + "packages/agentenv-protocol/tests/test_a2a_agent.py": 0.9, "packages/agentenv-protocol/tests/test_a2a_agent_examples.py": 0.1, - "packages/agentenv-protocol/tests/test_a2a_cdp_config.py": 0.2, - "packages/agentenv-protocol/tests/test_a2a_object_transfers.py": 0.5, - "packages/agentenv-protocol/tests/test_a2a_peer_agents.py": 4.0, - "packages/agentenv-protocol/tests/test_a2a_proxy.py": 9.3, - "packages/agentenv-protocol/tests/test_a2a_staging.py": 1.6, + "packages/agentenv-protocol/tests/test_a2a_cdp_config.py": 0.1, + "packages/agentenv-protocol/tests/test_a2a_object_transfers.py": 0.3, + "packages/agentenv-protocol/tests/test_a2a_peer_agents.py": 3.8, + "packages/agentenv-protocol/tests/test_a2a_proxy.py": 8.8, + "packages/agentenv-protocol/tests/test_a2a_staging.py": 1.3, "packages/agentenv-protocol/tests/test_a2a_trajectory_log.py": 0.3, - "packages/agentenv-protocol/tests/test_agent_env_environment.py": 0.4, - "packages/agentenv-protocol/tests/test_browser_cdp.py": 0.4, + "packages/agentenv-protocol/tests/test_agent_env_environment.py": 0.3, + "packages/agentenv-protocol/tests/test_browser_cdp.py": 0.7, + "packages/agentenv-protocol/tests/test_browser_data.py": 0.3, + "packages/agentenv-protocol/tests/test_browser_state.py": 0.1, "packages/agentenv-protocol/tests/test_client.py": 0.1, - "packages/agentenv-protocol/tests/test_computer_app_data.py": 1.8, - "packages/agentenv-protocol/tests/test_computer_app_server.py": 6.0, - "packages/agentenv-protocol/tests/test_computer_conformance.py": 139.5, + "packages/agentenv-protocol/tests/test_computer_app_data.py": 1.9, + "packages/agentenv-protocol/tests/test_computer_app_server.py": 7.5, + "packages/agentenv-protocol/tests/test_computer_conformance.py": 162.4, "packages/agentenv-protocol/tests/test_computer_conformance_checks.py": 1.1, "packages/agentenv-protocol/tests/test_computer_conformance_page.py": 44.7, - "packages/agentenv-protocol/tests/test_computer_conformance_recording.py": 36.2, - "packages/agentenv-protocol/tests/test_computer_dataplane.py": 2.8, + "packages/agentenv-protocol/tests/test_computer_conformance_recording.py": 33.1, + "packages/agentenv-protocol/tests/test_computer_dataplane.py": 2.6, "packages/agentenv-protocol/tests/test_computer_declare.py": 0.9, - "packages/agentenv-protocol/tests/test_computer_driver.py": 2.8, - "packages/agentenv-protocol/tests/test_computer_extensions.py": 5.9, - "packages/agentenv-protocol/tests/test_computer_frames.py": 3.8, - "packages/agentenv-protocol/tests/test_computer_page.py": 1.7, - "packages/agentenv-protocol/tests/test_computer_queue.py": 13.2, - "packages/agentenv-protocol/tests/test_computer_recording.py": 30.4, + "packages/agentenv-protocol/tests/test_computer_driver.py": 2.7, + "packages/agentenv-protocol/tests/test_computer_extensions.py": 5.1, + "packages/agentenv-protocol/tests/test_computer_frames.py": 4.3, + "packages/agentenv-protocol/tests/test_computer_macos.py": 0.1, + "packages/agentenv-protocol/tests/test_computer_page.py": 1.3, + "packages/agentenv-protocol/tests/test_computer_queue.py": 15.7, + "packages/agentenv-protocol/tests/test_computer_recording.py": 31.9, "packages/agentenv-protocol/tests/test_computer_seed.py": 0.0, - "packages/agentenv-protocol/tests/test_computer_serve.py": 0.3, - "packages/agentenv-protocol/tests/test_computer_spaces.py": 0.9, - "packages/agentenv-protocol/tests/test_computer_svc_forward.py": 2.5, + "packages/agentenv-protocol/tests/test_computer_serve.py": 0.2, + "packages/agentenv-protocol/tests/test_computer_spaces.py": 1.0, + "packages/agentenv-protocol/tests/test_computer_svc_forward.py": 3.0, + "packages/agentenv-protocol/tests/test_computer_tool_prefix.py": 2.0, "packages/agentenv-protocol/tests/test_control_token.py": 0.0, - "packages/agentenv-protocol/tests/test_data_objects.py": 2.0, + "packages/agentenv-protocol/tests/test_data_objects.py": 3.0, "packages/agentenv-protocol/tests/test_errors.py": 0.2, "packages/agentenv-protocol/tests/test_extension_methods.py": 0.0, "packages/agentenv-protocol/tests/test_intake.py": 0.0, @@ -48,59 +52,133 @@ "packages/agentenv-protocol/tests/test_tool_client.py": 1.0, "packages/agentenv-protocol/tests/test_tool_context.py": 0.1, "packages/agentenv-protocol/tests/test_tool_context_fastmcp.py": 0.1, - "packages/agentenv-protocol/tests/test_tool_context_injection.py": 0.3, - "packages/agentenv-protocol/tests/test_website_browser.py": 2.3, + "packages/agentenv-protocol/tests/test_tool_context_injection.py": 0.4, + "packages/agentenv-protocol/tests/test_website_api.py": 0.6, + "packages/agentenv-protocol/tests/test_website_browser.py": 3.7, + "packages/agentenv-protocol/tests/test_website_conformance.py": 16.8, + "packages/agentenv-protocol/tests/test_website_environment.py": 8.1, + "packages/agentenv-protocol/tests/test_website_mcp.py": 1.9, + "packages/agentenv-protocol/tests/test_website_notes_example.py": 1.8, + "packages/agentenv-protocol/tests/test_website_readiness.py": 0.1, + "tst/installer/test_container_journey.py": 217.3, + "tst/installer/test_plugin_changes.py::test_a_bare_directory_that_builds_as_agent_env_never_replaces_it[pipx]": 12.8, + "tst/installer/test_plugin_changes.py::test_a_bare_directory_that_builds_as_agent_env_never_replaces_it[uv-project]": 34.1, + "tst/installer/test_plugin_changes.py::test_a_bare_directory_that_builds_as_agent_env_never_replaces_it[uv-tool]": 15.2, + "tst/installer/test_plugin_changes.py::test_a_bare_directory_that_builds_as_agent_env_never_replaces_it[venv]": 40.9, + "tst/installer/test_plugin_changes.py::test_a_change_made_elsewhere_while_add_waits_for_confirmation_is_not_undone": 13.7, + "tst/installer/test_plugin_changes.py::test_a_newer_wheel_upgrades_the_installed_plugin[pipx]": 33.9, + "tst/installer/test_plugin_changes.py::test_a_newer_wheel_upgrades_the_installed_plugin[uv-project]": 40.2, + "tst/installer/test_plugin_changes.py::test_a_newer_wheel_upgrades_the_installed_plugin[uv-tool]": 31.6, + "tst/installer/test_plugin_changes.py::test_a_newer_wheel_upgrades_the_installed_plugin[venv]": 69.2, + "tst/installer/test_plugin_changes.py::test_a_package_added_next_to_a_plugin_is_removed_the_same_way": 28.2, + "tst/installer/test_plugin_changes.py::test_a_plugin_survives_the_installers_own_rebuild_and_is_removed[pipx]": 54.1, + "tst/installer/test_plugin_changes.py::test_a_plugin_survives_the_installers_own_rebuild_and_is_removed[uv-project]": 21.8, + "tst/installer/test_plugin_changes.py::test_a_plugin_survives_the_installers_own_rebuild_and_is_removed[uv-tool]": 69.1, + "tst/installer/test_plugin_changes.py::test_a_plugin_survives_the_installers_own_rebuild_and_is_removed[venv]": 76.3, + "tst/installer/test_plugin_changes.py::test_a_plugin_that_conflicts_with_an_installed_one_is_rolled_back[pipx]": 47.0, + "tst/installer/test_plugin_changes.py::test_a_plugin_that_conflicts_with_an_installed_one_is_rolled_back[uv-project]": 31.7, + "tst/installer/test_plugin_changes.py::test_a_plugin_that_conflicts_with_an_installed_one_is_rolled_back[uv-tool]": 40.4, + "tst/installer/test_plugin_changes.py::test_a_plugin_that_conflicts_with_an_installed_one_is_rolled_back[venv]": 56.1, + "tst/installer/test_plugin_changes.py::test_a_plugin_that_selects_a_shared_config_file_is_still_blocked_by_it[uv-tool]": 24.4, + "tst/installer/test_plugin_changes.py::test_a_plugin_that_selects_a_shared_config_file_is_still_blocked_by_it[venv]": 42.5, + "tst/installer/test_plugin_changes.py::test_a_plugin_that_sets_the_config_on_import_is_reported[uv-tool]": 40.4, + "tst/installer/test_plugin_changes.py::test_a_plugin_that_sets_the_config_on_import_is_reported[venv]": 39.0, + "tst/installer/test_plugin_changes.py::test_a_plugin_whose_bundled_config_is_in_effect_can_be_removed[uv-tool]": 50.7, + "tst/installer/test_plugin_changes.py::test_a_plugin_whose_bundled_config_is_in_effect_can_be_removed[venv]": 46.5, + "tst/installer/test_plugin_changes.py::test_a_plugin_whose_root_option_breaks_startup_can_still_be_removed[uv-tool]": 35.6, + "tst/installer/test_plugin_changes.py::test_a_plugin_whose_root_option_breaks_startup_can_still_be_removed[venv]": 52.9, + "tst/installer/test_plugin_changes.py::test_a_project_tool_that_owns_the_environment_is_given_the_command_and_nothing_runs[hatch-Hatch has no command for this]": 33.4, + "tst/installer/test_plugin_changes.py::test_a_project_tool_that_owns_the_environment_is_given_the_command_and_nothing_runs[pdm-pdm add]": 29.4, + "tst/installer/test_plugin_changes.py::test_a_project_tool_that_owns_the_environment_is_given_the_command_and_nothing_runs[poetry-poetry add]": 33.0, + "tst/installer/test_plugin_changes.py::test_a_second_change_waits_for_the_first_to_finish": 34.9, + "tst/installer/test_plugin_changes.py::test_a_uv_project_removes_a_plugin_from_the_group_that_declares_it": 23.0, + "tst/installer/test_plugin_changes.py::test_a_uv_project_with_its_environment_elsewhere_keeps_the_plugin_through_uv_sync[False]": 19.3, + "tst/installer/test_plugin_changes.py::test_a_uv_project_with_its_environment_elsewhere_keeps_the_plugin_through_uv_sync[True]": 24.5, + "tst/installer/test_plugin_changes.py::test_a_uv_tool_whose_index_comes_from_its_config_takes_one_change_after_another": 74.5, + "tst/installer/test_plugin_changes.py::test_a_uv_workspace_removes_a_plugin_from_the_member_that_declares_it": 22.9, + "tst/installer/test_plugin_changes.py::test_a_virtual_uv_workspace_adds_the_plugin_to_the_member_that_declares_agent_env": 25.7, + "tst/installer/test_plugin_changes.py::test_adding_a_plugin_by_its_bare_name_keeps_the_version_the_tool_pins": 39.5, + "tst/installer/test_plugin_changes.py::test_agent_env_itself_is_never_added_or_removed[uv-tool]": 11.4, + "tst/installer/test_plugin_changes.py::test_agent_env_itself_is_never_added_or_removed[venv]": 38.2, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[pipx-broken-toy_broken is failed]": 21.0, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[pipx-clash-deploy_env is skipped]": 51.1, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[pipx-not-a-plugin-not an agent-env plugin]": 18.7, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[uv-project-broken-toy_broken is failed]": 23.4, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[uv-project-clash-deploy_env is skipped]": 16.5, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[uv-project-not-a-plugin-not an agent-env plugin]": 18.7, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[uv-tool-broken-toy_broken is failed]": 19.4, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[uv-tool-clash-deploy_env is skipped]": 22.3, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[uv-tool-not-a-plugin-not an agent-env plugin]": 32.9, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[venv-broken-toy_broken is failed]": 50.4, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[venv-clash-deploy_env is skipped]": 29.9, + "tst/installer/test_plugin_changes.py::test_an_add_that_does_not_take_effect_restores_the_environment_exactly[venv-not-a-plugin-not an agent-env plugin]": 44.6, + "tst/installer/test_plugin_changes.py::test_ctrl_c_lets_the_installer_finish_and_then_restores": 18.1, + "tst/installer/test_plugin_changes.py::test_read_only_site_packages_are_refused": 30.5, + "tst/installer/test_plugin_changes.py::test_remove_is_blocked_while_the_config_names_its_sandbox_provider[uv-tool]": 26.0, + "tst/installer/test_plugin_changes.py::test_remove_is_blocked_while_the_config_names_its_sandbox_provider[venv]": 63.1, + "tst/installer/test_plugin_changes.py::test_removing_a_plugin_names_and_checks_the_plugins_that_go_with_it[uv-project]": 38.4, + "tst/installer/test_plugin_changes.py::test_removing_a_plugin_names_and_checks_the_plugins_that_go_with_it[uv-tool]": 55.5, + "tst/installer/test_wheel.py": 0.0, "tst/integration/agent/a2a_agent/a2a_agent_test.py": 0.0, "tst/integration/agent/a2a_agent/agent_triggers_e2e_test.py": 0.0, "tst/integration/agent/proxy_modal_vm_test.py": 0.0, - "tst/integration/artifact/artifacts/docker_image_artifact_test.py": 20.0, - "tst/integration/cli/bundle_init_images_test.py": 23.6, - "tst/integration/cli/bundle_register_test.py": 44.5, + "tst/integration/artifact/artifacts/docker_image_artifact_test.py": 21.7, + "tst/integration/cli/bundle_init_images_test.py": 22.2, + "tst/integration/cli/bundle_register_test.py": 45.5, "tst/integration/cli/cli_test.py": 60.4, - "tst/integration/cli/run_bundle_built_agents_test.py": 43.8, - "tst/integration/cli/run_bundle_built_envs_test.py::test_a_multi_whose_children_name_one_container_is_refused_before_anything_is_built_or_written": 0.3, - "tst/integration/cli/run_bundle_built_envs_test.py::test_a_multi_whose_servers_share_a_tool_name_is_refused_at_deploy_naming_the_tool_and_both_servers": 26.9, - "tst/integration/cli/run_bundle_built_envs_test.py::test_a_script_on_an_envs_host_reaches_it_and_its_mcp_endpoint_at_the_addresses_its_input_gives[gateway]": 35.6, - "tst/integration/cli/run_bundle_built_envs_test.py::test_a_script_on_an_envs_host_reaches_it_and_its_mcp_endpoint_at_the_addresses_its_input_gives[server]": 11.4, - "tst/integration/cli/run_bundle_built_envs_test.py::test_a_server_that_crashes_on_start_fails_its_deploy_naming_it_and_ending_with_what_it_printed": 36.6, - "tst/integration/cli/run_bundle_built_envs_test.py::test_a_stored_mcp_task_imports_as_a_bundle_that_runs_through_the_gateway": 66.1, - "tst/integration/cli/run_bundle_built_envs_test.py::test_a_universe_composed_every_way_seeds_each_server_of_a_multi_and_a_shared_one_seeds_its_server": 52.5, - "tst/integration/cli/run_bundle_built_envs_test.py::test_an_env_folder_is_built_named_by_its_card_deployed_and_rebuilt_only_when_it_changes": 16.4, - "tst/integration/cli/run_bundle_built_envs_test.py::test_an_output_a_bundles_task_wrote_is_written_under_the_folder_that_imports_it": 28.0, - "tst/integration/cli/run_bundle_built_envs_test.py::test_each_kind_of_bundle_env_deploys_through_the_gateway_and_a_child_edit_rewrites_its_multi": 167.3, - "tst/integration/cli/run_bundle_built_envs_test.py::test_environments_and_a_universe_written_from_a_bundle_load_into_an_env_through_the_gateway": 69.6, - "tst/integration/cli/run_bundle_built_envs_test.py::test_the_shipped_echo_mcp_example_runs_by_name_and_a_rerun_writes_nothing": 68.8, + "tst/integration/cli/run_bundle_browser_use_test.py": 248.0, + "tst/integration/cli/run_bundle_built_agents_test.py": 48.0, + "tst/integration/cli/run_bundle_built_envs_test.py::test_a_multi_whose_children_name_one_container_is_refused_before_anything_is_built_or_written": 0.2, + "tst/integration/cli/run_bundle_built_envs_test.py::test_a_multi_whose_servers_share_a_tool_name_is_refused_at_deploy_naming_the_tool_and_both_servers": 26.1, + "tst/integration/cli/run_bundle_built_envs_test.py::test_a_script_on_an_envs_host_reaches_it_and_its_mcp_endpoint_at_the_addresses_its_input_gives[gateway]": 42.2, + "tst/integration/cli/run_bundle_built_envs_test.py::test_a_script_on_an_envs_host_reaches_it_and_its_mcp_endpoint_at_the_addresses_its_input_gives[server]": 2.5, + "tst/integration/cli/run_bundle_built_envs_test.py::test_a_server_that_crashes_on_start_fails_its_deploy_naming_it_and_ending_with_what_it_printed": 37.9, + "tst/integration/cli/run_bundle_built_envs_test.py::test_a_stored_mcp_task_imports_as_a_bundle_that_runs_through_the_gateway": 52.3, + "tst/integration/cli/run_bundle_built_envs_test.py::test_a_universe_composed_every_way_seeds_each_server_of_a_multi_and_a_shared_one_seeds_its_server": 48.6, + "tst/integration/cli/run_bundle_built_envs_test.py::test_an_env_folder_is_built_named_by_its_card_deployed_and_rebuilt_only_when_it_changes": 20.4, + "tst/integration/cli/run_bundle_built_envs_test.py::test_an_output_a_bundles_task_wrote_is_written_under_the_folder_that_imports_it": 28.3, + "tst/integration/cli/run_bundle_built_envs_test.py::test_each_kind_of_bundle_env_deploys_through_the_gateway_and_a_child_edit_rewrites_its_multi": 158.3, + "tst/integration/cli/run_bundle_built_envs_test.py::test_environments_and_a_universe_written_from_a_bundle_load_into_an_env_through_the_gateway": 75.4, + "tst/integration/cli/run_bundle_built_envs_test.py::test_the_shipped_echo_mcp_example_runs_by_name_and_a_rerun_writes_nothing": 66.9, "tst/integration/cli/run_bundle_built_envs_test.py::test_the_shipped_mail_mcp_example_runs_and_a_task_outside_a_bundle_deploys_its_env_by_its_alias": 55.6, - "tst/integration/cli/run_bundle_claude_code_install_test.py": 138.8, - "tst/integration/cli/run_bundle_claude_code_test.py": 315.1, - "tst/integration/cli/run_bundle_cli_folder_test.py": 71.7, - "tst/integration/cli/run_bundle_image_folder_test.py": 31.4, - "tst/integration/cli/run_bundle_image_ref_test.py": 30.3, - "tst/integration/cli/run_bundle_installed_agent_test.py": 21.5, - "tst/integration/cli/run_bundle_openhands_test.py": 249.9, - "tst/integration/cli/run_bundle_pydantic_ai_test.py": 98.9, + "tst/integration/cli/run_bundle_claude_code_install_test.py": 120.2, + "tst/integration/cli/run_bundle_claude_code_test.py": 301.7, + "tst/integration/cli/run_bundle_cli_folder_test.py": 80.9, + "tst/integration/cli/run_bundle_image_folder_test.py": 41.0, + "tst/integration/cli/run_bundle_image_ref_test.py": 14.5, + "tst/integration/cli/run_bundle_installed_agent_test.py": 25.4, + "tst/integration/cli/run_bundle_openhands_test.py": 234.0, + "tst/integration/cli/run_bundle_pydantic_ai_test.py": 111.1, "tst/integration/cli/run_bundle_skills_test.py": 25.1, - "tst/integration/cli/run_role_models_test.py": 26.5, - "tst/integration/computer/base_computer_test.py": 83.1, - "tst/integration/computer/browser_computer_test.py": 169.4, + "tst/integration/cli/run_role_models_test.py": 41.2, + "tst/integration/computer/base_computer_test.py": 82.9, + "tst/integration/computer/browser_computer_test.py": 337.3, + "tst/integration/computer/browser_gateway_test.py": 192.9, "tst/integration/computer/builder_modal_vm_test.py": 0.0, - "tst/integration/computer/chromium_app_test.py": 628.3, - "tst/integration/computer/computer_app_test.py::test_a_computers_apps_load_export_and_reset_each_through_its_own_data_plane": 139.8, - "tst/integration/computer/computer_app_test.py::test_an_app_deployed_alone_runs_its_service_on_its_settings_on_a_computer_named_after_it": 90.0, - "tst/integration/computer/computer_app_test.py::test_through_the_drivers_route_a_websocket_reaches_an_apps_server_and_a_20_mb_answer_streams_whole": 381.1, - "tst/integration/computer/computer_app_test.py::test_two_apps_composed_into_one_computer_env_each_run_on_their_own_settings": 142.1, - "tst/integration/computer/computer_env_test.py": 262.8, - "tst/integration/computer/cua_driver_test.py": 186.7, - "tst/integration/computer/desktop_example_test.py": 153.3, - "tst/integration/computer/disk_boot_test.py": 257.0, + "tst/integration/computer/chromium_app_test.py": 723.4, + "tst/integration/computer/computer_app_test.py::test_a_computers_apps_load_export_and_reset_each_through_its_own_data_plane": 162.1, + "tst/integration/computer/computer_app_test.py::test_an_app_deployed_alone_runs_its_service_on_its_settings_on_a_computer_named_after_it_as_its_driver": 81.7, + "tst/integration/computer/computer_app_test.py::test_the_locks_debs_and_wheels_install_from_mounts_and_stay_in_no_layer_of_the_image": 294.7, + "tst/integration/computer/computer_app_test.py::test_through_the_drivers_route_a_websocket_reaches_an_apps_server_and_a_20_mb_answer_streams_whole": 316.5, + "tst/integration/computer/computer_app_test.py::test_two_apps_composed_into_one_computer_env_each_run_on_their_own_settings": 167.1, + "tst/integration/computer/computer_env_test.py": 264.6, + "tst/integration/computer/covered_test.py": 72.9, + "tst/integration/computer/cua_driver_test.py": 147.4, + "tst/integration/computer/desktop_example_test.py": 142.0, + "tst/integration/computer/disk_boot_test.py": 188.4, "tst/integration/computer/disk_modal_vm_test.py": 0.0, - "tst/integration/computer/launcher_test.py": 178.3, - "tst/integration/computer/recording_chaos_test.py": 264.9, - "tst/integration/computer/website_browser_test.py": 367.2, - "tst/integration/env/env_test.py": 14.2, - "tst/integration/env/envs/build_context_local_test.py": 179.8, - "tst/integration/env/envs/multi_env_local_test.py": 122.0, - "tst/integration/env/envs/server_env_local_test.py": 74.2, + "tst/integration/computer/launcher_test.py": 124.1, + "tst/integration/computer/multi_env_computers_test.py": 395.0, + "tst/integration/computer/recording_chaos_test.py": 234.9, + "tst/integration/computer/set_test.py": 152.4, + "tst/integration/computer/tool_prefix_test.py": 187.5, + "tst/integration/computer/website_browser_test.py": 329.6, + "tst/integration/computer/windows_test.py": 0.0, + "tst/integration/env/env_test.py": 14.4, + "tst/integration/env/envs/build_context_local_test.py": 189.5, + "tst/integration/env/envs/multi_env_child_envs_local_test.py": 98.0, + "tst/integration/env/envs/multi_env_local_test.py": 112.7, + "tst/integration/env/envs/server_env_local_test.py": 61.2, "tst/integration/env/envs/server_env_modal_test.py": 0.0, "tst/integration/env/gateway/gateway_test.py::test_airtable_clock_consumer[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_airtable_clock_consumer[boat]": 0.0, @@ -190,7 +268,7 @@ "tst/integration/env/gateway/gateway_test.py::test_calendar_mcp_clock_consumer[scale]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_calendar_mcp_clock_consumer[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_calendar_mcp_clock_consumer[tensorlake]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_cardless_environment_resolves_name_from_environment_name": 34.7, + "tst/integration/env/gateway/gateway_test.py::test_cardless_environment_resolves_name_from_environment_name": 36.7, "tst/integration/env/gateway/gateway_test.py::test_clickup_clock_consumer[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_clickup_clock_consumer[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_clickup_clock_consumer[boxd]": 0.0, @@ -321,7 +399,7 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_autonomous_time_trigger[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_autonomous_time_trigger[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_autonomous_time_trigger[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_autonomous_time_trigger[scale]": 29.1, + "tst/integration/env/gateway/gateway_test.py::test_gateway_autonomous_time_trigger[scale]": 29.3, "tst/integration/env/gateway/gateway_test.py::test_gateway_autonomous_time_trigger[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_autonomous_time_trigger[tensorlake]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_barrier_orders_a_templated_mirror[agent37]": 0.0, @@ -332,11 +410,11 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_barrier_orders_a_templated_mirror[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_barrier_orders_a_templated_mirror[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_barrier_orders_a_templated_mirror[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_barrier_orders_a_templated_mirror[scale]": 28.1, + "tst/integration/env/gateway/gateway_test.py::test_gateway_barrier_orders_a_templated_mirror[scale]": 27.8, "tst/integration/env/gateway/gateway_test.py::test_gateway_barrier_orders_a_templated_mirror[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_barrier_orders_a_templated_mirror[tensorlake]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_changes_name_the_request_behind_a_write_through_the_rest_proxy": 26.3, - "tst/integration/env/gateway/gateway_test.py::test_gateway_changes_name_the_role_behind_each_write": 39.2, + "tst/integration/env/gateway/gateway_test.py::test_gateway_changes_name_the_request_behind_a_write_through_the_rest_proxy": 26.2, + "tst/integration/env/gateway/gateway_test.py::test_gateway_changes_name_the_role_behind_each_write": 26.4, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[boxd]": 0.0, @@ -345,7 +423,7 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[scale]": 36.3, + "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[scale]": 37.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_extension[tensorlake]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_rate_accuracy[agent37]": 0.0, @@ -356,10 +434,10 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_rate_accuracy[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_rate_accuracy[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_rate_accuracy[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_rate_accuracy[scale]": 50.7, + "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_rate_accuracy[scale]": 51.1, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_rate_accuracy[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_clock_rate_accuracy[tensorlake]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_consistent_mode": 41.2, + "tst/integration/env/gateway/gateway_test.py::test_gateway_consistent_mode": 44.5, "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[boxd]": 0.0, @@ -368,7 +446,7 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[scale]": 28.0, + "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[scale]": 28.7, "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_queued_trigger_is_not_reported_settled[tensorlake]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_time_trigger_extension[agent37]": 0.0, @@ -379,7 +457,7 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_time_trigger_extension[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_time_trigger_extension[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_time_trigger_extension[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_time_trigger_extension[scale]": 28.0, + "tst/integration/env/gateway/gateway_test.py::test_gateway_time_trigger_extension[scale]": 28.2, "tst/integration/env/gateway/gateway_test.py::test_gateway_time_trigger_extension[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_time_trigger_extension[tensorlake]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_rearms_after_a_failed_mirror[agent37]": 0.0, @@ -390,7 +468,7 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_rearms_after_a_failed_mirror[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_rearms_after_a_failed_mirror[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_rearms_after_a_failed_mirror[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_rearms_after_a_failed_mirror[scale]": 29.8, + "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_rearms_after_a_failed_mirror[scale]": 30.8, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_rearms_after_a_failed_mirror[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_rearms_after_a_failed_mirror[tensorlake]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_registration_is_fail_loud[agent37]": 0.0, @@ -401,7 +479,7 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_registration_is_fail_loud[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_registration_is_fail_loud[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_registration_is_fail_loud[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_registration_is_fail_loud[scale]": 26.1, + "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_registration_is_fail_loud[scale]": 26.5, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_registration_is_fail_loud[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_trigger_registration_is_fail_loud[tensorlake]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_extension[agent37]": 0.0, @@ -412,13 +490,13 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_extension[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_extension[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_extension[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_extension[scale]": 37.3, + "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_extension[scale]": 37.1, "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_extension[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_extension[tensorlake]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_triggers_nl_executor[modal_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_website_trigger_fires_on_a_request_through_the_website_proxy": 40.2, - "tst/integration/env/gateway/gateway_test.py::test_gateway_with_agentenv_environment": 30.1, - "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_env_including_website": 243.6, + "tst/integration/env/gateway/gateway_test.py::test_gateway_website_trigger_fires_on_a_request_through_the_website_proxy": 66.4, + "tst/integration/env/gateway/gateway_test.py::test_gateway_with_agentenv_environment": 35.5, + "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_env_including_website": 221.5, "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[boxd]": 0.0, @@ -427,12 +505,12 @@ "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[scale]": 188.7, + "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[scale]": 207.7, "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_gateway_with_multi_mcp_server[tensorlake]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_gateway_with_single_mcp_server": 210.2, - "tst/integration/env/gateway/gateway_test.py::test_gateway_with_single_website_env": 204.7, - "tst/integration/env/gateway/gateway_test.py::test_gateway_with_website_env_v1": 41.2, + "tst/integration/env/gateway/gateway_test.py::test_gateway_with_single_mcp_server": 206.0, + "tst/integration/env/gateway/gateway_test.py::test_gateway_with_single_website_env": 224.8, + "tst/integration/env/gateway/gateway_test.py::test_gateway_with_website_env_v1": 48.3, "tst/integration/env/gateway/gateway_test.py::test_github_clock_consumer[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_github_clock_consumer[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_github_clock_consumer[boxd]": 0.0, @@ -565,7 +643,7 @@ "tst/integration/env/gateway/gateway_test.py::test_linear_clock_consumer[scale]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_linear_clock_consumer[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_linear_clock_consumer[tensorlake]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_load_from_snapshot": 41.7, + "tst/integration/env/gateway/gateway_test.py::test_load_from_snapshot": 44.5, "tst/integration/env/gateway/gateway_test.py::test_messaging_clock_consumer[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_messaging_clock_consumer[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_messaging_clock_consumer[boxd]": 0.0, @@ -687,7 +765,7 @@ "tst/integration/env/gateway/gateway_test.py::test_reminder_clock_consumer[scale]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_reminder_clock_consumer[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_reminder_clock_consumer[tensorlake]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_renamed_registration_serves_its_registered_name": 36.2, + "tst/integration/env/gateway/gateway_test.py::test_renamed_registration_serves_its_registered_name": 37.1, "tst/integration/env/gateway/gateway_test.py::test_renpho_clock_consumer[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_renpho_clock_consumer[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_renpho_clock_consumer[boxd]": 0.0, @@ -754,8 +832,8 @@ "tst/integration/env/gateway/gateway_test.py::test_smart_lock_clock_consumer[scale]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_smart_lock_clock_consumer[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_smart_lock_clock_consumer[tensorlake]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_snapshot_agent_state_v1_and_fallback": 35.0, - "tst/integration/env/gateway/gateway_test.py::test_snapshot_cli": 190.6, + "tst/integration/env/gateway/gateway_test.py::test_snapshot_agent_state_v1_and_fallback": 41.4, + "tst/integration/env/gateway/gateway_test.py::test_snapshot_cli": 244.1, "tst/integration/env/gateway/gateway_test.py::test_snowflake_async_virtual_clock[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_snowflake_async_virtual_clock[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_snowflake_async_virtual_clock[boxd]": 0.0, @@ -819,7 +897,7 @@ "tst/integration/env/gateway/gateway_test.py::test_sync_env_clock_step[modal]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_sync_env_clock_step[modal_vm]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_sync_env_clock_step[sail_vm]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_sync_env_clock_step[scale]": 26.6, + "tst/integration/env/gateway/gateway_test.py::test_sync_env_clock_step[scale]": 27.3, "tst/integration/env/gateway/gateway_test.py::test_sync_env_clock_step[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_sync_env_clock_step[tensorlake]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_system_clock_consumer[agent37]": 0.0, @@ -877,8 +955,8 @@ "tst/integration/env/gateway/gateway_test.py::test_trello_clock_consumer[scale]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_trello_clock_consumer[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_trello_clock_consumer[tensorlake]": 0.0, - "tst/integration/env/gateway/gateway_test.py::test_validate_universe_compatibility": 28.4, - "tst/integration/env/gateway/gateway_test.py::test_verify_universe_roundtrip_export_all_v1_and_fallback": 26.5, + "tst/integration/env/gateway/gateway_test.py::test_validate_universe_compatibility": 43.8, + "tst/integration/env/gateway/gateway_test.py::test_verify_universe_roundtrip_export_all_v1_and_fallback": 28.3, "tst/integration/env/gateway/gateway_test.py::test_walmart_clock_consumer[agent37]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_walmart_clock_consumer[boat]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_walmart_clock_consumer[boxd]": 0.0, @@ -945,9 +1023,9 @@ "tst/integration/env/gateway/gateway_test.py::test_zillow_clock_consumer[scale]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_zillow_clock_consumer[tenki]": 0.0, "tst/integration/env/gateway/gateway_test.py::test_zillow_clock_consumer[tensorlake]": 0.0, - "tst/integration/env/task_step/task_steps_test.py": 167.1, - "tst/integration/eval/eval_test.py": 2.7, - "tst/integration/openenv/build_app_test.py": 80.0, + "tst/integration/env/task_step/task_steps_test.py": 177.2, + "tst/integration/eval/eval_test.py": 1.6, + "tst/integration/openenv/build_app_test.py": 77.3, "tst/integration/providers/sandbox_providers/agent37_sandbox_smoke_test.py": 0.0, "tst/integration/providers/sandbox_providers/boat_sandbox_smoke_test.py": 0.0, "tst/integration/providers/sandbox_providers/boxd_sandbox_smoke_test.py": 0.0, @@ -958,45 +1036,47 @@ "tst/integration/providers/sandbox_providers/tenki_sandbox_smoke_test.py": 0.0, "tst/integration/providers/sandbox_providers/tensorlake_sandbox_smoke_test.py": 0.0, "tst/integration/providers/sandbox_providers/vercel_sandbox_smoke_test.py": 0.0, - "tst/integration/providers/sandbox_providers/vm_sandbox_build_test.py": 2.4, - "tst/integration/store/local_parallel_deploy_test.py": 49.1, - "tst/integration/task_step/test_advance_to_next_event_hook_local.py": 104.4, - "tst/integration/task_step/test_agent_on_local_sandbox.py": 18.8, + "tst/integration/providers/sandbox_providers/vm_sandbox_build_test.py": 2.0, + "tst/integration/providers/sandbox_providers/websockets_live_test.py": 0.0, + "tst/integration/store/local_parallel_deploy_test.py": 113.5, + "tst/integration/task_step/test_advance_to_next_event_hook_local.py": 77.6, + "tst/integration/task_step/test_agent_on_local_sandbox.py": 23.7, "tst/integration/task_step/test_enable_docker_e2e.py": 0.0, "tst/integration/task_step/test_multiturn_verifier_delivery.py": 0.0, - "tst/integration/task_step/test_next_env_event_hook_local.py": 166.9, - "tst/integration/task_step/test_prompt_agent_notifications_local.py": 109.6, - "tst/integration/task_step/test_register_env_triggers_local.py": 151.4, - "tst/integration/training/harness_test.py": 69.2, - "tst/integration/training/trl_test.py": 27.5, - "tst/integration/utils/docker/prune_test.py": 5.1, - "tst/unit/a2a_agent/add_skill_test.py": 0.9, - "tst/unit/a2a_agent/alias_get_test.py": 0.3, + "tst/integration/task_step/test_next_env_event_hook_local.py": 124.8, + "tst/integration/task_step/test_prompt_agent_notifications_local.py": 110.6, + "tst/integration/task_step/test_register_env_triggers_local.py": 141.6, + "tst/integration/training/harness_test.py": 32.0, + "tst/integration/training/trl_test.py": 29.0, + "tst/integration/utils/docker/prune_test.py": 7.2, + "tst/unit/a2a_agent/add_skill_test.py": 0.6, + "tst/unit/a2a_agent/alias_get_test.py": 0.8, "tst/unit/a2a_agent/cdp_config_test.py": 0.0, - "tst/unit/a2a_agent/context_only_deploy_test.py": 0.7, + "tst/unit/a2a_agent/context_only_deploy_test.py": 1.0, "tst/unit/a2a_agent/deploy_cleanup_test.py": 0.1, "tst/unit/a2a_agent/negotiate_agent_config_test.py": 0.0, - "tst/unit/a2a_agent/object_transfer_reach_test.py": 0.2, - "tst/unit/a2a_agent/object_transfer_test.py": 0.3, - "tst/unit/a2a_agent/protocol_test.py": 0.2, + "tst/unit/a2a_agent/object_transfer_reach_test.py": 0.1, + "tst/unit/a2a_agent/object_transfer_test.py": 0.2, + "tst/unit/a2a_agent/protocol_test.py": 0.4, "tst/unit/a2a_agent/put_version_test.py": 0.1, "tst/unit/a2a_agent/readable_parts_test.py": 0.1, - "tst/unit/a2a_agent/staging_test.py": 1.8, + "tst/unit/a2a_agent/staging_test.py": 1.9, "tst/unit/a2a_agent/store_test.py": 0.0, - "tst/unit/a2a_agent/test_trajectory_follower.py": 0.7, - "tst/unit/a2a_agent/test_validator_changelog_objects.py": 0.2, + "tst/unit/a2a_agent/test_trajectory_follower.py": 0.6, + "tst/unit/a2a_agent/test_validator_changelog_objects.py": 0.1, "tst/unit/a2a_agent/test_validator_skill_variants.py": 0.1, - "tst/unit/a2a_agent/validator_trajectory_dag_test.py": 0.2, + "tst/unit/a2a_agent/validator_trajectory_dag_test.py": 0.3, "tst/unit/a2a_agent/validator_uri_probes_test.py": 0.0, "tst/unit/a2a_agent/verify_a2a_agent_card_test.py": 0.0, - "tst/unit/agents/claude_code/test_card_contract.py": 1.7, - "tst/unit/agents/claude_code/test_changelog.py": 106.4, + "tst/unit/agents/browser_use/test_browser_use_agent.py": 1.4, + "tst/unit/agents/claude_code/test_card_contract.py": 1.6, + "tst/unit/agents/claude_code/test_changelog.py": 134.9, "tst/unit/agents/claude_code/test_claude_bridge_builtin_tools.py": 0.1, - "tst/unit/agents/claude_code/test_claude_bridge_cancel.py": 9.4, - "tst/unit/agents/claude_code/test_claude_bridge_failure_message.py": 0.3, + "tst/unit/agents/claude_code/test_claude_bridge_cancel.py": 8.2, + "tst/unit/agents/claude_code/test_claude_bridge_failure_message.py": 0.1, "tst/unit/agents/claude_code/test_claude_bridge_live.py": 0.1, "tst/unit/agents/claude_code/test_claude_bridge_model.py": 0.1, - "tst/unit/agents/claude_code/test_claude_bridge_retry.py": 0.5, + "tst/unit/agents/claude_code/test_claude_bridge_retry.py": 0.2, "tst/unit/agents/claude_code/test_claude_bridge_stdin.py": 1.1, "tst/unit/agents/claude_code/test_cli_env.py": 0.2, "tst/unit/agents/claude_code/test_ext_mcp_name.py": 0.0, @@ -1009,516 +1089,534 @@ "tst/unit/agents/claude_code/test_workspace_snapshot.py": 0.2, "tst/unit/agents/codex/test_card_contract.py": 0.1, "tst/unit/agents/codex/test_codex_bridge_events.py": 0.3, - "tst/unit/agents/codex/test_codex_bridge_failure_message.py": 0.3, - "tst/unit/agents/codex/test_codex_bridge_retry.py": 0.5, + "tst/unit/agents/codex/test_codex_bridge_failure_message.py": 0.2, + "tst/unit/agents/codex/test_codex_bridge_retry.py": 0.4, "tst/unit/agents/codex/test_codex_bridge_watchdog.py": 0.3, - "tst/unit/agents/codex/test_codex_builtin_tools.py": 2.0, - "tst/unit/agents/codex/test_codex_executor_outcome.py": 0.2, - "tst/unit/agents/codex/test_codex_snapshot_hardening.py": 0.4, - "tst/unit/agents/codex/test_config_and_mcp.py": 0.3, + "tst/unit/agents/codex/test_codex_builtin_tools.py": 1.8, + "tst/unit/agents/codex/test_codex_executor_outcome.py": 0.1, + "tst/unit/agents/codex/test_codex_snapshot_hardening.py": 0.3, + "tst/unit/agents/codex/test_config_and_mcp.py": 0.1, "tst/unit/agents/codex/test_image_contract.py": 0.1, "tst/unit/agents/codex/test_install.py": 0.1, "tst/unit/agents/codex/test_live_trajectory.py": 0.1, "tst/unit/agents/codex/test_message_contract.py": 0.1, - "tst/unit/agents/codex/test_object_transfer.py": 1.0, - "tst/unit/agents/gemini/test_card_contract.py": 1.3, - "tst/unit/agents/gemini/test_extensions.py": 1.0, + "tst/unit/agents/codex/test_object_transfer.py": 0.8, + "tst/unit/agents/gemini/test_card_contract.py": 1.8, + "tst/unit/agents/gemini/test_extensions.py": 0.3, "tst/unit/agents/gemini/test_gemini_bridge_attribution.py": 0.1, - "tst/unit/agents/gemini/test_gemini_bridge_cancel.py": 5.8, - "tst/unit/agents/gemini/test_gemini_bridge_failure_message.py": 0.5, + "tst/unit/agents/gemini/test_gemini_bridge_cancel.py": 5.7, + "tst/unit/agents/gemini/test_gemini_bridge_failure_message.py": 0.4, "tst/unit/agents/gemini/test_gemini_bridge_live.py": 1.3, - "tst/unit/agents/gemini/test_image_contract.py": 0.2, + "tst/unit/agents/gemini/test_image_contract.py": 0.1, "tst/unit/agents/gemini/test_install.py": 0.1, - "tst/unit/agents/gemini/test_litellm_proxy.py": 0.4, - "tst/unit/agents/gemini/test_message_contract.py": 0.3, - "tst/unit/agents/gemini/test_object_transfer.py": 3.5, - "tst/unit/agents/hermes/test_card_contract.py": 1.6, + "tst/unit/agents/gemini/test_litellm_proxy.py": 0.7, + "tst/unit/agents/gemini/test_message_contract.py": 0.4, + "tst/unit/agents/gemini/test_object_transfer.py": 2.8, + "tst/unit/agents/hermes/test_card_contract.py": 0.9, "tst/unit/agents/hermes/test_held_work.py": 0.8, "tst/unit/agents/hermes/test_hermes_bridge.py": 3.6, - "tst/unit/agents/hermes/test_message_contract.py": 0.4, - "tst/unit/agents/letta_code/test_bridge.py": 0.5, + "tst/unit/agents/hermes/test_message_contract.py": 0.5, + "tst/unit/agents/letta_code/test_bridge.py": 0.6, "tst/unit/agents/opencode/test_card_contract.py": 1.6, "tst/unit/agents/opencode/test_image_contract.py": 0.1, "tst/unit/agents/opencode/test_install.py": 0.1, - "tst/unit/agents/opencode/test_message_contract.py": 0.9, - "tst/unit/agents/opencode/test_object_transfer.py": 0.4, - "tst/unit/agents/opencode/test_opencode_bridge_builtin_tools.py": 0.1, - "tst/unit/agents/opencode/test_opencode_bridge_cancel.py": 5.7, - "tst/unit/agents/opencode/test_opencode_bridge_config.py": 0.1, - "tst/unit/agents/opencode/test_opencode_bridge_events.py": 0.0, + "tst/unit/agents/opencode/test_message_contract.py": 1.1, + "tst/unit/agents/opencode/test_object_transfer.py": 0.3, + "tst/unit/agents/opencode/test_opencode_bridge_builtin_tools.py": 0.3, + "tst/unit/agents/opencode/test_opencode_bridge_cancel.py": 5.6, + "tst/unit/agents/opencode/test_opencode_bridge_config.py": 0.3, + "tst/unit/agents/opencode/test_opencode_bridge_events.py": 0.1, "tst/unit/agents/opencode/test_opencode_bridge_live.py": 1.2, "tst/unit/agents/opencode/test_opencode_bridge_stdin.py": 0.1, "tst/unit/agents/openhands/test_conversation_run.py": 0.1, - "tst/unit/agents/openhands/test_openhands_agent.py": 4.5, + "tst/unit/agents/openhands/test_openhands_agent.py": 4.7, "tst/unit/agents/pi/test_pi_agent.py": 2.5, - "tst/unit/agents/proxy/test_proxy_agent.py": 0.4, + "tst/unit/agents/proxy/test_proxy_agent.py": 0.6, "tst/unit/agents/pydantic_ai/test_pydantic_ai_agent.py": 3.3, "tst/unit/agents/test_host_workdir.py": 0.0, - "tst/unit/agents/test_installed_workspace.py": 0.4, + "tst/unit/agents/test_installed_workspace.py": 0.3, "tst/unit/artifact/cli_artifact_test.py": 0.2, - "tst/unit/artifact/environment_files_test.py": 0.3, + "tst/unit/artifact/environment_files_test.py": 0.4, "tst/unit/artifact/environment_universe_folder_test.py": 0.0, - "tst/unit/artifact/registry_test.py": 0.7, - "tst/unit/artifact/skill_artifact_test.py": 0.2, - "tst/unit/artifact/test_artifact_metadata.py": 0.1, + "tst/unit/artifact/registry_test.py": 1.2, + "tst/unit/artifact/skill_artifact_test.py": 0.3, + "tst/unit/artifact/test_artifact_metadata.py": 0.2, "tst/unit/artifact/test_artifact_put.py": 0.0, - "tst/unit/artifact/test_computer_artifact.py": 0.7, - "tst/unit/artifact/test_docker_image_build_context.py": 0.3, + "tst/unit/artifact/test_computer_artifact.py": 0.9, + "tst/unit/artifact/test_docker_image_build_context.py": 0.5, "tst/unit/artifact/test_docker_image_github_clone.py": 0.1, "tst/unit/artifact/test_docker_image_github_push.py": 0.1, "tst/unit/artifact/test_docker_image_pulled.py": 0.2, - "tst/unit/artifact/test_docker_image_put_ref.py": 0.4, + "tst/unit/artifact/test_docker_image_put_ref.py": 0.3, "tst/unit/artifact/test_object_url_keys.py": 0.3, - "tst/unit/artifact/test_removed_service_aliases.py": 2.1, + "tst/unit/artifact/test_removed_service_aliases.py": 1.9, "tst/unit/artifact/test_service_artifact_alias.py": 0.1, "tst/unit/artifact/test_service_universe_file_view.py": 0.1, "tst/unit/artifact/test_store_put_document.py": 0.1, - "tst/unit/attribution_test.py": 0.0, - "tst/unit/bundle/agent_override_test.py": 2.2, - "tst/unit/bundle/aliases_test.py": 0.5, - "tst/unit/bundle/artifact_toml_test.py": 4.7, + "tst/unit/attribution_test.py": 0.1, + "tst/unit/bundle/agent_override_test.py": 2.7, + "tst/unit/bundle/aliases_test.py": 0.4, + "tst/unit/bundle/artifact_toml_test.py": 4.1, "tst/unit/bundle/authoring_test.py": 0.5, - "tst/unit/bundle/cli_folder_test.py": 1.3, - "tst/unit/bundle/computer_app_env_test.py": 8.3, - "tst/unit/bundle/computer_driver_env_test.py": 14.8, - "tst/unit/bundle/computer_env_folder_test.py": 41.2, - "tst/unit/bundle/computer_folder_test.py": 1.0, - "tst/unit/bundle/env_toml_test.py": 3.3, - "tst/unit/bundle/file_artifacts_test.py": 0.3, - "tst/unit/bundle/hub_test.py": 1.5, - "tst/unit/bundle/image_folder_test.py": 2.6, - "tst/unit/bundle/importer_entities_test.py": 9.4, - "tst/unit/bundle/importer_image_refs_test.py": 4.5, - "tst/unit/bundle/importer_test.py": 16.9, - "tst/unit/bundle/installed_entities_test.py": 8.0, - "tst/unit/bundle/installed_test.py": 6.7, + "tst/unit/bundle/cli_folder_test.py": 1.7, + "tst/unit/bundle/computer_app_env_test.py": 10.2, + "tst/unit/bundle/computer_driver_env_test.py": 14.1, + "tst/unit/bundle/computer_env_folder_test.py": 47.3, + "tst/unit/bundle/computer_folder_test.py": 1.6, + "tst/unit/bundle/env_toml_test.py": 6.0, + "tst/unit/bundle/file_artifacts_test.py": 0.5, + "tst/unit/bundle/hub_test.py": 2.5, + "tst/unit/bundle/image_folder_test.py": 3.8, + "tst/unit/bundle/importer_entities_test.py": 9.7, + "tst/unit/bundle/importer_image_refs_test.py": 3.9, + "tst/unit/bundle/importer_test.py": 18.0, + "tst/unit/bundle/installed_entities_test.py": 7.8, + "tst/unit/bundle/installed_test.py": 7.2, "tst/unit/bundle/ledger_digest_test.py": 0.2, - "tst/unit/bundle/ledger_test.py": 21.1, - "tst/unit/bundle/materialize_test.py": 12.8, - "tst/unit/bundle/parse_test.py": 1.9, - "tst/unit/bundle/plan_test.py": 4.4, - "tst/unit/bundle/plugin_artifact_types_test.py": 1.0, - "tst/unit/bundle/preflight_test.py": 42.4, - "tst/unit/bundle/referenced_context_test.py": 1.3, - "tst/unit/bundle/register_test.py": 9.8, - "tst/unit/bundle/requires_test.py": 6.3, - "tst/unit/bundle/resolve_test.py": 5.0, - "tst/unit/bundle/run_teardown_test.py": 17.1, - "tst/unit/bundle/run_test.py": 8.6, - "tst/unit/bundle/shipped_bundles_test.py": 3.3, - "tst/unit/bundle/shipped_computers_test.py": 1.2, - "tst/unit/bundle/to_toml_round_trip_test.py": 6.2, - "tst/unit/bundle/toml_refs_test.py": 0.1, - "tst/unit/bundle/toml_writer_test.py": 0.0, + "tst/unit/bundle/ledger_test.py": 22.3, + "tst/unit/bundle/materialize_test.py": 16.6, + "tst/unit/bundle/parse_test.py": 2.9, + "tst/unit/bundle/plan_test.py": 6.3, + "tst/unit/bundle/plugin_artifact_types_test.py": 0.9, + "tst/unit/bundle/preflight_test.py": 54.3, + "tst/unit/bundle/referenced_context_test.py": 1.2, + "tst/unit/bundle/register_test.py": 11.0, + "tst/unit/bundle/requires_test.py": 6.5, + "tst/unit/bundle/resolve_test.py": 5.6, + "tst/unit/bundle/run_teardown_test.py": 25.5, + "tst/unit/bundle/run_test.py": 8.8, + "tst/unit/bundle/shipped_bundles_test.py": 2.8, + "tst/unit/bundle/shipped_computers_test.py": 1.3, + "tst/unit/bundle/to_toml_round_trip_test.py": 5.3, + "tst/unit/bundle/toml_refs_test.py": 0.4, + "tst/unit/bundle/toml_writer_test.py": 0.1, + "tst/unit/bundle/variants_test.py": 4.9, "tst/unit/bundle/website_optional_frontend_test.py": 0.0, - "tst/unit/cli/a2a_agent_list_test.py": 0.1, + "tst/unit/cli/a2a_agent_list_test.py": 0.2, "tst/unit/cli/a2a_agent_validate_test.py": 0.2, "tst/unit/cli/base_metadata_version_test.py": 0.0, - "tst/unit/cli/build_platform_test.py": 0.2, - "tst/unit/cli/card_naming_relocation_test.py": 0.3, - "tst/unit/cli/deploy_vm_sizing_test.py": 0.0, - "tst/unit/cli/deployed_env_output_test.py": 0.1, - "tst/unit/cli/env_provider_type_test.py": 0.2, - "tst/unit/cli/env_put_validation_test.py": 0.3, + "tst/unit/cli/build_platform_test.py": 0.5, + "tst/unit/cli/card_naming_relocation_test.py": 0.2, + "tst/unit/cli/deploy_vm_sizing_test.py": 0.1, + "tst/unit/cli/deployed_env_output_test.py": 0.2, + "tst/unit/cli/env_provider_type_test.py": 0.1, + "tst/unit/cli/env_put_validation_test.py": 0.5, "tst/unit/cli/env_state_type_parity_test.py": 0.0, - "tst/unit/cli/environment_name_alias_test.py": 0.3, - "tst/unit/cli/eval_run_teardown_test.py": 0.2, + "tst/unit/cli/environment_name_alias_test.py": 0.4, + "tst/unit/cli/eval_run_teardown_test.py": 0.3, "tst/unit/cli/image_ref_put_test.py": 0.4, "tst/unit/cli/init_env_state_cli_test.py": 0.1, "tst/unit/cli/load_artifact_target_test.py": 0.1, - "tst/unit/cli/plugin_command_test.py": 36.6, - "tst/unit/cli/plugin_install_test.py": 5.9, - "tst/unit/cli/plugin_report_test.py": 14.4, - "tst/unit/cli/plugins_test.py": 8.7, + "tst/unit/cli/plugin_command_test.py": 28.5, + "tst/unit/cli/plugin_install_test.py": 9.3, + "tst/unit/cli/plugin_report_test.py": 18.1, + "tst/unit/cli/plugins_test.py": 11.9, "tst/unit/cli/run_role_models_test.py": 0.2, - "tst/unit/cli/sandbox_url_relocation_test.py": 3.3, - "tst/unit/cli/snapshot_step_output_test.py": 0.0, + "tst/unit/cli/sandbox_url_relocation_test.py": 3.5, + "tst/unit/cli/snapshot_step_output_test.py": 0.1, "tst/unit/cli/stage_free_commands_test.py": 0.0, - "tst/unit/cli/submit_runs_test.py": 5.6, - "tst/unit/cli/task_run_requires_test.py": 3.1, - "tst/unit/cli/task_run_stored_test.py": 0.5, - "tst/unit/cli/task_run_teardown_test.py": 7.6, + "tst/unit/cli/submit_runs_test.py": 5.7, + "tst/unit/cli/task_run_requires_test.py": 2.7, + "tst/unit/cli/task_run_stored_test.py": 0.7, + "tst/unit/cli/task_run_teardown_test.py": 7.8, "tst/unit/cli/teardown_env_state_cli_test.py": 0.1, "tst/unit/cli/test_release_gate_decision.py": 0.1, - "tst/unit/cli/test_removed_cli_aliases.py": 0.2, + "tst/unit/cli/test_removed_cli_aliases.py": 0.3, "tst/unit/cli/test_spec_conformance_display.py": 0.1, "tst/unit/cli/test_task_create_preflight.py": 0.1, - "tst/unit/cli/user_facing_errors_test.py": 0.1, - "tst/unit/cli/verbose_logging_test.py": 3.0, - "tst/unit/cli/website_server_image_cli_test.py": 0.8, + "tst/unit/cli/user_facing_errors_test.py": 0.2, + "tst/unit/cli/verbose_logging_test.py": 3.2, + "tst/unit/cli/website_server_image_cli_test.py": 1.0, "tst/unit/cli/write_context_filename_test.py": 0.1, "tst/unit/config/test_config_holds_its_document.py": 0.1, "tst/unit/config/test_config_profiles.py": 0.2, - "tst/unit/config/test_default_a2a_agent.py": 0.1, - "tst/unit/config/test_default_env_ids.py": 0.2, - "tst/unit/config/test_describe.py": 1.8, - "tst/unit/config/test_explain_and_sources.py": 8.2, - "tst/unit/config/test_fixture_prefix_keys.py": 0.1, - "tst/unit/config/test_human_a2a_url.py": 0.2, - "tst/unit/config/test_loader.py": 0.7, - "tst/unit/config/test_model.py": 0.5, + "tst/unit/config/test_default_a2a_agent.py": 0.2, + "tst/unit/config/test_default_env_ids.py": 0.3, + "tst/unit/config/test_describe.py": 2.1, + "tst/unit/config/test_explain_and_sources.py": 7.9, + "tst/unit/config/test_fixture_prefix_keys.py": 0.2, + "tst/unit/config/test_human_a2a_url.py": 0.4, + "tst/unit/config/test_loader.py": 1.1, + "tst/unit/config/test_model.py": 0.4, "tst/unit/config/test_no_stage_concept.py": 0.1, - "tst/unit/config/test_one_document_per_process.py": 3.7, - "tst/unit/config/test_paths.py": 0.1, - "tst/unit/config/test_registry_builders_take_a_config.py": 0.3, - "tst/unit/config/test_reset_config.py": 0.9, + "tst/unit/config/test_one_document_per_process.py": 2.8, + "tst/unit/config/test_paths.py": 0.0, + "tst/unit/config/test_registry_builders_take_a_config.py": 0.5, + "tst/unit/config/test_reset_config.py": 0.4, "tst/unit/config/test_resolve_reference.py": 0.0, "tst/unit/config/test_run_env_ids.py": 0.1, - "tst/unit/config/test_unread_keys.py": 1.3, + "tst/unit/config/test_unread_keys.py": 0.5, + "tst/unit/drivers/agent_desktop_driver_test.py": 16.7, "tst/unit/drivers/cua_driver_test.py": 1.2, + "tst/unit/drivers/macos_harness_driver_test.py": 0.3, "tst/unit/drivers/page_driver_test.py": 0.4, - "tst/unit/drivers/reference_driver_test.py": 4.2, + "tst/unit/drivers/reference_driver_test.py": 2.6, "tst/unit/entity_refs_import_test.py": 0.0, - "tst/unit/env/alias_get_test.py": 0.6, - "tst/unit/env/bootstrap_test.py": 9.7, - "tst/unit/env/envs/service_db/service_db_test.py": 0.2, - "tst/unit/env/envs/test_artifact_staging.py": 0.8, - "tst/unit/env/envs/test_chromium_app.py": 0.3, - "tst/unit/env/envs/test_computer_apps.py": 8.7, - "tst/unit/env/envs/test_computer_builder.py": 6.8, - "tst/unit/env/envs/test_computer_disk.py": 18.3, - "tst/unit/env/envs/test_computer_env.py": 37.2, - "tst/unit/env/envs/test_disk_recipe.py": 3.5, - "tst/unit/env/envs/test_env_card_loads.py": 0.5, - "tst/unit/env/envs/test_env_close_teardown.py": 0.2, - "tst/unit/env/envs/test_environment_name_alias.py": 0.4, - "tst/unit/env/envs/test_mcp_server_container_mode.py": 0.6, - "tst/unit/env/envs/test_mcp_server_load.py": 0.1, - "tst/unit/env/envs/test_mcp_server_plugin_provider.py": 0.7, - "tst/unit/env/envs/test_multi_env_load_concurrency.py": 0.4, + "tst/unit/env/alias_get_test.py": 0.3, + "tst/unit/env/bootstrap_test.py": 5.6, + "tst/unit/env/envs/service_db/service_db_test.py": 0.6, + "tst/unit/env/envs/test_artifact_staging.py": 0.4, + "tst/unit/env/envs/test_chromium_app.py": 0.2, + "tst/unit/env/envs/test_computer_apps.py": 13.4, + "tst/unit/env/envs/test_computer_builder.py": 6.5, + "tst/unit/env/envs/test_computer_disk.py": 17.3, + "tst/unit/env/envs/test_computer_env.py": 53.3, + "tst/unit/env/envs/test_computer_site_proxy.py": 1.4, + "tst/unit/env/envs/test_computer_sites.py": 0.9, + "tst/unit/env/envs/test_computer_vm_bundle.py": 6.0, + "tst/unit/env/envs/test_computer_windows.py": 1.3, + "tst/unit/env/envs/test_disk_recipe.py": 6.1, + "tst/unit/env/envs/test_env_card_loads.py": 0.4, + "tst/unit/env/envs/test_env_close_teardown.py": 0.1, + "tst/unit/env/envs/test_environment_name_alias.py": 0.1, + "tst/unit/env/envs/test_mcp_server_container_mode.py": 0.3, + "tst/unit/env/envs/test_mcp_server_load.py": 0.0, + "tst/unit/env/envs/test_mcp_server_plugin_provider.py": 0.3, + "tst/unit/env/envs/test_multi_env_load_concurrency.py": 0.3, "tst/unit/env/envs/test_multi_env_load_resume.py": 0.2, - "tst/unit/env/envs/test_multi_env_name.py": 0.2, - "tst/unit/env/envs/test_multi_env_plugin_provider.py": 0.7, - "tst/unit/env/envs/test_multi_env_snapshot_bake.py": 0.2, + "tst/unit/env/envs/test_multi_env_name.py": 0.1, + "tst/unit/env/envs/test_multi_env_plugin_provider.py": 0.6, + "tst/unit/env/envs/test_multi_env_snapshot_bake.py": 0.1, "tst/unit/env/envs/test_multi_env_snapshot_guard.py": 0.1, - "tst/unit/env/envs/test_multi_env_snapshot_reload_name.py": 0.3, - "tst/unit/env/envs/test_multi_env_vm_sizing.py": 0.2, - "tst/unit/env/envs/test_playwright_mcp_recorder.py": 1.8, + "tst/unit/env/envs/test_multi_env_snapshot_reload_name.py": 0.6, + "tst/unit/env/envs/test_multi_env_vm_sizing.py": 0.1, + "tst/unit/env/envs/test_playwright_mcp_recorder.py": 1.7, "tst/unit/env/envs/test_put_from_github_token.py": 0.1, "tst/unit/env/envs/test_website_env_name_alias.py": 0.1, - "tst/unit/env/envs/test_website_server_image.py": 0.7, - "tst/unit/env/gateway/caller_test.py": 0.1, - "tst/unit/env/gateway/changes_test.py": 0.5, - "tst/unit/env/gateway/child_outage_socket_test.py": 7.1, + "tst/unit/env/envs/test_website_server_image.py": 0.5, + "tst/unit/env/envs/test_website_site_names.py": 1.8, + "tst/unit/env/gateway/browser_route_test.py": 3.6, + "tst/unit/env/gateway/caller_test.py": 0.0, + "tst/unit/env/gateway/changes_test.py": 0.3, + "tst/unit/env/gateway/child_outage_socket_test.py": 8.9, "tst/unit/env/gateway/child_sessions_test.py": 0.6, "tst/unit/env/gateway/child_transport_test.py": 0.1, - "tst/unit/env/gateway/clock_advance_test.py": 0.4, - "tst/unit/env/gateway/data_plane_timeout_test.py": 0.2, + "tst/unit/env/gateway/clock_advance_test.py": 0.3, + "tst/unit/env/gateway/data_plane_timeout_test.py": 0.1, "tst/unit/env/gateway/env_trajectory_route_test.py": 0.1, - "tst/unit/env/gateway/gateway_card_test.py": 0.7, - "tst/unit/env/gateway/get_time_test.py": 0.6, - "tst/unit/env/gateway/hidden_by_default_test.py": 14.5, - "tst/unit/env/gateway/import_graph_test.py": 2.6, + "tst/unit/env/gateway/gateway_card_test.py": 0.4, + "tst/unit/env/gateway/get_time_test.py": 0.3, + "tst/unit/env/gateway/hidden_by_default_test.py": 13.5, + "tst/unit/env/gateway/import_graph_test.py": 2.9, "tst/unit/env/gateway/next_event_test.py": 0.4, - "tst/unit/env/gateway/notifications_test.py": 3.3, - "tst/unit/env/gateway/process_scope_socket_test.py": 1.3, - "tst/unit/env/gateway/rest_proxy_socket_test.py": 1.8, - "tst/unit/env/gateway/rest_proxy_stream_test.py": 0.5, - "tst/unit/env/gateway/role_forwarding_test.py": 0.8, - "tst/unit/env/gateway/role_rules_test.py": 0.3, - "tst/unit/env/gateway/tool_access_parity_test.py": 16.4, - "tst/unit/env/gateway/tool_name_clash_test.py": 0.2, + "tst/unit/env/gateway/notifications_test.py": 1.6, + "tst/unit/env/gateway/process_scope_socket_test.py": 1.2, + "tst/unit/env/gateway/rest_proxy_socket_test.py": 1.6, + "tst/unit/env/gateway/rest_proxy_stream_test.py": 0.4, + "tst/unit/env/gateway/role_forwarding_test.py": 0.1, + "tst/unit/env/gateway/role_rules_test.py": 0.2, + "tst/unit/env/gateway/tool_access_parity_test.py": 18.7, + "tst/unit/env/gateway/tool_name_clash_test.py": 0.1, "tst/unit/env/gateway/trajectory_virtual_time_test.py": 0.1, - "tst/unit/env/gateway/triggers_ctx_test.py": 2.6, - "tst/unit/env/gateway/triggers_test.py": 12.8, - "tst/unit/env/gateway/triggers_time_test.py": 2.1, - "tst/unit/env/gateway/triggers_website_test.py": 1.0, + "tst/unit/env/gateway/triggers_ctx_test.py": 2.3, + "tst/unit/env/gateway/triggers_test.py": 13.2, + "tst/unit/env/gateway/triggers_time_test.py": 1.8, + "tst/unit/env/gateway/triggers_website_test.py": 1.1, + "tst/unit/env/gateway/website_mcp_test.py": 1.8, "tst/unit/env/gateway/website_reserved_paths_test.py": 0.2, - "tst/unit/env/published_images_test.py": 0.7, - "tst/unit/env/store_test.py": 0.2, - "tst/unit/env/task_step/deploy_agent_env_vars_test.py": 0.2, + "tst/unit/env/gateway/website_websocket_test.py": 4.5, + "tst/unit/env/published_images_test.py": 0.4, + "tst/unit/env/store_test.py": 0.3, + "tst/unit/env/task_step/deploy_agent_env_vars_test.py": 0.1, "tst/unit/env/task_step/test_context_ops.py": 0.5, - "tst/unit/env/task_step/test_score_aggregator.py": 0.3, + "tst/unit/env/task_step/test_score_aggregator.py": 0.2, "tst/unit/env/task_step/verify_env_card_test.py": 0.2, "tst/unit/env/task_step/verify_env_core_protocol_test.py": 0.2, - "tst/unit/env/test_env.py": 0.6, - "tst/unit/env/test_legacy_protocol.py": 0.1, - "tst/unit/env/test_registry.py": 0.4, + "tst/unit/env/test_env.py": 0.7, + "tst/unit/env/test_legacy_protocol.py": 0.2, + "tst/unit/env/test_registry.py": 0.5, "tst/unit/env/test_snapshot_fingerprint.py": 0.1, "tst/unit/explorer/entity_ids_test.py": 0.1, - "tst/unit/explorer/explorer_app_test.py": 17.2, - "tst/unit/openenv/app_test.py": 15.0, - "tst/unit/openenv/environment_test.py": 12.2, - "tst/unit/plugin_inventory_test.py": 1.3, - "tst/unit/plugin_requirements_test.py": 0.2, - "tst/unit/plugin_settings_test.py": 10.5, - "tst/unit/plugins_test.py": 2.3, - "tst/unit/providers/compose_host_port_publish_test.py": 0.5, - "tst/unit/providers/env_providers/env_gateway_provider_test.py": 4.2, + "tst/unit/explorer/explorer_app_test.py": 16.9, + "tst/unit/openenv/app_test.py": 12.6, + "tst/unit/openenv/environment_test.py": 13.0, + "tst/unit/plugin_inventory_test.py": 0.9, + "tst/unit/plugin_requirements_test.py": 0.1, + "tst/unit/plugin_settings_test.py": 7.9, + "tst/unit/plugins_test.py": 1.7, + "tst/unit/providers/compose_host_port_publish_test.py": 0.7, + "tst/unit/providers/env_providers/env_gateway_provider_test.py": 5.0, "tst/unit/providers/env_providers/env_provider_test.py": 0.1, - "tst/unit/providers/env_providers/env_server_provider_test.py": 0.6, - "tst/unit/providers/env_state/test_config_state_providers.py": 0.8, - "tst/unit/providers/env_state/test_env_state_provider.py": 0.5, - "tst/unit/providers/sandbox_providers/agent37_sandbox_provider_test.py": 0.6, - "tst/unit/providers/sandbox_providers/agent37_sandbox_test.py": 1.2, - "tst/unit/providers/sandbox_providers/attribution_wire_test.py": 0.4, - "tst/unit/providers/sandbox_providers/boat_sandbox_provider_test.py": 0.6, - "tst/unit/providers/sandbox_providers/boat_sandbox_test.py": 0.5, - "tst/unit/providers/sandbox_providers/boxd_sandbox_provider_test.py": 1.6, + "tst/unit/providers/env_providers/env_server_provider_test.py": 0.5, + "tst/unit/providers/env_state/test_config_state_providers.py": 0.7, + "tst/unit/providers/env_state/test_env_state_provider.py": 0.4, + "tst/unit/providers/sandbox_providers/agent37_sandbox_provider_test.py": 0.3, + "tst/unit/providers/sandbox_providers/agent37_sandbox_test.py": 1.1, + "tst/unit/providers/sandbox_providers/attribution_wire_test.py": 0.3, + "tst/unit/providers/sandbox_providers/boat_sandbox_provider_test.py": 0.5, + "tst/unit/providers/sandbox_providers/boat_sandbox_test.py": 0.3, + "tst/unit/providers/sandbox_providers/boxd_sandbox_provider_test.py": 1.3, "tst/unit/providers/sandbox_providers/boxd_sandbox_test.py": 0.4, - "tst/unit/providers/sandbox_providers/coreweave_deploy_paths_test.py": 0.3, - "tst/unit/providers/sandbox_providers/coreweave_sandbox_provider_test.py": 2.1, - "tst/unit/providers/sandbox_providers/coreweave_sandbox_test.py": 1.1, - "tst/unit/providers/sandbox_providers/daytona_network_test.py": 0.8, - "tst/unit/providers/sandbox_providers/daytona_sandbox_provider_test.py": 1.9, - "tst/unit/providers/sandbox_providers/daytona_sandbox_test.py": 1.4, - "tst/unit/providers/sandbox_providers/e2b_sandbox_provider_test.py": 0.4, - "tst/unit/providers/sandbox_providers/e2b_sandbox_test.py": 1.5, - "tst/unit/providers/sandbox_providers/e2b_template_test.py": 0.7, + "tst/unit/providers/sandbox_providers/coreweave_deploy_paths_test.py": 0.2, + "tst/unit/providers/sandbox_providers/coreweave_sandbox_provider_test.py": 1.6, + "tst/unit/providers/sandbox_providers/coreweave_sandbox_test.py": 0.5, + "tst/unit/providers/sandbox_providers/daytona_network_test.py": 0.4, + "tst/unit/providers/sandbox_providers/daytona_sandbox_provider_test.py": 1.6, + "tst/unit/providers/sandbox_providers/daytona_sandbox_test.py": 1.0, + "tst/unit/providers/sandbox_providers/e2b_sandbox_provider_test.py": 0.3, + "tst/unit/providers/sandbox_providers/e2b_sandbox_test.py": 1.3, + "tst/unit/providers/sandbox_providers/e2b_template_test.py": 0.6, "tst/unit/providers/sandbox_providers/egress_hosts_test.py": 0.3, - "tst/unit/providers/sandbox_providers/host_images_test.py": 1.1, - "tst/unit/providers/sandbox_providers/local_sandbox_host_ports_test.py": 0.7, - "tst/unit/providers/sandbox_providers/local_sandbox_test.py": 13.2, - "tst/unit/providers/sandbox_providers/modal_context_build_test.py": 1.5, - "tst/unit/providers/sandbox_providers/modal_create_signature_test.py": 0.3, - "tst/unit/providers/sandbox_providers/modal_gpu_sandbox_test.py": 0.1, + "tst/unit/providers/sandbox_providers/host_images_test.py": 0.8, + "tst/unit/providers/sandbox_providers/local_sandbox_host_ports_test.py": 0.5, + "tst/unit/providers/sandbox_providers/local_sandbox_test.py": 11.5, + "tst/unit/providers/sandbox_providers/lume_sandbox_provider_test.py": 8.8, + "tst/unit/providers/sandbox_providers/modal_context_build_test.py": 1.1, + "tst/unit/providers/sandbox_providers/modal_create_signature_test.py": 0.1, + "tst/unit/providers/sandbox_providers/modal_gpu_sandbox_test.py": 0.0, "tst/unit/providers/sandbox_providers/modal_network_policy_test.py": 0.1, - "tst/unit/providers/sandbox_providers/modal_network_policy_wiring_test.py": 0.1, + "tst/unit/providers/sandbox_providers/modal_network_policy_wiring_test.py": 0.0, "tst/unit/providers/sandbox_providers/modal_sandbox_started_log_test.py": 0.1, "tst/unit/providers/sandbox_providers/modal_sandbox_tags_test.py": 0.3, - "tst/unit/providers/sandbox_providers/modal_sandbox_test.py": 0.6, - "tst/unit/providers/sandbox_providers/modal_vm_sandbox_test.py": 1.6, - "tst/unit/providers/sandbox_providers/network_policy_providers_test.py": 0.4, - "tst/unit/providers/sandbox_providers/network_policy_stamping_test.py": 0.3, - "tst/unit/providers/sandbox_providers/network_policy_test.py": 0.3, - "tst/unit/providers/sandbox_providers/provider_capabilities_test.py": 4.6, + "tst/unit/providers/sandbox_providers/modal_sandbox_test.py": 0.4, + "tst/unit/providers/sandbox_providers/modal_vm_sandbox_test.py": 1.4, + "tst/unit/providers/sandbox_providers/network_policy_providers_test.py": 0.1, + "tst/unit/providers/sandbox_providers/network_policy_stamping_test.py": 0.1, + "tst/unit/providers/sandbox_providers/network_policy_test.py": 0.2, + "tst/unit/providers/sandbox_providers/provider_capabilities_test.py": 2.1, "tst/unit/providers/sandbox_providers/relay_test.py": 0.1, - "tst/unit/providers/sandbox_providers/sail_vm_model_key_test.py": 3.0, - "tst/unit/providers/sandbox_providers/sail_vm_sandbox_provider_test.py": 2.7, - "tst/unit/providers/sandbox_providers/sail_vm_sandbox_test.py": 0.7, - "tst/unit/providers/sandbox_providers/sandbox_provider_test.py": 1.2, - "tst/unit/providers/sandbox_providers/tenki_sandbox_provider_test.py": 1.4, - "tst/unit/providers/sandbox_providers/tenki_sandbox_test.py": 0.8, - "tst/unit/providers/sandbox_providers/tensorlake_sandbox_provider_test.py": 0.9, - "tst/unit/providers/sandbox_providers/tensorlake_sandbox_test.py": 4.5, - "tst/unit/providers/sandbox_providers/test_config_sandbox_providers.py": 1.7, + "tst/unit/providers/sandbox_providers/sail_vm_model_key_test.py": 1.8, + "tst/unit/providers/sandbox_providers/sail_vm_sandbox_provider_test.py": 2.3, + "tst/unit/providers/sandbox_providers/sail_vm_sandbox_test.py": 0.3, + "tst/unit/providers/sandbox_providers/sandbox_provider_test.py": 0.5, + "tst/unit/providers/sandbox_providers/tenki_sandbox_provider_test.py": 0.8, + "tst/unit/providers/sandbox_providers/tenki_sandbox_test.py": 0.2, + "tst/unit/providers/sandbox_providers/tensorlake_sandbox_provider_test.py": 0.3, + "tst/unit/providers/sandbox_providers/tensorlake_sandbox_test.py": 4.7, + "tst/unit/providers/sandbox_providers/test_config_sandbox_providers.py": 1.3, "tst/unit/providers/sandbox_providers/test_reachability_contributions.py": 0.5, - "tst/unit/providers/sandbox_providers/test_url_rewrites.py": 1.3, - "tst/unit/providers/sandbox_providers/vercel_sandbox_provider_test.py": 0.9, - "tst/unit/providers/sandbox_providers/vercel_sandbox_test.py": 4.5, - "tst/unit/providers/sandbox_providers/vm_file_transfer_test.py": 0.4, - "tst/unit/providers/sandbox_providers/vm_object_push_test.py": 1.1, - "tst/unit/providers/sandbox_providers/vm_sandbox_test.py": 1.4, - "tst/unit/runner/local_runner_test.py": 7.7, - "tst/unit/runner/run_store_test.py": 0.2, - "tst/unit/serialization/test_golden_wire_format.py": 0.6, + "tst/unit/providers/sandbox_providers/test_url_rewrites.py": 0.6, + "tst/unit/providers/sandbox_providers/vercel_sandbox_provider_test.py": 0.4, + "tst/unit/providers/sandbox_providers/vercel_sandbox_test.py": 4.3, + "tst/unit/providers/sandbox_providers/vm_file_transfer_test.py": 0.2, + "tst/unit/providers/sandbox_providers/vm_object_push_test.py": 0.6, + "tst/unit/providers/sandbox_providers/vm_sandbox_test.py": 0.7, + "tst/unit/runner/local_runner_test.py": 8.9, + "tst/unit/runner/run_store_test.py": 0.1, + "tst/unit/serialization/test_golden_wire_format.py": 0.3, "tst/unit/store/awaiting_lock_test.py": 1.0, - "tst/unit/store/aws/aws_secret_store_test.py": 0.5, - "tst/unit/store/aws/dynamodb_document_store_test.py": 17.7, - "tst/unit/store/aws/dynamodb_step_journal_test.py": 15.9, - "tst/unit/store/aws/ecr_image_store_test.py": 0.1, - "tst/unit/store/aws/s3_grant_lifetime_test.py": 0.3, - "tst/unit/store/aws/s3_object_store_test.py": 9.7, - "tst/unit/store/aws/s3_transfer_grants_test.py": 0.5, - "tst/unit/store/aws/test_secret_logging.py": 0.1, - "tst/unit/store/aws/test_shared_credentials.py": 0.3, - "tst/unit/store/derived_ids_test.py": 10.0, - "tst/unit/store/fake_object_store_test.py": 0.5, - "tst/unit/store/firestore_mongo_document_store_test.py": 0.6, - "tst/unit/store/gcp_secret_manager_secret_store_test.py": 0.4, - "tst/unit/store/gcs_object_store_test.py": 1.5, - "tst/unit/store/google_credentials_test.py": 1.0, + "tst/unit/store/aws/aws_secret_store_test.py": 0.3, + "tst/unit/store/aws/dynamodb_document_store_test.py": 14.0, + "tst/unit/store/aws/dynamodb_step_journal_test.py": 11.5, + "tst/unit/store/aws/ecr_image_store_test.py": 0.0, + "tst/unit/store/aws/s3_grant_lifetime_test.py": 0.2, + "tst/unit/store/aws/s3_object_store_test.py": 5.6, + "tst/unit/store/aws/s3_transfer_grants_test.py": 0.2, + "tst/unit/store/aws/test_secret_logging.py": 0.0, + "tst/unit/store/aws/test_shared_credentials.py": 0.2, + "tst/unit/store/derived_ids_test.py": 8.8, + "tst/unit/store/fake_object_store_test.py": 0.2, + "tst/unit/store/firestore_mongo_document_store_test.py": 0.3, + "tst/unit/store/gcp_secret_manager_secret_store_test.py": 1.4, + "tst/unit/store/gcs_object_store_test.py": 0.7, + "tst/unit/store/google_credentials_test.py": 0.6, "tst/unit/store/google_transport_test.py": 0.2, - "tst/unit/store/grant_lifetime_test.py": 0.2, - "tst/unit/store/ids_test.py": 1.6, - "tst/unit/store/local_backends_composition_test.py": 1.4, - "tst/unit/store/local_grant_server_test.py": 11.1, - "tst/unit/store/local_id_acceptance_test.py": 2.3, - "tst/unit/store/local_object_store_test.py": 2.1, + "tst/unit/store/grant_lifetime_test.py": 0.1, + "tst/unit/store/ids_test.py": 0.9, + "tst/unit/store/local_backends_composition_test.py": 1.1, + "tst/unit/store/local_grant_server_test.py": 10.1, + "tst/unit/store/local_id_acceptance_test.py": 1.3, + "tst/unit/store/local_object_store_test.py": 1.7, "tst/unit/store/local_registry_image_store_test.py": 0.1, - "tst/unit/store/local_secret_store_test.py": 0.2, - "tst/unit/store/local_tls_test.py": 0.6, - "tst/unit/store/local_tokens_test.py": 0.3, - "tst/unit/store/mongo_document_store_test.py": 1.0, - "tst/unit/store/oci_registry_credentials_test.py": 0.2, - "tst/unit/store/oci_registry_image_store_test.py": 0.7, + "tst/unit/store/local_secret_store_test.py": 0.1, + "tst/unit/store/local_tls_test.py": 0.5, + "tst/unit/store/local_tokens_test.py": 0.2, + "tst/unit/store/mongo_document_store_test.py": 0.8, + "tst/unit/store/oci_registry_credentials_test.py": 0.1, + "tst/unit/store/oci_registry_image_store_test.py": 0.4, "tst/unit/store/readable_url_test.py": 0.3, - "tst/unit/store/registry_api_test.py": 0.8, - "tst/unit/store/routing_test.py": 5.6, - "tst/unit/store/sqlite_document_store_test.py": 11.7, - "tst/unit/store/test_config_document_store.py": 0.3, - "tst/unit/store/test_config_image_store.py": 0.3, - "tst/unit/store/test_config_model.py": 0.9, + "tst/unit/store/registry_api_test.py": 0.4, + "tst/unit/store/routing_test.py": 3.2, + "tst/unit/store/sqlite_document_store_test.py": 11.2, + "tst/unit/store/test_config_document_store.py": 0.2, + "tst/unit/store/test_config_image_store.py": 0.2, + "tst/unit/store/test_config_model.py": 0.5, "tst/unit/store/test_config_mongo_client.py": 0.1, - "tst/unit/store/test_config_object_store.py": 0.3, + "tst/unit/store/test_config_object_store.py": 0.2, "tst/unit/store/test_config_secret_bundle_keys.py": 0.0, - "tst/unit/store/test_config_secret_store.py": 0.2, - "tst/unit/store/test_document_store.py": 0.8, - "tst/unit/store/test_object_transfer_grants.py": 0.5, + "tst/unit/store/test_config_secret_store.py": 0.1, + "tst/unit/store/test_document_store.py": 0.5, + "tst/unit/store/test_object_transfer_grants.py": 0.4, "tst/unit/store/test_task_instance_indexes.py": 0.1, - "tst/unit/store/version_lookup_benchmark_test.py": 1.1, + "tst/unit/store/version_lookup_benchmark_test.py": 1.3, "tst/unit/task/batch_universe_ids_test.py": 0.0, "tst/unit/task/benchmark_test.py": 0.0, "tst/unit/task/control_grant_test.py": 0.1, - "tst/unit/task/depends_on_test.py": 0.8, - "tst/unit/task/episode/proxy_test.py": 0.3, - "tst/unit/task/episode/run_test.py": 17.6, - "tst/unit/task/episode/spec_test.py": 2.7, - "tst/unit/task/local_run_write_fence_test.py": 2.1, - "tst/unit/task/seed_substitution_test.py": 0.1, - "tst/unit/task/step_journal_rules_test.py": 0.3, - "tst/unit/task/step_journal_test.py": 1.7, - "tst/unit/task/task_document_test.py": 0.4, - "tst/unit/task/task_failure_write_retry_test.py": 0.2, - "tst/unit/task/task_instance_reads_test.py": 0.2, - "tst/unit/task/teardown_test.py": 2.1, - "tst/unit/task_step/add_skills_env_test.py": 0.3, - "tst/unit/task_step/attribution_serialization_test.py": 0.4, - "tst/unit/task_step/computer_recording_test.py": 0.9, - "tst/unit/task_step/context_ops_journal_test.py": 0.2, - "tst/unit/task_step/deploy_agent_cleanup_test.py": 0.1, + "tst/unit/task/depends_on_test.py": 0.9, + "tst/unit/task/episode/proxy_test.py": 0.2, + "tst/unit/task/episode/run_test.py": 18.2, + "tst/unit/task/episode/spec_test.py": 1.7, + "tst/unit/task/local_run_write_fence_test.py": 2.5, + "tst/unit/task/retry_sandbox_teardown_test.py": 0.1, + "tst/unit/task/seed_context_fence_test.py": 0.1, + "tst/unit/task/seed_substitution_test.py": 0.0, + "tst/unit/task/step_journal_rules_test.py": 0.2, + "tst/unit/task/step_journal_test.py": 1.6, + "tst/unit/task/task_document_test.py": 0.3, + "tst/unit/task/task_failure_write_retry_test.py": 0.1, + "tst/unit/task/task_instance_reads_test.py": 0.1, + "tst/unit/task/teardown_test.py": 1.7, + "tst/unit/task_step/add_skills_env_test.py": 0.2, + "tst/unit/task_step/attribution_serialization_test.py": 0.2, + "tst/unit/task_step/computer_recording_test.py": 1.0, + "tst/unit/task_step/context_ops_journal_test.py": 0.1, + "tst/unit/task_step/deploy_agent_cleanup_test.py": 0.0, "tst/unit/task_step/deploy_agent_linked_sandbox_test.py": 0.1, "tst/unit/task_step/deploy_agent_test.py": 0.1, - "tst/unit/task_step/deploy_env_test.py": 0.9, + "tst/unit/task_step/deploy_env_test.py": 1.1, "tst/unit/task_step/deploy_human_agent_test.py": 0.2, "tst/unit/task_step/deploy_sandbox_default_cpu_test.py": 0.1, "tst/unit/task_step/deploy_sandbox_image_test.py": 0.1, - "tst/unit/task_step/deploy_sandbox_network_policy_test.py": 0.2, + "tst/unit/task_step/deploy_sandbox_network_policy_test.py": 0.1, "tst/unit/task_step/deploy_sandbox_provider_override_test.py": 0.1, "tst/unit/task_step/install_agent_guards_test.py": 0.3, - "tst/unit/task_step/install_agent_test.py": 0.5, - "tst/unit/task_step/local_container_urls_test.py": 1.5, - "tst/unit/task_step/local_step_containers_test.py": 0.5, + "tst/unit/task_step/install_agent_test.py": 0.4, + "tst/unit/task_step/local_container_urls_test.py": 1.6, + "tst/unit/task_step/local_step_containers_test.py": 0.4, "tst/unit/task_step/prompt_agent_file_parts_test.py": 0.4, - "tst/unit/task_step/retry_test.py": 1.8, + "tst/unit/task_step/retry_test.py": 1.6, "tst/unit/task_step/run_context_object_url_test.py": 0.2, - "tst/unit/task_step/run_docker_container_test.py": 0.5, - "tst/unit/task_step/skill_object_url_test.py": 0.3, + "tst/unit/task_step/run_docker_container_test.py": 0.3, + "tst/unit/task_step/skill_object_url_test.py": 0.2, "tst/unit/task_step/snapshot_computer_env_test.py": 0.5, - "tst/unit/task_step/snapshot_env_upload_grant_test.py": 1.1, - "tst/unit/task_step/snapshot_env_without_gateway_test.py": 0.6, + "tst/unit/task_step/snapshot_env_upload_grant_test.py": 0.9, + "tst/unit/task_step/snapshot_env_without_gateway_test.py": 0.5, "tst/unit/task_step/stored_priority_test.py": 0.1, - "tst/unit/task_step/stored_s3_form_fields_test.py": 0.1, - "tst/unit/task_step/sync_env_clock_test.py": 0.8, - "tst/unit/task_step/test_advance_to_next_event_hook.py": 1.3, - "tst/unit/task_step/test_agent_model_precedence.py": 0.2, - "tst/unit/task_step/test_agent_state_capture.py": 1.2, - "tst/unit/task_step/test_apply_server_config.py": 0.8, - "tst/unit/task_step/test_collect_artifacts.py": 1.5, - "tst/unit/task_step/test_collect_artifacts_universe_suffix.py": 0.4, - "tst/unit/task_step/test_collect_artifacts_vm_host.py": 0.4, - "tst/unit/task_step/test_collect_integrity.py": 0.2, - "tst/unit/task_step/test_combine_universe_verdicts.py": 0.2, - "tst/unit/task_step/test_config_task_steps.py": 0.8, - "tst/unit/task_step/test_configure_scheduled_checks.py": 0.2, - "tst/unit/task_step/test_container_sandbox_routing.py": 0.4, + "tst/unit/task_step/stored_s3_form_fields_test.py": 0.0, + "tst/unit/task_step/sync_env_clock_test.py": 0.7, + "tst/unit/task_step/test_advance_to_next_event_hook.py": 1.2, + "tst/unit/task_step/test_agent_model_precedence.py": 0.1, + "tst/unit/task_step/test_agent_state_capture.py": 0.9, + "tst/unit/task_step/test_apply_server_config.py": 0.9, + "tst/unit/task_step/test_browser_connect_cdp.py": 0.2, + "tst/unit/task_step/test_browser_steps.py": 0.7, + "tst/unit/task_step/test_collect_artifacts.py": 0.9, + "tst/unit/task_step/test_collect_artifacts_universe_suffix.py": 0.1, + "tst/unit/task_step/test_collect_artifacts_vm_host.py": 0.2, + "tst/unit/task_step/test_collect_integrity.py": 0.1, + "tst/unit/task_step/test_combine_universe_verdicts.py": 0.1, + "tst/unit/task_step/test_config_task_steps.py": 0.4, + "tst/unit/task_step/test_configure_scheduled_checks.py": 0.1, + "tst/unit/task_step/test_container_sandbox_routing.py": 0.3, "tst/unit/task_step/test_deploy_agent_changelog_objects.py": 1.0, - "tst/unit/task_step/test_deploy_agent_enable_docker.py": 0.1, - "tst/unit/task_step/test_deploy_agent_live_endpoint.py": 0.2, - "tst/unit/task_step/test_deploy_agent_mcp_alias.py": 0.2, - "tst/unit/task_step/test_deploy_agent_role_delivery.py": 1.2, - "tst/unit/task_step/test_deploy_agent_snapshot_objects.py": 0.5, - "tst/unit/task_step/test_deploy_ttl_from_budget.py": 0.2, - "tst/unit/task_step/test_entity_refs.py": 3.5, - "tst/unit/task_step/test_field_scopes.py": 2.1, - "tst/unit/task_step/test_install_agent_registers_instance.py": 0.1, - "tst/unit/task_step/test_load_artifact_agent_container_target.py": 0.2, - "tst/unit/task_step/test_load_artifact_container_sandbox.py": 0.1, - "tst/unit/task_step/test_load_artifact_env_binding.py": 0.2, - "tst/unit/task_step/test_load_artifact_file.py": 0.3, - "tst/unit/task_step/test_load_artifact_overrides.py": 0.3, - "tst/unit/task_step/test_load_artifact_service_payload.py": 0.6, - "tst/unit/task_step/test_load_artifact_service_universe.py": 0.2, + "tst/unit/task_step/test_deploy_agent_enable_docker.py": 0.2, + "tst/unit/task_step/test_deploy_agent_live_endpoint.py": 0.1, + "tst/unit/task_step/test_deploy_agent_mcp_alias.py": 0.1, + "tst/unit/task_step/test_deploy_agent_role_delivery.py": 1.0, + "tst/unit/task_step/test_deploy_agent_snapshot_objects.py": 0.3, + "tst/unit/task_step/test_deploy_ttl_from_budget.py": 0.1, + "tst/unit/task_step/test_entity_refs.py": 2.2, + "tst/unit/task_step/test_field_scopes.py": 1.2, + "tst/unit/task_step/test_install_agent_registers_instance.py": 0.0, + "tst/unit/task_step/test_load_artifact_agent_container_target.py": 0.1, + "tst/unit/task_step/test_load_artifact_container_sandbox.py": 0.0, + "tst/unit/task_step/test_load_artifact_env_binding.py": 0.1, + "tst/unit/task_step/test_load_artifact_file.py": 0.1, + "tst/unit/task_step/test_load_artifact_overrides.py": 0.1, + "tst/unit/task_step/test_load_artifact_service_payload.py": 0.3, + "tst/unit/task_step/test_load_artifact_service_universe.py": 0.0, "tst/unit/task_step/test_load_artifact_snapshot_reporting.py": 0.1, - "tst/unit/task_step/test_load_artifact_url_filenames.py": 0.2, - "tst/unit/task_step/test_load_artifact_vm_target.py": 0.3, - "tst/unit/task_step/test_manifest_cli_builder.py": 15.6, - "tst/unit/task_step/test_mcp_cli_builder.py": 1.9, - "tst/unit/task_step/test_modify_env_tool_access.py": 0.1, - "tst/unit/task_step/test_next_env_event_hook.py": 2.0, - "tst/unit/task_step/test_parallel_deploy_env_binding.py": 0.2, - "tst/unit/task_step/test_prompt_agent.py": 0.3, - "tst/unit/task_step/test_prompt_agent_builtin_tools.py": 0.1, - "tst/unit/task_step/test_prompt_agent_conversation_tool_calls.py": 0.1, - "tst/unit/task_step/test_prompt_agent_human_default.py": 0.1, + "tst/unit/task_step/test_load_artifact_url_filenames.py": 0.1, + "tst/unit/task_step/test_load_artifact_vm_target.py": 0.1, + "tst/unit/task_step/test_manifest_cli_builder.py": 15.1, + "tst/unit/task_step/test_mcp_cli_builder.py": 1.3, + "tst/unit/task_step/test_modify_env_tool_access.py": 0.0, + "tst/unit/task_step/test_next_env_event_hook.py": 1.9, + "tst/unit/task_step/test_parallel_deploy_env_binding.py": 0.1, + "tst/unit/task_step/test_preflight_pinned_versions.py": 0.0, + "tst/unit/task_step/test_prompt_agent.py": 0.1, + "tst/unit/task_step/test_prompt_agent_builtin_tools.py": 0.0, + "tst/unit/task_step/test_prompt_agent_conversation_tool_calls.py": 0.0, + "tst/unit/task_step/test_prompt_agent_human_default.py": 0.0, "tst/unit/task_step/test_prompt_agent_live_trajectory.py": 0.6, - "tst/unit/task_step/test_prompt_agent_model_params.py": 0.1, - "tst/unit/task_step/test_prompt_agent_notifications.py": 0.6, - "tst/unit/task_step/test_prompt_agent_post_turn_hooks.py": 2.6, - "tst/unit/task_step/test_prompt_agent_snapshots.py": 3.8, - "tst/unit/task_step/test_prompt_agent_triggers.py": 1.9, - "tst/unit/task_step/test_prompt_agent_unreachable.py": 0.1, - "tst/unit/task_step/test_prompt_agent_user_model.py": 0.1, - "tst/unit/task_step/test_prompt_agent_user_side.py": 0.7, - "tst/unit/task_step/test_recorded_models.py": 0.1, - "tst/unit/task_step/test_register_agent_triggers.py": 0.2, - "tst/unit/task_step/test_register_env_triggers.py": 8.2, - "tst/unit/task_step/test_reset_env.py": 0.1, - "tst/unit/task_step/test_review.py": 0.3, - "tst/unit/task_step/test_run_code.py": 20.0, - "tst/unit/task_step/test_sandbox_utils_agent_container.py": 0.2, - "tst/unit/task_step/test_sandbox_utils_logs.py": 0.3, - "tst/unit/task_step/test_snapshot_agent_state.py": 0.5, - "tst/unit/task_step/test_snapshot_env.py": 1.4, - "tst/unit/task_step/test_snapshot_env_env_binding.py": 0.3, - "tst/unit/task_step/test_step_overrides_agent_and_model.py": 0.3, - "tst/unit/task_step/test_teardown_sandboxes.py": 0.4, - "tst/unit/task_step/test_universe_comparison.py": 0.2, - "tst/unit/task_step/test_validation_gate_aggregator.py": 0.2, + "tst/unit/task_step/test_prompt_agent_model_params.py": 0.0, + "tst/unit/task_step/test_prompt_agent_notifications.py": 0.7, + "tst/unit/task_step/test_prompt_agent_post_turn_hooks.py": 1.9, + "tst/unit/task_step/test_prompt_agent_snapshots.py": 2.2, + "tst/unit/task_step/test_prompt_agent_triggers.py": 0.9, + "tst/unit/task_step/test_prompt_agent_unreachable.py": 0.0, + "tst/unit/task_step/test_prompt_agent_user_model.py": 0.0, + "tst/unit/task_step/test_prompt_agent_user_side.py": 0.4, + "tst/unit/task_step/test_recorded_models.py": 0.0, + "tst/unit/task_step/test_register_agent_triggers.py": 0.1, + "tst/unit/task_step/test_register_env_triggers.py": 7.4, + "tst/unit/task_step/test_reset_env.py": 0.0, + "tst/unit/task_step/test_review.py": 0.1, + "tst/unit/task_step/test_run_code.py": 16.2, + "tst/unit/task_step/test_sandbox_utils_agent_container.py": 0.0, + "tst/unit/task_step/test_sandbox_utils_logs.py": 0.1, + "tst/unit/task_step/test_snapshot_agent_state.py": 0.2, + "tst/unit/task_step/test_snapshot_env.py": 1.3, + "tst/unit/task_step/test_snapshot_env_env_binding.py": 0.1, + "tst/unit/task_step/test_step_overrides_agent_and_model.py": 0.1, + "tst/unit/task_step/test_teardown_sandboxes.py": 0.2, + "tst/unit/task_step/test_universe_comparison.py": 0.1, + "tst/unit/task_step/test_validation_gate_aggregator.py": 0.1, "tst/unit/task_step/test_verify_a2a_agent_mcp.py": 0.0, "tst/unit/task_step/test_verify_a2a_builtin_tools.py": 0.1, - "tst/unit/task_step/test_verify_spec_conformance.py": 0.9, - "tst/unit/task_step/test_verify_universe_agent_judge.py": 0.5, + "tst/unit/task_step/test_verify_spec_conformance.py": 0.3, + "tst/unit/task_step/test_verify_universe_agent_judge.py": 0.2, "tst/unit/task_step/test_verify_universe_roundtrip.py": 0.2, - "tst/unit/task_step/thread_work_test.py": 0.7, - "tst/unit/task_step/unwritten_local_agent_test.py": 0.8, - "tst/unit/task_step/verifiers/judge_short_keys_test.py": 0.3, - "tst/unit/task_step/verifiers/judge_utils/test_frame_selection.py": 0.6, - "tst/unit/task_step/verifiers/judge_utils/test_frame_selection_tool_name.py": 0.1, - "tst/unit/task_step/verifiers/judge_utils/test_judge_output_format.py": 1.3, + "tst/unit/task_step/thread_work_test.py": 0.6, + "tst/unit/task_step/unwritten_local_agent_test.py": 0.9, + "tst/unit/task_step/verifiers/judge_short_keys_test.py": 0.0, + "tst/unit/task_step/verifiers/judge_utils/test_frame_selection.py": 0.2, + "tst/unit/task_step/verifiers/judge_utils/test_frame_selection_tool_name.py": 0.0, + "tst/unit/task_step/verifiers/judge_utils/test_judge_output_format.py": 0.4, "tst/unit/task_step/verifiers/judge_utils/test_trajectory_filter.py": 0.0, "tst/unit/task_step/verifiers/run_container_unit_tests_verifier_test.py": 1.5, "tst/unit/task_step/verifiers/test_env_outcome_verifier_step.py": 0.2, - "tst/unit/task_step/verifiers/test_rubrics_verifier_criteria_override.py": 0.1, - "tst/unit/task_step/verifiers/test_rubrics_verifier_grade_up_to_turn.py": 0.3, - "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_batches.py": 0.5, - "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_model.py": 0.2, - "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_retry.py": 0.1, - "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_teardown.py": 0.1, - "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_timeout.py": 0.1, - "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_trajectory.py": 0.8, - "tst/unit/task_step/verifiers/test_rubrics_verifier_mistakes_entry.py": 0.5, - "tst/unit/task_step/verifiers/test_rubrics_verifier_multiturn.py": 0.9, - "tst/unit/task_step/verifiers/test_rubrics_verifier_per_criterion.py": 1.1, - "tst/unit/task_step/verifiers/test_rubrics_verifier_screenshots.py": 4.7, - "tst/unit/task_step/verifiers/test_run_context.py": 2.3, + "tst/unit/task_step/verifiers/test_rubrics_verifier_criteria_override.py": 0.0, + "tst/unit/task_step/verifiers/test_rubrics_verifier_grade_up_to_turn.py": 0.1, + "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_batches.py": 0.2, + "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_model.py": 0.1, + "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_retry.py": 0.0, + "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_teardown.py": 0.0, + "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_timeout.py": 0.0, + "tst/unit/task_step/verifiers/test_rubrics_verifier_judge_trajectory.py": 0.3, + "tst/unit/task_step/verifiers/test_rubrics_verifier_mistakes_entry.py": 0.3, + "tst/unit/task_step/verifiers/test_rubrics_verifier_multiturn.py": 0.8, + "tst/unit/task_step/verifiers/test_rubrics_verifier_nonfinite_scores.py": 2.0, + "tst/unit/task_step/verifiers/test_rubrics_verifier_per_criterion.py": 0.2, + "tst/unit/task_step/verifiers/test_rubrics_verifier_screenshots.py": 5.3, + "tst/unit/task_step/verifiers/test_run_context.py": 1.6, "tst/unit/task_step/verifiers/test_score_parity.py": 0.1, - "tst/unit/task_step/verifiers/test_trajectory_mistakes_format.py": 0.7, - "tst/unit/task_step/verifiers/test_verify_sandbox.py": 0.5, - "tst/unit/test_capabilities.py": 0.5, - "tst/unit/test_check_plugin_api.py": 19.7, - "tst/unit/test_check_skip_policy.py": 0.6, - "tst/unit/test_clean_install_wheel.py": 0.2, - "tst/unit/test_client_identity.py": 0.1, - "tst/unit/test_infra_build_script.py": 1.9, - "tst/unit/test_infra_images_script.py": 0.6, - "tst/unit/test_mirror_base_images_script.py": 0.2, - "tst/unit/test_optional_extras_stay_optional.py": 402.5, + "tst/unit/task_step/verifiers/test_trajectory_mistakes_format.py": 0.3, + "tst/unit/task_step/verifiers/test_verify_sandbox.py": 0.3, + "tst/unit/test_capabilities.py": 0.2, + "tst/unit/test_check_plugin_api.py": 19.4, + "tst/unit/test_check_skip_policy.py": 0.3, + "tst/unit/test_clean_install_wheel.py": 0.1, + "tst/unit/test_client_identity.py": 0.0, + "tst/unit/test_infra_build_script.py": 0.6, + "tst/unit/test_infra_images_script.py": 0.7, + "tst/unit/test_mirror_base_images_script.py": 0.1, + "tst/unit/test_optional_extras_stay_optional.py": 427.1, "tst/unit/test_pypi_release_script.py": 0.3, - "tst/unit/test_release_infra_images.py": 0.9, - "tst/unit/test_release_protocol_pins.py": 0.3, - "tst/unit/test_runtime_dependencies_are_imported.py": 21.7, - "tst/unit/test_shards.py": 11.5, - "tst/unit/test_slow_test_durations_script.py": 0.3, - "tst/unit/test_subclass_hooks_are_annotated.py": 3.2, + "tst/unit/test_release_infra_images.py": 0.7, + "tst/unit/test_release_protocol_pins.py": 0.1, + "tst/unit/test_runtime_dependencies_are_imported.py": 22.5, + "tst/unit/test_shards.py": 11.8, + "tst/unit/test_slow_test_durations_script.py": 0.2, + "tst/unit/test_subclass_hooks_are_annotated.py": 2.2, "tst/unit/test_tls_verification.py": 0.1, - "tst/unit/training/chat_test.py": 13.8, - "tst/unit/training/harness_test.py": 18.4, - "tst/unit/training/nemo_gym_test.py": 3.8, + "tst/unit/training/chat_test.py": 13.6, + "tst/unit/training/harness_test.py": 18.2, + "tst/unit/training/nemo_gym_test.py": 4.8, "tst/unit/training/sessions_test.py": 0.2, - "tst/unit/training/skyrl_test.py": 6.1, - "tst/unit/training/tools_test.py": 0.2, - "tst/unit/training/trl_test.py": 35.3, - "tst/unit/training/verl_test.py": 3.6, - "tst/unit/utils/docker/build_test.py": 0.8, - "tst/unit/utils/docker/context_test.py": 0.8, - "tst/unit/utils/docker/dockerfile_test.py": 1.1, - "tst/unit/utils/docker/installed_test.py": 0.2, - "tst/unit/utils/docker/lock_test.py": 0.4, + "tst/unit/training/skyrl_test.py": 5.3, + "tst/unit/training/tools_test.py": 0.1, + "tst/unit/training/trl_test.py": 32.3, + "tst/unit/training/verl_test.py": 3.4, + "tst/unit/utils/docker/build_test.py": 0.4, + "tst/unit/utils/docker/context_test.py": 0.6, + "tst/unit/utils/docker/dockerfile_test.py": 0.5, + "tst/unit/utils/docker/installed_test.py": 0.1, + "tst/unit/utils/docker/lock_test.py": 0.2, "tst/unit/utils/docker/metadata_test.py": 0.1, - "tst/unit/utils/docker/prune_test.py": 1.6, - "tst/unit/utils/exec_retry_test.py": 0.3, - "tst/unit/utils/test_card_naming_github_token.py": 0.1, - "tst/unit/utils/test_paths.py": 0.3 + "tst/unit/utils/docker/prune_test.py": 0.7, + "tst/unit/utils/exec_retry_test.py": 0.1, + "tst/unit/utils/test_card_naming_github_token.py": 0.0, + "tst/unit/utils/test_paths.py": 0.1 } } diff --git a/tst/unit/bundle/computer_env_folder_test.py b/tst/unit/bundle/computer_env_folder_test.py index 3259c32d4..c30fc020c 100644 --- a/tst/unit/bundle/computer_env_folder_test.py +++ b/tst/unit/bundle/computer_env_folder_test.py @@ -17,6 +17,7 @@ from agent_env.env.envs.computer.utils.composed import composition from agent_env.env.envs.computer.utils.composer import Composing from agent_env.env.envs.computer.env import ComputerEnv +from agent_env.env.envs.multi_env import MultiEnv from agent_env.providers.sandbox_providers.local_docker.provider import LocalSandboxProvider from tst.unit.bundle._support import layout, local_builds from tst.unit.bundle.computer_app_env_test import APP, TOML as APP_TOML @@ -208,3 +209,37 @@ def test_a_computer_env_folder_that_declares_what_cant_compose_is_refused_naming assert any(line.startswith("envs/desktop") and problem in line for line in refused.value.problems), refused.value assert composed == [] + + +def _office(root, computers): + """A bundle whose multi env ``office`` holds the computer env folders ``computers``, by folder.""" + return layout(root, {**{f"envs/{folder}/env.toml": toml for folder, toml in computers.items()}, + "envs/office/env.toml": f'type = "multi"\ncomputer_envs = {json.dumps(list(computers))}\n', + "tasks/t.json": json.dumps([{"id": "load", "type": "load_artifact", "env_id": "office", + "artifact_id": "notes"}]), + "artifacts/notes/notes.txt": "a note\n"}) + + +def test_a_multi_env_holding_a_computer_is_written_naming_it_whatever_sandbox_a_deploy_will_give_it(tmp_path, composed): + plan = _plan(_office(tmp_path / "desk", {"desktop": DESKTOP})) + materialize(plan, build_here=local_builds(plan)) + + env = Env.get(f"{plan.bundle.bundle.id_root}/office") + assert isinstance(env, MultiEnv) and [computer.id for computer in env.computer_envs] == [ + f"{plan.bundle.bundle.id_root}/desktop"] + + +@pytest.mark.parametrize("computers, problem", [ + ({"desktop-number-one": DESKTOP}, "envs/office: computer_envs: computer 'desktop-number-one' serves its tools under its " + "name and '_': tool prefix 'desktop-number-one_' is 19 characters, and a tool prefix " + "is at most 16"), + ({"desktop": DESKTOP, "laptop": 'environment_name = "desktop"\n' + DESKTOP}, + "envs/office: computer_envs: 'desktop' names 2 of its child envs, and the gateway knows a computer by its name alone"), +], ids=["too-long", "twice"]) +def test_a_multi_env_whose_gateway_cant_tell_its_computers_apart_by_name_is_refused_before_any_write(tmp_path, composed, + computers, problem): + with pytest.raises(BundleError) as refused: + _plan(_office(tmp_path / "desk", computers)) + + assert problem in refused.value.problems, refused.value + assert composed == [] diff --git a/tst/unit/bundle/env_toml_test.py b/tst/unit/bundle/env_toml_test.py index 0dca18dcc..a7da0bd72 100644 --- a/tst/unit/bundle/env_toml_test.py +++ b/tst/unit/bundle/env_toml_test.py @@ -215,7 +215,7 @@ def _website(name, toml=""): ({**_mcp("x"), "envs/x/env.toml": 'image = { dockerfile = "Dockerfile", build_args = { A = "1" } }\n'}, "envs/x: image: an image built from this folder takes only dockerfile, not build_args"), ({"envs/x/env.toml": 'type = "multi"\nname = "suite"\n'}, - "envs/x: env.toml: a multi env needs at least one env in mcp_server_envs or website_envs"), + "envs/x: env.toml: a multi env needs at least one env in mcp_server_envs, website_envs or computer_envs"), ({**_mcp("crm"), "envs/x/env.toml": 'type = "multi"\nmcp_server_envs = ["crm"]\nname = "my suite"\n'}, "envs/x: env.toml: name must be non-empty with no whitespace, not 'my suite'"), ({**_website("shop"), "envs/x/env.toml": 'type = "multi"\nmcp_server_envs = ["shop"]\n'}, diff --git a/tst/unit/bundle/toml_refs_test.py b/tst/unit/bundle/toml_refs_test.py index 164ba8d8c..82816e2ee 100644 --- a/tst/unit/bundle/toml_refs_test.py +++ b/tst/unit/bundle/toml_refs_test.py @@ -2,6 +2,8 @@ path is a key it takes, ``from_toml`` loads what each declared path names, and what it writes references nothing else.""" +from unittest.mock import MagicMock + import pytest from agent_env.a2a_agent import A2AAgent @@ -12,6 +14,7 @@ from agent_env.bundle import parse_bundle from agent_env.bundle.authoring import AuthoringContext from agent_env.bundle.parse import _EVAL_KEYS, CONFIG_FILES +from agent_env.env.envs.computer.env import ComputerEnv from agent_env.env.envs.mcp_server import MCPServerEnv from agent_env.env.envs.multi_env import MultiEnv from agent_env.env.envs.website import WebsiteEnv @@ -52,6 +55,9 @@ def _image(id): MCPServerEnv: lambda id: MCPServerEnv(id, 1, docker_image_artifact=_image(f"{id}-image"), environment_name=id), WebsiteEnv: lambda id: WebsiteEnv(id, 1, backend_docker_image_artifact=_image(f"{id}-back"), frontend_docker_image_artifact=_image(f"{id}-front"), environment_name=id), + # A computer's name is its tool prefix, too short for a sentinel; it deploys as it would alone, which isn't checked here. + ComputerEnv: lambda id: MagicMock(spec=ComputerEnv, id=id, type=ComputerEnv.type, version=1, environment_name="desktop", + **{"deploy_refusal.return_value": None}), } diff --git a/tst/unit/env/envs/test_computer_env.py b/tst/unit/env/envs/test_computer_env.py index 792a9e412..61bfb3025 100644 --- a/tst/unit/env/envs/test_computer_env.py +++ b/tst/unit/env/envs/test_computer_env.py @@ -919,6 +919,34 @@ async def test_a_tool_prefix_a_tool_name_cant_hold_is_refused_before_anything_bo assert boots.boots == [] +@pytest.mark.asyncio +@pytest.mark.parametrize("allow, reach, allowed", [ + (["pypi.org"], "https://gw.example/mcp", ("pypi.org", "gw.example")), + (["pypi.org"], "http://localhost:18765", ("pypi.org", "host.docker.internal")), + (["gw.example"], "https://gw.example", ("gw.example",)), + (["pypi.org"], "", ("pypi.org",)), +], ids=["added", "as-its-sandbox-reaches-it", "already-allowed", "nothing-to-reach"]) +async def test_a_deploy_given_a_url_to_reach_allows_its_host_on_a_network_that_lists_the_hosts_allowed( + base, driver, docker, boots, monkeypatch, allow, reach, allowed): + class Enforces(local_sandbox.LocalSandboxProvider): + @classmethod + def supports_network_policy(cls, policy): + return True + + monkeypatch.setattr(providers, "build_sandbox_provider", lambda spec: Enforces()) + env = _put(base, driver, display={"width": 1600, "height": 900}, network={"mode": "allowlist", "allow_hosts": allow}) + + await Env.get(env.id).deploy(sandbox_type="enforcing", reach=reach) + + assert boots.boots[0]["network_policy"].allow_hosts == allowed + + +@pytest.mark.asyncio +async def test_a_deploy_given_a_url_to_reach_leaves_a_network_it_doesnt_restrict_as_it_is(base, driver, docker, boots): + await Env.get(_put(base, driver, display={"width": 1600, "height": 900}).id).deploy(reach="https://gw.example") + assert boots.boots[0]["network_policy"] is None + + @pytest.mark.asyncio async def test_a_deploy_whose_tools_the_driver_cant_take_fails_and_tears_down_its_computer_alone( base, driver, docker, boots, monkeypatch): diff --git a/tst/unit/env/envs/test_multi_env_computers.py b/tst/unit/env/envs/test_multi_env_computers.py new file mode 100644 index 000000000..c78e4f24c --- /dev/null +++ b/tst/unit/env/envs/test_multi_env_computers.py @@ -0,0 +1,346 @@ +"""A multi env's computers: each deploys on a sandbox of its own, as it would alone, before the gateway starts, which then +fronts it by its name; its tools are served under that name, its record is kept in the multi env's, and closing the multi +env closes it.""" + +from __future__ import annotations + +import asyncio +import dataclasses +import inspect +from types import SimpleNamespace +from unittest.mock import AsyncMock, MagicMock, patch + +import pytest +from click.testing import CliRunner + +from agent_env.cli.env.multi import multi +from agent_env.env.env import DeployedEnv, DeployedGatewayEnv, DeployedSandboxEnv +from agent_env.env.envs import _deployment, _multi_computers +from agent_env.env.envs.computer import COMPUTER_ENV_TYPE +from agent_env.env.envs.computer.env import ComputerEnv +from agent_env.env.envs.multi_env import MultiEnv +from agent_env.env.gateway import ExternalChild +from agent_env.env.gateway.constants import WELL_KNOWN_PATH +from agent_env.providers.env_providers.env_gateway_provider import EnvironmentGatewayProvider +from agent_env.providers.env_providers.env_provider import EnvironmentProvider +from agent_env.task.teardown import env_sandbox_ids +from tst.util.sandbox_providers import mock_provider + +GATEWAY = "https://gw.example" + + +def _record(name: str) -> DeployedSandboxEnv: + return DeployedSandboxEnv(env_id=f"{name}-computer", env_version=1, env_provider_type="computer", sandbox_id=f"sb-{name}", + sandbox_type="modal_vm", environment_card_url=f"https://{name}.example{WELL_KNOWN_PATH}", + mcp_url=f"https://{name}.example/mcp", control_token=f"token-{name}") + + +class FakeComputer: + """A computer env as a multi env uses one: refused, deployed and closed, each call recorded in ``log``.""" + + type = COMPUTER_ENV_TYPE + + def __init__(self, name: str, *, fails: Exception | None = None, refusal: str | None = None, log: list | None = None): + self.id, self.version, self.environment_name = f"{name}-computer", 1, name + self.fails, self.refusal, self.log = fails, refusal, [] if log is None else log + self.deploys, self.refusals, self._deployed, self.closes = [], [], None, 0 + + def deploy_refusal(self, **options): + inspect.signature(ComputerEnv.deploy_refusal).bind(self, **options) # only what the real one takes + self.refusals.append(options) + return self.refusal + + async def deploy(self, **options): + inspect.signature(ComputerEnv.deploy).bind(self, **options) # only what the real one takes + self.deploys.append(options) + await asyncio.sleep(0.01) + if self.fails: + raise self.fails + self._deployed = _record(self.environment_name) + self.log.append(("deployed", self.environment_name)) + return self._deployed + + async def close(self): + self.closes += 1 + self.log.append(("close", self.environment_name)) + + @classmethod + async def from_deployed_env(cls, deployed): + computer = cls(deployed.env_id.removesuffix("-computer")) + computer._deployed = deployed + return computer + + +def _multi(*computers, mcp=(), websites=(), **kwargs) -> MultiEnv: + return MultiEnv(id="office", version=1, mcp_server_envs=[MagicMock(environment_name=name) for name in mcp], + website_envs=[MagicMock(environment_name=name, domains=[]) for name in websites], + computer_envs=list(computers), **kwargs) + + +@pytest.fixture +def providers(monkeypatch): + """Every sandbox provider a check or a deploy builds: one that takes no credentials on its URLs.""" + made = {} + + def build(sandbox_type=None): + return made.setdefault(sandbox_type, mock_provider(REQUEST_HEADERS={})) + + monkeypatch.setattr(_multi_computers, "build_sandbox_provider", build) + monkeypatch.setattr(_multi_computers, "get_env_sandbox_provider", build) + monkeypatch.setattr("agent_env.providers.build_sandbox_provider", build) + monkeypatch.setattr("agent_env.providers.get_env_sandbox_provider", build) + return made + + +# --- the field --- + +def test_computer_envs_round_trip_and_are_written_only_when_set(): + assert "computer_envs" not in _multi(mcp=["slack"]).to_dict() + doc = _multi(FakeComputer("desktop"), mcp=["slack"]).to_dict() + assert doc["computer_envs"] == [{"id": "desktop-computer", "type": COMPUTER_ENV_TYPE, "version": 1}] + with patch("agent_env.env.env.Env.get", side_effect=lambda id, version=None: FakeComputer(id.removesuffix("-computer"))): + assert [env.environment_name for env in MultiEnv.from_dict(doc).computer_envs] == ["desktop"] + + +@pytest.mark.parametrize("name, problem", [ + ("desktop-number-1", "computer 'desktop-number-1' serves its tools under its name and '_': tool prefix " + "'desktop-number-1_' is 17 characters, and a tool prefix is at most 16"), + ("my desk", "computer 'my desk' serves its tools under its name and '_': tool prefix 'my desk_' holds characters a " + "tool's name can't"), +]) +def test_a_computer_whose_name_cant_make_a_tool_prefix_is_refused(name, problem): + with pytest.raises(ValueError, match="^multi env 'office': (.*)$") as raised: + _multi(FakeComputer(name)) + assert str(raised.value) == f"multi env 'office': {problem}" + + +def test_a_computer_name_of_fifteen_characters_is_taken(): + assert _multi(FakeComputer("desktop-number1")).computer_envs[0].environment_name == "desktop-number1" + + +@pytest.mark.parametrize("computers, children, problems", [ + (["desktop", "desktop"], {}, ["'desktop' names 2 of its child envs, and the gateway knows a computer by its name alone"]), + (["slack"], {"mcp_servers": ["slack"]}, + ["'slack' names 2 of its child envs, and the gateway knows a computer by its name alone"]), + (["shop"], {"websites": ["shop"]}, ["'shop' names 2 of its child envs, and the gateway knows a computer by its name alone"]), + (["mcp-slack"], {"mcp_servers": ["slack"]}, + ["'mcp-slack' is the gateway's route to MCP server 'slack', and the gateway knows a computer by its name alone"]), + (["mcp-slack"], {"websites": ["slack"]}, []), + (["desktop"], {"mcp_servers": ["shop"], "websites": ["shop"]}, []), # an MCP server and a website may share a name +], ids=["two-computers", "a-server", "a-website", "a-servers-route", "a-websites-isnt", "server-and-website"]) +def test_a_computer_needs_a_name_no_other_child_env_or_route_of_the_gateways_has(computers, children, problems): + assert _multi_computers.name_problems(computers, **children) == problems + + +# --- child_envs: a computer's entry is what a deploy_env step takes to deploy it alone --- + +def test_each_computer_is_checked_as_it_would_deploy_alone_on_its_entrys_sandbox_or_the_multi_envs(providers): + desktop, laptop = FakeComputer("desktop"), FakeComputer("laptop", refusal="computer env 'laptop-computer': no arch") + env = _multi(desktop, laptop, mcp=["slack"]) + + refusal = env.deploy_refusal(sandbox_type="modal", child_envs={ + "desktop": {"sandbox_type": "modal_vm", "cpu": 4, "env_params": {"form": "disk"}}}) + + assert desktop.refusals == [{"sandbox_type": "modal_vm", "cpu": 4, "env_params": {"form": "disk"}}] + assert laptop.refusals == [{"sandbox_type": "modal"}] + assert refusal == "computer env 'laptop-computer': no arch" + laptop.refusal = None + assert env.child_envs_refusal({"laptop": {"memory_mb": 8192}}) is None + desktop.refusal = "computer env 'desktop-computer': no arch" + assert env.child_envs_refusal({"desktop": {"cpu": 2}}) == "child_envs.desktop: computer env 'desktop-computer': no arch" + + +def test_saving_a_multi_env_leaves_how_each_computer_fits_a_sandbox_to_a_deploy_as_for_a_computer_saved_alone(providers): + desktop = FakeComputer("desktop", refusal="computer env 'desktop-computer': no arch") + assert _multi(desktop).save_refusal() is None and desktop.refusals == [] + + +@pytest.mark.parametrize("child_envs, problem", [ + ({"desktop": {"env_params": {"site_routing": True}}}, "child_envs.desktop: env_params.site_routing: a computer in a multi env " + "doesn't route sites yet; deploy it beside the multi env to route them"), + ({"desktop": {"env_params": {"sites": [{"name": "shop"}]}}}, "child_envs.desktop: env_params.sites: a computer in a multi " + "env doesn't route sites yet; deploy it beside the multi env to " + "route them"), + ({"desktop": {"tools": "standard"}}, "child_envs.desktop: an entry is a table of sandbox_type, cpu, memory_mb, disk_size_gb, " + "env_params, not tools"), + ({"slack": {"cpu": 4}}, "child_envs.slack: slack runs on the multi env's own sandbox, which the step's own fields set, so " + "it takes no entry"), +], ids=["site-routing", "sites", "unknown-key", "mcp-server"]) +def test_a_computer_entry_that_routes_sites_or_holds_what_a_step_doesnt_take_is_refused(providers, child_envs, problem): + desktop = FakeComputer("desktop") + assert _multi(desktop, mcp=["slack"]).child_envs_refusal(child_envs) == problem + assert desktop.refusals == ([] if "desktop" in child_envs else [{"sandbox_type": None}]) # a refused entry deploys nothing + + +def test_a_computer_on_a_sandbox_provider_whose_urls_take_credentials_is_refused(providers): + providers["scale"] = mock_provider(REQUEST_HEADERS={"*.example": {"x-token": "env:TOKEN"}}) + refusal = _multi(FakeComputer("desktop")).child_envs_refusal({"desktop": {"sandbox_type": "scale"}}) + assert refusal == ("child_envs.desktop: MagicMock takes credentials on each request to a sandbox's URL, which the multi " + "env's gateway doesn't send to a child env; set child_envs.desktop.sandbox_type to a sandbox type " + "whose URLs take none") + + +def test_only_a_provider_whose_deploy_takes_children_deploys_computers(): + class Plugin(EnvironmentProvider): + type = "acme" + + async def deploy(self, env, sandbox_provider, **options): + raise NotImplementedError + + assert _deployment.provider_refusal(Plugin, MultiEnv, computer_names=["desktop", "laptop"]) == ( + "deploys no computers, so not its 'desktop', 'laptop'") + assert _deployment.provider_refusal(Plugin, MultiEnv) is None + assert _deployment.provider_refusal(EnvironmentGatewayProvider, MultiEnv, computer_names=["desktop"]) is None + + +# --- deploy: every computer before the gateway, then recorded in the multi env's record --- + +@pytest.fixture +def gateway(monkeypatch, local_stores): + """The gateway provider's deploy, as the multi env drives it: it starts the env's children, given the gateway's address, + as many times as ``tries`` says, and returns a record of its VM. Each close is logged, as each computer's is.""" + made = SimpleNamespace(tries=1, started=[], options=[], log=[], fails=None) + + async def deploy(self, env, sandbox_provider, *, children=None, **options): + made.options.append({**options, "children": children}) + for _ in range(made.tries): + made.started.append(await children(GATEWAY) if children else None) + if made.fails: + raise made.fails + return DeployedGatewayEnv(env_id=env.id, env_version=env.version, gateway_url=GATEWAY, sandbox_id="gw", + sandbox_type="modal_vm", sandbox_ids={"gateway_server": "gw"}, + environment_card_url=f"{GATEWAY}{WELL_KNOWN_PATH}", mcp_url=f"{GATEWAY}/mcp") + + async def close(self): + made.log.append(("close", "gateway")) + + monkeypatch.setattr(EnvironmentGatewayProvider, "deploy", deploy) + monkeypatch.setattr(EnvironmentGatewayProvider, "close", close) + return made + + +@pytest.mark.asyncio +async def test_deploy_hands_the_gateway_each_computer_deployed_under_its_name_and_records_it(gateway, providers): + desktop, laptop = FakeComputer("desktop"), FakeComputer("laptop") + attribution = {"project_id": "6a6d2e30b2710a6cf93a6430"} + + deployed = await _multi(desktop, laptop, mcp=["slack"]).deploy( + ttl_seconds=600, sandbox_type="modal_vm", attribution=attribution, + child_envs={"desktop": {"sandbox_type": "modal", "cpu": 4, "env_params": {"form": "container"}}}) + + assert desktop.deploys == [{"ttl_seconds": 600, "attribution": attribution, "tool_prefix": "desktop_", "reach": GATEWAY, + "sandbox_type": "modal", "cpu": 4, "env_params": {"form": "container"}}] + assert laptop.deploys == [{"ttl_seconds": 600, "attribution": attribution, "tool_prefix": "laptop_", "reach": GATEWAY, + "sandbox_type": "modal_vm"}] + assert gateway.started == [[ExternalChild("desktop", "https://desktop.example/mcp", "https://desktop.example"), + ExternalChild("laptop", "https://laptop.example/mcp", "https://laptop.example")]] + assert deployed.child_envs == {name: dataclasses.asdict(_record(name)) for name in ("desktop", "laptop")} + assert DeployedEnv.from_dict(dataclasses.asdict(deployed)).child_envs == deployed.child_envs + assert deployed.sandbox_ids == {"gateway_server": "gw", "modal_vm": {"desktop": "sb-desktop", "laptop": "sb-laptop"}} + assert sorted(env_sandbox_ids(DeployedEnv.from_dict(dataclasses.asdict(deployed)))) == [ + ("gw", "modal_vm"), ("gw", "modal_vm"), ("sb-desktop", "modal_vm"), ("sb-laptop", "modal_vm")] + + +@pytest.mark.asyncio +async def test_a_multi_env_without_computers_gives_the_gateway_no_children(gateway, providers): + await _multi(mcp=["slack"]).deploy() + assert gateway.options[0]["children"] is None and gateway.started == [None] + + +@pytest.mark.asyncio +async def test_a_computer_that_fails_to_deploy_fails_the_deploy_once_every_computer_has_ended_and_closes_each(gateway, providers): + log = gateway.log + desktop, laptop = FakeComputer("desktop", fails=RuntimeError("no VM"), log=log), FakeComputer("laptop", log=log) + + with pytest.raises(RuntimeError, match="^no VM$"): + await _multi(desktop, laptop).deploy() + + assert log[0] == ("deployed", "laptop") + assert sorted(log[1:3]) == [("close", "desktop"), ("close", "laptop")] and log[3:] == [("close", "gateway")] + + +@pytest.mark.asyncio +async def test_a_gateway_deploy_tried_again_closes_the_computers_the_earlier_try_made_first(gateway, providers): + gateway.tries = 2 + desktop = FakeComputer("desktop", log=gateway.log) + + await _multi(desktop).deploy() + + assert gateway.log == [("deployed", "desktop"), ("close", "desktop"), ("deployed", "desktop")] + assert len(desktop.deploys) == 2 + + +@pytest.mark.asyncio +async def test_a_redeploy_deploys_computers_of_its_own_so_a_failure_leaves_the_earlier_ones_and_close_ends_both( + gateway, providers): + env = _multi(FakeComputer("desktop")) + await env.deploy() + [earlier] = env.computer_envs + fresh = [] + + def get(id, version=None): + fresh.append(FakeComputer(id.removesuffix("-computer"))) + return fresh[-1] + + gateway.fails = RuntimeError("no gateway") + with patch("agent_env.env.env.Env.get", side_effect=get), pytest.raises(RuntimeError, match="^no gateway$"): + await env.deploy() + assert env.computer_envs == [earlier] and earlier.closes == 0 and [computer.closes for computer in fresh] == [1] + + gateway.fails = None + with patch("agent_env.env.env.Env.get", side_effect=get): + await env.deploy() + assert env.computer_envs == [fresh[1]] and earlier.closes == 0 + + await env.close() + assert earlier.closes == 1 and [computer.closes for computer in fresh] == [1, 1] + + +@pytest.mark.asyncio +async def test_close_closes_each_computer_then_the_gateway_and_one_that_fails_to_close_is_logged(gateway, providers, caplog): + desktop, laptop = FakeComputer("desktop", log=gateway.log), FakeComputer("laptop", log=gateway.log) + env = _multi(desktop, laptop) + await env.deploy() + gateway.log.clear() + laptop.close = AsyncMock(side_effect=RuntimeError("gone")) + + await env.close() + + assert gateway.log == [("close", "desktop"), ("close", "gateway")] + assert "failed to close computer 'laptop': RuntimeError('gone')" in caplog.text + + +@pytest.mark.asyncio +async def test_from_deployed_env_reattaches_each_computer_from_the_record_its_own_deploy_wrote(gateway, providers, monkeypatch): + deployed = await _multi(FakeComputer("desktop"), FakeComputer("laptop")).deploy() + stored = DeployedEnv.from_dict(dataclasses.asdict(deployed)) + monkeypatch.setattr(EnvironmentGatewayProvider, "_reattach", AsyncMock()) + + with patch("agent_env.env.env.Env.get", return_value=_multi(FakeComputer("desktop"), FakeComputer("laptop"))): + env = await MultiEnv.from_deployed_env(stored) + + assert [(computer.environment_name, computer._deployed) for computer in env.computer_envs] == [ + ("desktop", _record("desktop")), ("laptop", _record("laptop"))] + + +# --- the CLI --- + +def test_cli_put_takes_computers_and_refuses_another_type(): + computer = FakeComputer("desktop") + with patch("agent_env.cli.env.multi.Env.get", return_value=computer), \ + patch("agent_env.cli.env.multi.detect_base_metadata", return_value={}), \ + patch("agent_env.cli.env.multi.MultiEnv.put", return_value=MagicMock(id="office", version=1)) as put: + result = CliRunner().invoke(multi, ["put", "--id", "office", "--computer", "desktop-computer"]) + assert result.exit_code == 0, result.output + assert put.call_args.kwargs["computer_envs"] == [computer] + + with patch("agent_env.cli.env.multi.Env.get", return_value=MagicMock(type="mcp_server", id="slack", version=1)): + result = CliRunner().invoke(multi, ["put", "--id", "office", "--computer", "slack"]) + assert result.exit_code == 1 and "Error: slack is type 'mcp_server', expected 'computer'" in result.output + + +def test_cli_put_names_a_computer_name_the_multi_env_refuses(): + with patch("agent_env.cli.env.multi.Env.get", return_value=FakeComputer("desktop-number-one")), \ + patch("agent_env.cli.env.multi.detect_base_metadata", return_value={}): + result = CliRunner().invoke(multi, ["put", "--id", "office", "--computer", "desktop-number-one-computer"]) + assert result.exit_code == 1 and "is 19 characters, and a tool prefix is at most 16" in result.output diff --git a/tst/unit/providers/env_providers/env_gateway_provider_test.py b/tst/unit/providers/env_providers/env_gateway_provider_test.py index 8ed04f46c..7529394cf 100644 --- a/tst/unit/providers/env_providers/env_gateway_provider_test.py +++ b/tst/unit/providers/env_providers/env_gateway_provider_test.py @@ -1987,7 +1987,7 @@ async def test_create_gateway_hands_the_deploy_path_every_argument(attribution, [call] = vm.await_args_list assert call.args == (provider, args.pop("mcp_servers"), args.pop("mcp_server_images")) - assert call.kwargs == {**args, "attribution": forwarded} + assert call.kwargs == {**args, "attribution": forwarded, "children": None} assert call.kwargs["attribution"] is not attribution @@ -2729,3 +2729,162 @@ def site(request: httpx.Request) -> httpx.Response: with _sites(site): await env_gateway_provider._wait_for_websites( "http://gw", [WebsiteConfig(backend_image="s", frontend_image=None, environment_name="shop")], poll_s=0) + + +# --- children on sandboxes of their own: the gateway fronts each as it does an MCP server, by its name --- + +def test_compose_fronts_each_external_child_as_an_mcp_server_and_a_rest_route_by_its_name(): + from agent_env.env.envs.service_db import ServiceDBConfig + from agent_env.env.gateway import ExternalChild + + compose = yaml.safe_load(EnvironmentGatewayProvider().create_docker_compose( + mcp_servers=[MCPServerConfig(image="mcp-slack", environment_name="slack")], gateway_image="agent-gateway", + state_provider=LocalPostgresStateProvider(service_db_config=ServiceDBConfig()), + state_instance=LocalPostgresStateProvider.default_instance(), + external_children=(ExternalChild("desktop", "https://desk.example/mcp", "https://desk.example"),))) + + env = dict(line.split("=", 1) for line in compose["services"][GATEWAY_SERVICE_NAME]["environment"]) + assert env["INTERNAL_MCP_SERVERS"].split(",") == ["slack", "desktop=https://desk.example/mcp"] + assert "desktop=https://desk.example" in env["REST_PROXY_URLS"].split(",") + + +def test_no_service_depends_on_the_gateway_so_a_vm_deploy_can_start_them_all_before_it(): + """A VM deploy with children runs ``compose up --scale gateway=0`` first, which starts a service that depends on the + gateway with it, before its children answer.""" + from agent_env.env.envs.service_db import ServiceDBConfig + + compose = yaml.safe_load(EnvironmentGatewayProvider().create_docker_compose( + mcp_servers=[MCPServerConfig(image="mcp-slack", environment_name="slack")], gateway_image="agent-gateway", + website_configs=[WebsiteConfig(backend_image="shop-back", frontend_image="shop-front", environment_name="shop")], + state_provider=LocalPostgresStateProvider(service_db_config=ServiceDBConfig(db_web_image="pgweb", db_mcp_image="db-mcp")), + state_instance=LocalPostgresStateProvider.default_instance())) + + assert {name: service.get("depends_on") for name, service in compose["services"].items() + if GATEWAY_SERVICE_NAME in (service.get("depends_on") or ())} == {} + + +@pytest.mark.asyncio +async def test_a_vm_deploy_starts_its_children_beside_its_services_and_the_gateway_after_them_fronting_each(): + """The children get the gateway's address before the gateway starts, which then waits for each to answer; every + child is reached as the VM reaches it.""" + from agent_env.env.gateway import ExternalChild, GatewayMode + from agent_env.providers.env_state import DatabaseStateProvider + + gp = EnvironmentGatewayProvider() + gp._state_provider = MagicMock(spec=DatabaseStateProvider, prepare=AsyncMock()) + gp._state_instance = MagicMock() + sandbox = AsyncMock(tunnel_urls={18765: "https://gw.example"}) + sandbox.url_from_sandbox = MagicMock(side_effect=lambda url: url.replace("localhost", "host.docker.internal")) + order, composes = [], [] + + async def children(reach): + order.append(("children", reach)) + return [ExternalChild("desktop", "http://localhost:20001/mcp", "http://localhost:20001")] + + def compose(**kwargs): + composes.append(kwargs.get("external_children", ())) + return f"compose {len(composes)}" + + class _Stop(Exception): + """Abort once the gateway's compose up has run.""" + + async def up(sandbox, args=""): + order.append(("up", args)) + if not args: + raise _Stop + + with patch("agent_env.env.env.Env.get", return_value=MagicMock(docker_image_artifact=_loadable("gw"))), \ + patch("agent_env.config.get_config", return_value=MagicMock(default_gateway_env_id="gw-id")), \ + patch.object(gp, "create_docker_compose", side_effect=compose), \ + patch.object(gp, "_compose_up", side_effect=up), \ + pytest.raises(_Stop): + await gp._deploy_via_vm( + sandbox_provider=MagicMock(create_vm=AsyncMock(return_value=sandbox)), + mcp_servers=[MCPServerConfig(image="mcp-slack", environment_name="slack")], mcp_server_images=[_loadable("mcp-slack")], + gateway_port=18765, website_configs=None, website_images=None, gateway_mode=GatewayMode.PERFORMANCE, ttl_seconds=60, + disk_size_gb=10, children=children) + + assert sorted(order[:2]) == [("children", "https://gw.example"), ("up", f"--scale {GATEWAY_SERVICE_NAME}=0")] + assert order[2:] == [("up", "")] + assert composes == [(), (ExternalChild("desktop", "http://host.docker.internal:20001/mcp", "http://host.docker.internal:20001"),)] + written = [shlex.split(call.args[0]) for call in sandbox.exec_script.await_args_list] + assert ["printf", "%s\\n", "compose 2", ">", f"{GATEWAY_APP_DIR}/docker-compose.yml"] in written + + +@pytest.mark.asyncio +@pytest.mark.parametrize("failing", ["children", "up"]) +async def test_a_vm_deploy_whose_children_or_services_fail_raises_once_both_have_ended_and_starts_no_gateway(failing): + from agent_env.env.gateway import GatewayMode + from agent_env.providers.env_state import DatabaseStateProvider + + gp = EnvironmentGatewayProvider() + gp._state_provider = MagicMock(spec=DatabaseStateProvider, prepare=AsyncMock()) + gp._state_instance = MagicMock() + ended = [] + + async def children(reach): + await asyncio.sleep(0.05) + ended.append("children") + if failing == "children": + raise RuntimeError("children") + return [] + + async def up(sandbox, args=""): + assert args, "the gateway started" + ended.append("up") + if failing == "up": + raise RuntimeError("up") + + with patch("agent_env.env.env.Env.get", return_value=MagicMock(docker_image_artifact=_loadable("gw"))), \ + patch("agent_env.config.get_config", return_value=MagicMock(default_gateway_env_id="gw-id")), \ + patch.object(gp, "create_docker_compose", return_value="compose"), \ + patch.object(gp, "_compose_up", side_effect=up), \ + pytest.raises(RuntimeError, match=f"^{failing}$"): + await gp._deploy_via_vm( + sandbox_provider=MagicMock(create_vm=AsyncMock(return_value=AsyncMock(tunnel_urls={}))), + mcp_servers=[], mcp_server_images=[], gateway_port=18765, website_configs=None, website_images=None, + gateway_mode=GatewayMode.PERFORMANCE, ttl_seconds=60, disk_size_gb=10, children=children) + + assert sorted(ended) == ["children", "up"] + + +@pytest.mark.asyncio +async def test_container_mode_starts_children_beside_its_servers_and_hands_the_gateway_each_as_its_provider_reaches_it(monkeypatch): + """Container mode creates the gateway last, so its children get no address of it.""" + from agent_env.env.gateway import ExternalChild, GatewayMode + + monkeypatch.setattr(env_gateway_provider, "sandbox_request_header_names", lambda: ()) + provider = ModalSandboxProvider() + gp = EnvironmentGatewayProvider() + gp._state_provider = LocalPostgresStateProvider() + create_calls, reaches = [], [] + + async def fake_create_container(**kwargs): + create_calls.append(kwargs) + port = kwargs["port"] + if kwargs.get("is_tcp"): + return _FakeSandbox(f"db-{port}", port, f"tcp://db.modal.host:{port}") + return _FakeSandbox(f"sb-{kwargs['image_name']}-{port}", port, f"https://{kwargs['image_name']}.modal.host") + + async def children(reach): + reaches.append(reach) + return [ExternalChild("desktop", "https://desk.example/mcp", "https://desk.example")] + + gateway_env = MagicMock(docker_image_artifact=_image("agent-gateway")) + db_env = MagicMock() + db_env.to_config.return_value = MagicMock(db_image="postgres:16-alpine", db_web_image=None, db_mcp_image=None) + gp._init_service_db_via_exec = AsyncMock() + gp._wait_for_tunnel = AsyncMock(return_value=_CARD) + gp._refuse_tool_name_clashes = AsyncMock() + with patch.object(provider, "create_container", side_effect=fake_create_container), \ + patch("agent_env.env.env.Env.get", side_effect=lambda env_id, *a, **k: gateway_env if env_id == "gw-id" else db_env), \ + patch("agent_env.config.get_config", return_value=MagicMock(default_gateway_env_id="gw-id", default_service_db_env_id="db-id")): + await gp._deploy_via_containers( + sandbox_provider=provider, mcp_servers=[MCPServerConfig(image="mcp-slack", environment_name="slack")], + mcp_server_images=[_image("mcp-slack")], gateway_port=18765, website_configs=None, + gateway_mode=GatewayMode.PERFORMANCE, ttl_seconds=60, disk_size_gb=10, children=children) + + env = create_calls[-1]["env"] + assert reaches == [None] + assert env["INTERNAL_MCP_SERVERS"].split(",")[-1] == "desktop=https://desk.example/mcp" + assert env["REST_PROXY_URLS"].split(",")[-1] == "desktop=https://desk.example"