Skip to content

fix(computer): Windows computers record to a local store, run sandboxed apps, and export held files - #549

Merged
earakely-scale merged 8 commits into
mainfrom
edgararakelyan/fd-5315-disk-vm-grants
Nov 9, 2026
Merged

earakely-scale merged 8 commits into
mainfrom
edgararakelyan/fd-5315-disk-vm-grants

Conversation

@earakely-scale

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

Copy link
Copy Markdown
Collaborator

Part of FD-5315.

The bench's Windows trials hit three gaps in how a Windows computer runs on local Docker. This PR fixes all three; each is a separate commit.

  1. A recording never reached a local object store. Every segment was captured, but each upload failed with transfer_unavailable. The guest couldn't resolve host.docker.internal, the host local grants name (confirmed inside a Windows guest: getaddrinfo failed), and wasn't given the local transfer CA to trust. Linux disk VMs on local Docker had the same gap.
  2. A sandboxed app couldn't run its own program. Chrome for Testing, installed under C:\agentenv, failed with Sandbox cannot access executable ... Access is denied; then its network service crashed and no page loaded.
  3. data/get failed on an app that holds its files. Chrome and every Electron app hold profile files so that no other process may read them, and pausing the app doesn't release them. So data/get, the snapshots built on it, and gate 3's probe failed with WinError 32. On the bench's G04, 47 of the workspace's 281 files were held.

What changes

1. Local grants reach a disk's computer, as lume's VMs already do

The grant URL stays https://host.docker.internal:<port>/...; the guest is what learns to reach it.

  • The name. Both guests map host.docker.internal to 10.0.2.2, the address QEMU's user network always gives the launcher. Windows' base setup writes it to the hosts file once; Linux's boot init writes it into /etc/hosts.
  • The forward. The launcher gains VM_HOST_PORTS: for each port, socat on the container's loopback forwards to host.docker.internal on the Docker host, where the grant server listens. A host port that collides with a guest port's proxy or forward is refused with the reason.
  • The trust. The launcher gains VM_TRUST, a folder of trust files it copies into the seed as trust/. Windows' agentenv-session and Linux's init point SSL_CERT_FILE, REQUESTS_CA_BUNDLE and NODE_EXTRA_CA_CERTS at them, as containers get. The seed's own variables still win.
  • The provider. When the store hands out grants, the local Docker provider passes the grant server's port and the CA's trust folder (a read-only bind mount) to a disk's launcher, plus --add-host host.docker.internal:host-gateway on Linux. lume's private helper for the port and trust files is now shared.
  • Another process. Each process serves grants on a port of its own. So when another process reconnects to a disk's computer (get_sandbox), the provider forwards that process's port into the launcher too, as lume does. A reset reconnects before it hands the computer anything. A teardown terminates the computer by id, with no forward.

2. Sandboxed apps read and run their own program under C:\agentenv

#540's lockdown granted only Administrators, SYSTEM and Users. A sandboxed process, such as Chrome's renderers and network service, runs as the app package identities, which Program Files grants read and run. The lockdown now grants ALL APPLICATION PACKAGES (S-1-15-2-1) and ALL RESTRICTED APPLICATION PACKAGES (S-1-15-2-2) read and run too, the access Users already have. Nothing becomes writable, and each app's .agentenv folder keeps its own private access list.

3. data/get of a held file stops the app, copies, and relaunches it

The default data/get still copies the app's paths with the app paused. Only when that copy hits a file the app holds (Windows' sharing or lock violation, errors 32 and 33), get raises HeldByApp. For that error alone, the data plane stops the app, copies again in what's left of the call's data_timeout_s, and relaunches it, with data/get as the launch's cause. Apps that hold nothing keep the pause, and POSIX never raises those errors. An app whose own data/get hook calls get gets the same.

Costs and follow-ups

  • A once-off cost on every machine. Windows' base setup and session script change, so a machine installs a fresh Windows base once (about 13 minutes). The lockdown is part of every Windows disk, so each recomposes once. Linux disks recompose once, as their init changed.
  • Follow-up: a run resumed with agent-env task run --start-step that records on a kept local disk computer without reconnecting would hand the guest an unreachable grant. lume's VMs have the same gap.
  • Follow-up: FD-5363, data/get on Windows without restarting the app, for example through Volume Shadow Copy, which needs a privileged helper.

Tests

  • Unit (box 2):
    • test_disk_recipe.py and the sandbox providers' tests:
      • the launcher forwards a host port, refuses one a guest port takes, and seeds the trust folder;
      • with a local store's grants, a disk's launcher gets the forward, the trust mount and the host mapping, and a reconnect from another process forwards its own port, but a teardown doesn't;
      • lume's tests patch the shared helper.
    • test_computer_windows.py: the session points TLS clients at a seed's trust folder and at nothing without one; the lockdown line grants the app package identities.
    • The protocol suite (1353 passed), including: an export of a file the paused app holds stops it, copies it, and relaunches it; the copy with the app stopped gets only what's left of the call's time limit.
    • launch forward serves a host port as the boot does, and both guests' trust variables match trust_env()'s (1792 passed across these files at the final commit).
  • Windows end to end (box 2, a fresh base from Microsoft's ISO), the bench's trials with cua-driver and Sonnet 5.5:
    • IR-01 r1 foreground: passed (grade 1, GUI-only 1). Its recording ended with 3 segments uploaded, 0 missing; before this change, 0 of 3. The bench's exporter joined them into a 1920x1080, 34.8 s video and built its timeline.
    • G02 and G03 foreground (Electron apps, LibreOffice, GnuCash): composed, ran and were graded end to end, with GUI-only clean and every recording segment uploaded (12 and 15).
    • G04 foreground (Node, Chrome for Testing, two Electron apps): before this PR, its desk couldn't compose: first Chrome's sandbox couldn't read chrome.exe, then the probe's data/get hit Chrome's and Electron's held files. With it, the desk composed and passed gate 3's probe, whose data/get copied with the apps stopped and relaunched them. The trial ran and was graded, with its end snapshot taken the same way (32 s), GUI-only clean and 12 of 12 segments uploaded.
  • Linux disk end to end: the recording bundle's task, deployed with form = "disk" (the desktop's disk composed, then booted under KVM), passed; its recording ended with its segment uploaded, 0 missing.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the latest change skips an unnecessary grant forward without changing cleanup.

Summary

This PR lets disk computers reach local upload grants, gives sandboxed Windows apps read-and-run access to their programs, and retries held-file exports with the app stopped.

  • Local Docker disk computers can now reach local file grants.
  • Windows sandboxed apps can run programs under C:\agentenv.
  • File exports retry with the app stopped when it holds a file.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Reconnect[Reconnect by id] --> Found[Restore saved sandbox handle]
    Found --> Forward[Forward this process's grant port for disks]
    Forward --> Use[Return sandbox]
    Teardown[Terminate by id] --> Restore[Restore saved sandbox handle]
    Restore --> Stop[Run existing sandbox cleanup]
Loading

Reviews (11) · Last reviewed commit: "fix(local): a teardown terminates a disk..." · Reviewed by Greptile

…s a container does

A Windows computer's recording never reached a local object store: its guest couldn't resolve host.docker.internal,
the host local grants name, nor trust the local transfer CA. As lume's VMs do, the guest now maps that name to
10.0.2.2, QEMU's address for the launcher, which forwards the grant server's port to this machine (VM_HOST_PORTS), and
the CA's trust files ride in the seed (VM_TRUST), where Linux's init and Windows' agentenv-session point TLS clients
at them. The local provider passes both when the store hands out grants; lume's helper for them is now shared.

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 9, 2026 02:41
earakely-scale and others added 4 commits November 8, 2026 19:04
…ards its own grant port

Each process that hands a computer grants serves them on a port of its own, so a reconnect forwards this process's
into the launcher, as lume's VMs get theirs.

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

C:\agentenv granted only Administrators, SYSTEM and Users, so Chrome's sandbox, whose processes run as the app
package identities, couldn't read chrome.exe there: its network service crashed and no page loaded. The lockdown now
grants ALL APPLICATION PACKAGES and ALL RESTRICTED APPLICATION PACKAGES read and run, as Program Files does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…copies it, and relaunches it

Windows lets an app hold a file so that no other process may read it, as Chrome and Electron hold their profiles, and
a pause doesn't release it, so data/get, snapshots and gate 3's probe failed with WinError 32 on such an app. Where the
paused copy hits a sharing or lock violation, the data plane stops the app, copies, and relaunches it, with data/get as
the launch's cause; an app holding nothing keeps the pause.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…raises, as both sessions do

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nned to a container's, and named checks

The launcher's forward is one function, behind launch forward PORT, which a reconnect runs rather than spelling socat
out again, guarded for a launcher older than it; a test pins both guests' trust variables to trust_env's; the provider
names its disk check, logs a forward it couldn't make and finds the granting store in one place; the data plane's
held-file retry is a helper of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale earakely-scale changed the title fix(computer): a disk's computer on local Docker uses local grants, as a container does fix(computer): Windows computers record to a local store, run sandboxed apps, and export held files Nov 9, 2026
earakely-scale and others added 2 commits November 8, 2026 21:03
…s left of data_timeout_s

The retry after a held file had a second full window, so a large export that met a held file late could take nearly
twice the app's data_timeout_s. Both attempts now share one deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g a grant port into it

terminate_sandbox reconnected through get_sandbox, which now forwards this process's grant port into a disk's
launcher, so every local disk run ended by forwarding into a computer it was removing, and warned when the launcher
was already gone. The local provider terminates by id without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit 73cd545 into main Nov 9, 2026
115 of 122 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-5315-disk-vm-grants branch November 9, 2026 06:55
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