Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/agent_env/computers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,27 +169,27 @@ are, under a tag of its recipe, so another machine composing on it pulls it rath
no ISO. A compose installs a base afresh once fewer than 7 days of its evaluation are left, from the ISO Microsoft's
link serves then. Name it as `windows-11`, or by its id, `@local/agentenv-framework/computers/windows-11`.

A Windows computer env is composed on the same machine (`env/envs/computer/utils/windows_disk.py`): the base booted on
an overlay kept in a folder of its own, each layer installed over ssh as `agentadmin` by a PowerShell script composing
writes, as its `[install.windows]` says (its files under `C:\agentenv\drivers\<name>`, or an app's under
`C:\agentenv\apps\<name>`, its downloads checked by sha256, its venv on the pinned Python, its PowerShell run scripts,
elevated, an app's install steps, elevated too, and its services), then shut down and
packed onto the base's image, so every computer composed on a base shares one copy of it, and pushed to the env's image
store under its key, pinned, as a Linux disk is; a compose of the same inputs on any machine reuses it, and a deploy
pulls it. Gate 3 probes it at full. At the session user's sign-in,
`agentenv-session`, run windowless by `pythonw`, reads the deploy's environment from the NoCloud seed, which the
launcher attaches as a removable USB drive, since Windows mounts a FAT filesystem with no partition table on removable
media alone, and starts each layer's services in that session, again whenever one exits. A Windows computer boots
with 4 vCPUs and 8 GB, on local Docker with KVM and on `modal_vm`; it has computer-exec and data/add, through the
protocol's Windows defaults, so the probe runs its fixture there as on Linux, with Python one-liners for the commands it
would give a shell. On `modal_vm` it runs in your own Modal workspace, under the evaluation's terms or a licence of your
own; whether they allow it there is yours to check. Composing leaves `C:\agentenv` the admins', as `/opt/agentenv` is
root's on Linux: every user, and every sandboxed process (Chrome's, as Program Files allows it), reads and runs
what's there, and the session user writes only the services' logs and each
app's `.agentenv` folder. An app's own server runs in the session as its services do, on a loopback port it writes
with a token to that folder, which only the session user, SYSTEM and Administrators reach; it launches the app in a
Job object, which ends whatever the app started. Composing signs in as `agentadmin`, so
an app's install step for the session user can't run on Windows, and gate 1 refuses an app that declares one there.
A Windows computer env is composed on the same machine as a thin disk (`env/envs/computer/utils/thin_disk.py`, with
what's Windows' own in `windows_disk.py`): the base booted on an overlay kept in a folder of its own, each layer
installed over ssh as `agentadmin` by a PowerShell script composing writes, as its `[install.windows]` says (its files
under `C:\agentenv\drivers\<name>`, or an app's under `C:\agentenv\apps\<name>`, its downloads checked by sha256, its
venv on the pinned Python, its PowerShell run scripts, elevated, an app's install steps, elevated too, and its
services), then shut down and packed onto the base's image, so every computer composed on a base shares one copy of it,
and pushed to the env's image store under its key, pinned, as a Linux disk is; a compose of the same inputs on any
machine reuses it, and a deploy pulls it. Gate 3 probes it at full. At the session user's sign-in, `agentenv-session`,
run windowless by `pythonw`, reads the deploy's environment from the NoCloud seed, which the launcher attaches as a
removable USB drive, since Windows mounts a FAT filesystem with no partition table on removable media alone, and starts
each layer's services in that session, again whenever one exits. A Windows computer boots with 4 vCPUs and 8 GB, on
local Docker with KVM and on `modal_vm`; it has computer-exec and data/add, through the protocol's Windows defaults, so
the probe runs its fixture there as on Linux, with Python one-liners for the commands it would give a shell. On
`modal_vm` it runs in your own Modal workspace, under the evaluation's terms or a licence of your own; whether they
allow it there is yours to check. Composing leaves `C:\agentenv` the admins', as `/opt/agentenv` is root's on Linux:
every user, and every sandboxed process (Chrome's, as Program Files allows it), reads and runs what's there, and the
session user writes only the services' logs and each app's `.agentenv` folder. An app's own server runs in the session
as its services do, on a loopback port it writes with a token to that folder, which only the session user, SYSTEM and
Administrators reach; it launches the app in a Job object, which ends whatever the app started. Composing signs in as
`agentadmin`, so an app's install step for the session user can't run on Windows, and gate 1 refuses an app that
declares one there.

This bundle has no tasks of its own: other bundles pull its computers by alias, and `agent-env run computers` has
nothing to run.
9 changes: 5 additions & 4 deletions src/agent_env/env/envs/computer/utils/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
macos_vm_bundle,
packages,
probing,
thin_disk,
windows_disk,
)
from agent_env.env.envs.computer.utils.composed import BUILT, REPOSITORY, Record, failed, now, stale
Expand Down Expand Up @@ -394,7 +395,7 @@ def say(line: str) -> None:
progress.say(f"{pair}: {line}")

attempt.stage = "base"
registry = windows_disk.Registry(_image_store(env), REPOSITORY)
registry = thin_disk.Registry(_image_store(env), REPOSITORY)
disk_gb, user = base.forms.disk.min_disk_gb, base.session.user
made = windows_disk.base(_key(recipe=_digest(windows_disk.RECIPE), disk_gb=disk_gb, user=user,
form="windows-base", format=FORMAT),
Expand All @@ -407,14 +408,14 @@ def say(line: str) -> None:
attempt.stage = "build"
with holding_locks([f"windows-disk:{key}"], lambda: progress.at(
pair, "waiting", "waiting for the compose of the same disk under way on this machine")):
if (pinned := registry.served(windows_disk.disk_names(key).tag)) is not None:
if (pinned := registry.served(thin_disk.disk_names(windows_disk.GUEST, key).tag)) is not None:
progress.at(pair, "reusing", "reusing the disk of the same key, composed earlier")
result = {"status": "unverified", "key": key, "image": pinned, "reused": True, "expires": expires,
"built_at": now()}
else:
progress.at(pair, "composing", "composing on this machine's Docker")
pinned = windows_disk.compose(made, build, key,
{KEY_LABEL: key, windows_disk.EXPIRES_LABEL: expires}, say, registry)
pinned = thin_disk.compose(windows_disk.GUEST, made, build, key,
{KEY_LABEL: key, windows_disk.EXPIRES_LABEL: expires}, say, registry)
result = {"status": "unverified", "key": key, "image": pinned, "reused": False,
"builder": "LocalSandboxProvider", "expires": expires, "built_at": now()}
return _probed(env, driver, "disk", arch, result, provider, progress)
Expand Down
Loading
Loading