Skip to content

feat(multi): load, snapshot and reset reach a multi env's computers (FD-4935) - #542

Merged
earakely-scale merged 7 commits into
mainfrom
edgararakelyan/fd-4935-multi-env-computer-lifecycle
Nov 9, 2026
Merged

earakely-scale merged 7 commits into
mainfrom
edgararakelyan/fd-4935-multi-env-computer-lifecycle

Conversation

@earakely-scale

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

Copy link
Copy Markdown
Collaborator

Summary

PR 4a of the FD-4930 + FD-4935 design note: load_artifact, snapshot_env and reset_env reach a multi env's computers, finishing FD-4935's done-when apart from routing sites, which is PR 4b (FD-4936). The decisions are 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.

Loads. An environment artifact named for a computer, or for one of its apps, loads into that computer. In a universe load, the services load as before and each computer's environments then load into it in its own order, its own first and then its apps', after a snapshot restore too. They aren't skipped when an interrupted load resumes, since the resume check reads the services' changelog, which doesn't see a computer's files change.

Reset. reset_env on a multi env resets every child env at once, each as it resets alone (decided Nov 8, revising the Nov 6 decision that servers keep their data). A computer reboots and gets its tools again. An MCP server and a website now have 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. So a task loads again after a reset, 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 and offers no <name>_reset tool) takes no load either and is left as it is; an older server whose only reset is that tool is reset through it with no seed, which puts back the data it boots with, as /api/reset with no seed does. A child whose reset fails fails the reset, each one named, once the others have reset. Before any server is emptied, the instance's record of which services its loads put in is cleared, so the next load reloads every one rather than resuming; a reset that can't clear it empties nothing. No task in prod has a reset_env step, so no existing task changes.

A computer's data plane. legacy_protocol.backing_servers lists each computer of a multi env, and its apps, from the computer's own record in DeployedGatewayEnv.child_envs: at its own address, with its record on the server (BackingServer.record). So snapshot_env, sync_env_clock and apply_server_config reach it with its own control token. Through the gateway's /svc/<computer>/ they couldn't: the gateway carries no token of the computer's, and the card's child guess takes that route for a website's (FD-5227).

Upkeep. BackingServer.owner(deployed) picks the record whose control token a call to a server takes, for every step that calls one. _multi_computers.each awaits a multi env's child envs at once and names each that failed, for loads into computers and for reset. multi_env reaches the instance store through one module import.

Names. A computer's apps' names are no other child env's, at save and in the bundle plan, since loads and snapshots find an environment by its name. The bundle plan also lets a load into a multi env name its computers and their apps.

Test plan

  • Unit: routing a load by name, the universe load's order beside the services (re-ingested and restored), reset of every child env at once (computers from their records, servers and websites attached as a load is, one serving no reset left as it is, each failure named, the loaded-services record cleared), a server's and a website's own reset (data/reset, /api/reset, a 404, a card without data/reset, a plugin's with no data plane), app names, backing_servers listing a computer from its record, and apply_server_config and sync_env_clock sending the computer's own token. The bundle plan: a universe loaded into a multi env seeds its computer and the computer's apps, and two computers sharing an app's name are refused.
  • Integration (slow tier), in the existing multi_env_computers_test.py deployment so the tier's time barely moves: a universe loads the items server's data and a file into the desktop through the multi env, snapshot_env keeps both, and reset_env reboots the computer and empties the server, its file and the items gone and its screenshot answering through the gateway; the same universe loaded again brings both back. multi_env_local_test.py: a multi env without computers resets its servers through reset_env, the items server through data/reset and the older slack server, which serves no card, through /api/reset, both emptied. server_env_local_test.py: a server deployed alone is emptied by reset_env too.
  • VM e2e and chaos on an agent-environments-admin VM (c6i.2xlarge, us-west-2), on 7e890e8, before the servers' reset (e47487d):
    • The integration file, twice: passed both times. The tests this touches passed: computer_env_test.py (a computer snapshotted alone, its framework-only routes), website_browser_test.py, tool_prefix_test.py, multi_env_local_test.py and multi_env_child_envs_local_test.py. 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 desktop, a laptop and the items server:
      • A universe loaded into both computers and the server; snapshotted, each computer's file kept under its name.
      • A snapshot with the desktop's container killed fails, naming it (missing=['desktop']).
      • reset_env through the multi env with the desktop killed beforehand: both computers back at boot state, their files gone, screenshots and items answering through the gateway; loaded again after.
      • The snapshot loaded into a second multi env: both computers' files and the items back.
      • sync_env_clock through the multi env: the server synced; each computer, which advertises no clock, skipped as not_advertised.
      • The teardown left nothing.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with the dependent callers verified at PR #543’s supplied head.

Summary

Extends multi-environment loads, snapshots, and resets to computers and their apps.

  • Multi environments load named artifacts into their computers and apps.
  • Reset clears loaded data across a multi environment's child environments.
  • Computer snapshots and service calls use the computer's own record and token.

The earlier deployment-mixing, load-progress, and legacy-reset findings are addressed. PR #543’s supplied head also uses resets and each, resolving both dependent-caller findings. Those stack checks depend on PR #543; the website-routing caller lives there, not in this PR.

No new actionable issues were found. This review checked code and tests without running them. All supplied previous threads were unnumbered, so previousFindings is empty.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    U[Load universe] --> S[Load or restore services]
    S --> C[Load each computer]
    C --> A[Computer files first, then apps]
    R[Reset multi environment] --> F[Clear saved service progress]
    F --> P[Reset children together]
    P --> B[Reboot computers]
    P --> E[Reset supported services]
    P --> N[Name failed children]
Loading

Reviews (11) · Last reviewed commit: "fix(multi): an older server's reset tool..." · Reviewed by Greptile

…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>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 8, 2026 18:52
Comment thread src/agent_env/env/legacy_protocol.py Resolved
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>
… 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>
Comment thread src/agent_env/env/envs/multi_env.py Resolved
Comment thread src/agent_env/env/envs/_deployment.py Resolved
…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>
earakely-scale and others added 3 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>
…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>
…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>
@earakely-scale
earakely-scale merged commit fc54178 into main Nov 9, 2026
35 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-4935-multi-env-computer-lifecycle branch November 9, 2026 03:40
earakely-scale added a commit that referenced this pull request Nov 9, 2026
…ting branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant