Skip to content

feat(multi): a computer in a multi env routes its websites through the gateway (FD-4936) - #543

Merged
earakely-scale merged 17 commits into
mainfrom
edgararakelyan/fd-4936-multi-env-computer-sites
Nov 9, 2026
Merged

earakely-scale merged 17 commits into
mainfrom
edgararakelyan/fd-4936-multi-env-computer-sites

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

PR 4b of the FD-4930 + FD-4935 design note, stacked on #542: a computer in a multi env reaches the multi env's websites by their names over HTTPS, through its gateway (FD-4936). The decisions are 5 to 7 in the note's section "PR 4a and 4b", proposed on Nov 8 and built on their recommendations; they are settled once you review them.

When it routes. A computer with site_routing in its child_envs entry boots with its boot apps held, through a new sites_later option of the computer provider, since its sites come up with the gateway, which starts after it. Once the gateway is up, before the multi env's record is registered, it routes the multi env's websites through the gateway, once they say they're ready, and launches its held apps; the deploy ends after that, as decision 5 ordered. ComputerEnv.route_sites does the routing, through the provider that booted it. Its record keeps the routed sites, so reset_env routes them again, as it does for a computer alone.

Which sites. site_routing = true routes every website of the multi env; a list names website env ids among them, and any other id is refused at preflight, as is site_routing in a multi env with no websites. A computer's own sites route at boot, as they do alone.

No credentials refusal. The site proxy already holds the provider's request headers as a root-only secret, as for a computer alone that routes a website behind credentials, so a gateway on a Scale sandbox needs no refusal. FD-5334 still covers the gateway reaching a computer.

Tools. A computer's forwarded tools come from its driver's own manifest, not from its apps, so its apps launching after the gateway's start doesn't change the tools the gateway discovered.

Test plan

  • Unit: the provider boots a computer held with sites_later, routes nothing until route_sites, then routes the sites given and keeps them in its record; a site its params can't hold is refused. The multi env deploys each computer routing sites with sites_later, reads the sites from its own record once the gateway is up, waits until they're ready, routes all or the named ones per computer, then records; a routing failure fails the deploy and closes everything; the site_routing refusals.
  • Integration (slow tier), in the existing multi_env_computers_test.py deployment: a small website (the agentenv_website fixture) joins the multi env, and the desktop, with site_routing, loads https://shop.test/api/health inside the computer with the deploy's CA trusted, and again after reset_env. A small MCP server stands in for the website browser a gateway runs beside websites, since only the routing is under test.
  • VM e2e and chaos on an agent-environments-admin VM (c6i.2xlarge, us-west-2), torn down with its security group and key pair:
    • The integration file, twice: passed both times. ca_trust_test.py, a computer alone routing a site, passed. The unit tier passed but for the 5 tests that fail on a VM from an archive, as before.
    • Chaos, on a multi env with the items server, the shop website and three computers: the desktop routing every website, the laptop the one site_routing names, a kiosk none. After each step, whether each computer loads https://shop.test/api/health:
      • Deployed: the desktop and the laptop answer 200, each recording shop.test; the kiosk can't resolve it.
      • The gateway restarted: both answer 200.
      • The website's backend killed: 502; started again: 200.
      • The desktop's container killed, then reset_env through the multi env: both answer 200, the kiosk still not.
      • The teardown left nothing.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the previous shared-name deployment failure is fixed.

Summary

Computers in a multi env can route its websites through the gateway and keep those routes after reset.

  • Multi-env computers can reach selected websites through the gateway.
  • Gateway website discovery keeps same-named sites separate.

Diagram

sequenceDiagram
  participant Multi as Multi env
  participant Computer
  participant Gateway
  Multi->>Computer: Boot with apps held
  Multi->>Gateway: Start websites and gateway
  Gateway-->>Multi: Ready
  Multi->>Computer: Route selected websites
  Computer->>Computer: Launch held apps
  Multi->>Multi: Save deployment record
Loading

Reviews (14) · Last reviewed commit: "fix(sites): two websites of one env whos..." · Reviewed by Greptile

earakely-scale and others added 3 commits November 8, 2026 10:47
…FD-4935)

An environment artifact named for a computer, or for one of its apps, loads
into that computer; a universe load loads each computer's environments after
the services, in the computer's own order, after a snapshot restore too.
reset_env resets each computer as it resets alone. snapshot_env,
sync_env_clock and apply_server_config reach a computer and its apps at the
computer's own address with its control token, from the multi env's record
(legacy_protocol.backing_servers), rather than through the gateway's /svc
route. A computer's apps' names are no other child env's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
backing_servers read another gateway's live card but still listed the
record's computers, so a snapshot through an override gateway could mix
two deployments. A record's child envs now count only when the gateway
asked is the record's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e gateway (FD-4936)

With site_routing in its child_envs entry, a computer boots with its boot
apps held (the computer provider's sites_later), and once the gateway is up
it routes the multi env's websites through it, those site_routing names or
all, and launches its held apps; the deploy ends after that. Its record keeps
the sites, so reset_env routes them again. A site_routing naming none of the
multi env's websites is refused at preflight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 8, 2026 19:14
earakely-scale and others added 3 commits November 8, 2026 11:19
…heck, and the site probe's timeouts are named

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… too

A multi env's reset now resets every child env at once, each as it resets
alone. An MCP server and a website gain a reset of their own: data/reset, or
an older server's /api/reset, empties what loads put in, as each load already
does before it adds, and its changelog starts afresh. A task loads again after,
as after a computer's reboot. One serving no reset (its card leaves data/reset
out, as the website browser's does, or an older server answers 404) takes no
load either and is left as it is. A child whose reset fails fails the reset,
each one named, once the others have reset. The instance's record of which
services its loads put in is cleared, so the next load reloads every one
rather than resuming.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-computer-lifecycle' into edgararakelyan/fd-4936-multi-env-computer-sites

# Conflicts:
#	tst/integration/computer/multi_env_computers_test.py
#	tst/unit/env/envs/test_multi_env_computers.py
earakely-scale and others added 2 commits November 8, 2026 17:13
…ildren, one store import

- BackingServer.owner(deployed) is the record whose control token a call to the
  server takes; apply_server_config, snapshot_env and sync_env_clock use it
  rather than each spelling the choice.
- _multi_computers.each awaits a multi env's child envs at once and names each
  that failed; a load into several computers now does as a reset does, rather
  than raising the first failure and logging the rest.
- multi_env reaches the instance store through one module import, so a test
  patching agent_env.env.store reaches every path, and a snapshot restore
  forgets the loaded services through the same helper a reset does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…outing names each computer that fails too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale and others added 7 commits November 8, 2026 17:20
…d an older tool-only server isn't skipped

- MultiEnv.reset forgets which services the instance's loads put in before any
  server is emptied, and empties nothing when it can't: a reset also clears the
  changelog, so a resumed load would otherwise skip a service it had emptied.
- An older MCP server answering 404 at /api/reset that offers a <name>_reset
  tool resets only to a seed that tool loads, so its reset fails, naming it,
  rather than being left as a server that takes no load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-computer-lifecycle' into edgararakelyan/fd-4936-multi-env-computer-sites

# Conflicts:
#	tst/unit/env/envs/test_multi_env_computers.py
…a restore without computers none

A universe load read the universe's environments again at its end to load
the computers', even into a multi env with none, and on a snapshot restore,
which never read them before. A re-ingest now reads them once for the services
and the computers alike, a restore reads them only for computers to load, and
a multi env without computers loads none: as before computers, a restore no
longer fails on an environment it never needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-computer-lifecycle' into edgararakelyan/fd-4936-multi-env-computer-sites
…ps launch with the trust, a bad selection is refused

- A computer's site_routing selection names websites by env id, which the
  multi env maps to environment_names, while deployed_sites names each site by
  its card; a card named apart from its environment_name was silently left out.
  deployed_sites takes the names sites are served as (services), and each
  routing computer reads those it selects.
- A computer routing sites later boots with the trust variables, as one knowing
  its sites does: its held apps launch through the app server, which only has
  the environment the computer booted with, and the bases hold the trust files
  from boot, the public roots and no CA until routing adds one.
- A site_routing list of other than ids is left to the computer's own params
  check to refuse, rather than raising TypeError in the multi env's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nv covered for servers alone and in a multi env

- An older MCP server answering 404 at /api/reset that offers its <name>_reset
  tool is reset through it with no seed, which puts back the data it boots
  with, as /api/reset with no body does; only a tool that fails fails the
  reset. reset_via_mcp_tool takes no seed and returns the tool's answer.
- Integration: a multi env without computers resets its servers through the
  reset_env step, the items server through data/reset and the older slack
  server, which serves no card, through /api/reset; a server deployed alone is
  emptied too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-computer-lifecycle' into edgararakelyan/fd-4936-multi-env-computer-sites
Base automatically changed from edgararakelyan/fd-4935-multi-env-computer-lifecycle to main November 9, 2026 03:40
earakely-scale and others added 2 commits November 8, 2026 19:43
…ting branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… named as they're served

deployed_sites named each website by its card, and only told apart sites of
different envs that share a name, so two websites of one env whose cards name
them alike (two of one image, say) were both named the same, and a computer
routing them refused "two sites are named ...", failing a multi env's deploy
after its computers and gateway were up. An env's sites are now named by their
cards unless two of its cards share a name; then each is named as it's served,
its environment_name, which the gateway routes each by. A website built on the
agentenv SDK serves its environment_name as its card's name, so it never did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit 961e6c8 into main Nov 9, 2026
34 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-4936-multi-env-computer-sites branch November 9, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant