Read-only data mounts with a disposable writable layer #6

Open
opened 2026-10-01 09:20:28 +00:00 by jan · 0 comments
Owner

Motivation

A project can depend on large test data that is not in Git (tens of GB of
scene files, XML, images). The agent must be able to read all of it, should be
able to write next to it during a test run (open a file, save it, produce
output), and must never change the host copy.

Copying it into the VM is too slow and too big. Cloning is not an option.

Proposal

  • Manifest entry data = <path> (see #3 (Multi-repo projects: design)), mounted
    read-only with sbx create ... <path>:ro.

  • Inside the VM, an overlayfs over the read-only mount:

    lower   /run/sandbox/<data>     read-only host mount
    upper   ~/.agentbox/data/<name>/upper
    merged  <project>/<data>        what the agent and the code see
    

    The project sees its usual sibling path and can write; writes land in the
    VM only.

  • agentbox data reset [name] drops the upper layer, back to the host state.

  • agentbox-orient and the briefing say which paths are data mounts, that
    writes are discarded on reset, and how much the upper layer holds.

Open points

  • overlayfs needs root: does the sandbox user have passwordless sudo in every
    template, and does sbx's mount type (virtiofs?) work as a lower layer?
  • Read throughput of large files through the mount, on Linux and on Windows.
    Measure before relying on it.
  • Secret preflight: the filename check should also run over data mounts.
  • VM disk size: the upper layer can grow; say so in status.

Done when

e2e: a fake data folder is visible at its sibling path, a write inside the VM
succeeds, the host file is unchanged, and data reset restores the original.

## Motivation A project can depend on large test data that is not in Git (tens of GB of scene files, XML, images). The agent must be able to read all of it, should be able to write next to it during a test run (open a file, save it, produce output), and must never change the host copy. Copying it into the VM is too slow and too big. Cloning is not an option. ## Proposal - Manifest entry `data = <path>` (see #3 (Multi-repo projects: design)), mounted read-only with `sbx create ... <path>:ro`. - Inside the VM, an overlayfs over the read-only mount: ```text lower /run/sandbox/<data> read-only host mount upper ~/.agentbox/data/<name>/upper merged <project>/<data> what the agent and the code see ``` The project sees its usual sibling path and can write; writes land in the VM only. - `agentbox data reset [name]` drops the upper layer, back to the host state. - `agentbox-orient` and the briefing say which paths are data mounts, that writes are discarded on reset, and how much the upper layer holds. ## Open points - overlayfs needs root: does the sandbox user have passwordless sudo in every template, and does sbx's mount type (virtiofs?) work as a lower layer? - Read throughput of large files through the mount, on Linux and on Windows. Measure before relying on it. - Secret preflight: the filename check should also run over data mounts. - VM disk size: the upper layer can grow; say so in `status`. ## Done when e2e: a fake data folder is visible at its sibling path, a write inside the VM succeeds, the host file is unchanged, and `data reset` restores the original.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jan/agentbox#6
No description provided.