Skip to content

Support runtime-only golden snapshots with shared volumes - #2683

Draft
Salah (spichen) wants to merge 13 commits into
agent-substrate:mainfrom
spichen:runtime-golden-volumes
Draft

Salah (spichen) wants to merge 13 commits into
agent-substrate:mainfrom
spichen:runtime-golden-volumes

Conversation

@spichen

@spichen Salah (spichen) commented Oct 14, 2026 •

Copy link
Copy Markdown

Shared-volume deletion could race actor creation or release storage after failed node cleanup. This change makes actor creation and reference binding transactional, fences storage deletion with a persistent DELETING state and version guard, and retains ownership until termination and detach succeed.

Adds opt-in GOLDEN_SNAPSHOT_MODE_RUNTIME for microVM and gVisor actors with shared CSI volumes. Capture precedes application startup; each clone attaches its selected volumes and starts fresh applications. Later own snapshots preserve application memory. Application-warm volume substitution remains out of scope.

Review fixes

  • Merged upstream main 6edd1fcc, including the ateworker rename and current worker/proto APIs.
  • Added atespace-scoped authorization for all five SharedVolume RPCs: viewer read/list, editor create/update/delete, globalviewer global list.
  • Moved shared claims immediately before attach; roll back partial claims and clean up failed resumes before releasing ownership. Persist refreshed driver metadata before attach.
  • Added PostgreSQL concurrency/rollback, delete-fencing, failed-cleanup, authorization and RUNTIME CreateActor/restore regressions.
  • Added required runtime-golden coverage to both preview-enabled microVM and gVisor CI lanes.
  • Write the gVisor marker before checkpoint teardown, use Spec.RuntimeGolden, skip RUNTIME warmup, and compile the boot identity marker only with e2e_runtime_identity.
  • Document crash recovery and the breaking externalVolumeTemplate → external.template upgrade. Following the repository's pre-1.0 schema policy, no reserved field or compatibility decoder was added; stored templates are not automatically migrated.

This draft includes the shared-volume prerequisite from #2567 in its diff against main.

Validation of review fixes (c978b0d8)

  • Full race suite completed. Its only failures were unchanged color-formatting tests affected by this shell's NO_COLOR=1; that package passed with the variable removed. The corrected PostgreSQL package also passed its race recheck.
  • PostgreSQL-backed lifecycle, concurrency and authorization tests used REQUIRE_DOCKER=true against the existing Colima daemon.
  • Both Linux worker unit suites and Linux builds passed; the tagged microVM build passed.
  • All repository verifier checks passed. The runner initially stopped at metrics due to the stopped default Docker daemon; metrics and every remaining check passed with the running Colima daemon selected.
  • Fresh live runtime E2E and latency tests have not been rerun for this fix head. CI now requires both runtime lanes.

Historical runtime validation (e3382628)

The earlier OCI run passed API-level runtime-golden/NFS CSI tests for both runtimes with two actor bindings and two own-snapshot generations. gVisor preserved deleted-open contents and passed a separate low-level cross-host restore experiment. This evidence predates the review fixes.

Latency

4-OCPU/32-GB OCI E5.Flex primary, one kind node, two workers, real NFS CSI. Each runtime/mode has 100 successful measured activations plus five excluded warmups; all 600 measured activations succeeded. Modes were randomized, concurrency was one, and images/assets/caches were warm. Timing covers ResumeActor through identity and successful NFS write/read. Builds/checks and cross-host work ran outside the measurement window.

Runtime Activation p50 p95 Maximum
microvm cold 744 ms 1679 ms 3812 ms
microvm runtime-golden 535 ms 2308 ms 7205 ms
microvm own 415 ms 1967 ms 3996 ms
gvisor cold 134 ms 142 ms 153 ms
gvisor runtime-golden 147 ms 155 ms 166 ms
gvisor own 152 ms 164 ms 173 ms

MicroVM runtime-golden median was 28% lower than cold boot, but its p95 was worse in this run. gVisor runtime-golden median was 10% higher than cold boot. These small-probe measurements do not establish a universal speedup or production SLA.

Remaining limitations

  • Application-warm substitution of arbitrary volumes is outside this feature's scope.
  • MicroVM deleted-open files still return EIO at the second own restore in this fixture; orphan-inode persistence in virtiofsd remains unresolved.
  • Cross-host microVM restore is not established. The public VolumeMount API still has no per-mount read-only/subpath fields; those cross-host checks used explicit low-level OCI mounts.
  • Broader live failure injection, concurrent load and cold-cache performance remain unvalidated.

Resource cleanup

Both temporary OCI instances and their boot volumes are confirmed TERMINATED. The temporary network resources were deleted and independently checked after deletion.

hajiler and others added 7 commits October 14, 2026 10:31
The ActorTemplate volume union now carries one CSI member, Volume.external
(ExternalVolumeSource), whose template member replaces
external_volume_template; a member for shared volumes follows after GA. The
per-actor record on ActorStatus.external_volumes becomes ExternalVolumeRef,
freeing the plain name for the atespace-scoped resource, and atelet's resolved
handle becomes ExternalVolume to match its sibling volume messages.

Templates that still carry external_volume_template must be recreated.

Fixes agent-substrate#2407, agent-substrate#2436.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
An EmptyDirVolume is an empty host directory at the same path an external
volume would be published to, mounted into the sandbox the same way. It lets a
golden actor warm up against a placeholder for an external volume it must not
mount, so the snapshot's mount table matches the real actor's on both gVisor
and microVM.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A SharedVolume is an atespace-scoped CSI volume whose lifetime is
independent of any actor. It is provisioned from a StorageClass or registers a
volume that already exists, carries an immutable access mode, and is removed
either manually or when the last actor referencing it is deleted, according to
its delete trigger. Deleting the record also deletes the storage.

This adds the resource, its Postgres table and store methods, the
create/get/list/update/delete RPCs, and kubectl-ate commands. Nothing
references a volume yet; actor references arrive separately.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A template volume whose external source names a shared_volume mounts a
SharedVolume instead of provisioning one per actor. The reference names the
volume, or leaves the name empty so each actor binds it at creation through
Actor.shared_volume_bindings.

Every actor referencing a volume is recorded in the volume's refs, with active
set while the actor is resumed. Resume refuses a READ_WRITE_ONCE volume another
actor holds active, pause and suspend mark the reference inactive, crash leaves
it as is, and delete removes it and deletes a LAST_ACTOR volume that no actor
references any more. Golden actors never reference a volume; they warm up
against an empty directory at the same mount path.

Depends on the empty_dir volume source and the SharedVolume resource.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The golden actor warms up against a local empty directory in place of a
shared volume, but runsc derives the disable_file_handle_sharing mount option
from the bind source's filesystem and refuses a restore whose mount options
differ from the checkpoint's. On NFS the first resume of every such actor
therefore failed with "Mounts" does not match across checkpoint restore.

Actors created from a template that references a SharedVolume no longer seed
from the golden tag: the first resume boots from the image and later resumes
restore the actor's own snapshot, which was taken over the real volume. An
explicit source tag is refused for these templates. Golden restores for
shared volumes remain follow-up work, tracked by TODO(shared-volumes).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@google-cla

google-cla Bot commented Oct 14, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@spichen Salah (spichen) changed the title Support runtime golden snapshots for microVM actors with shared volumes Support runtime-only golden snapshots with shared volumes Oct 15, 2026
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.

2 participants