Skip to content

Support durable directories and combined restore for gVisor - #1379

Merged
Zoe Zhao (zoez7) merged 1 commit into
agent-substrate:mainfrom
nybidari:gv-durDir
Sep 2, 2026
Merged

Zoe Zhao (zoez7) merged 1 commit into
agent-substrate:mainfrom
nybidari:gv-durDir

Conversation

@nybidari

@nybidari nybidari commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator
  • Use direct host bind mounts for durable directories in gVisor containers instead of internal overlay filestores.
  • Move tarutil into internal/tarutil so it can be shared across ateom packages.
  • Archive durable directory bind mounts into durable-dir.tar on full and data checkpoints (replacing runsc fscheckpoint).
  • On restore, unpack durable-dir.tar into the host bind mount before starting/restoring containers.
  • Support SNAPSHOT_SCOPE_DATA_ON_GOLDEN in ateom-gvisor, combining golden guest state with latest actor durable data.
  • Allow atelet to narrow full gVisor captures to durable-dir.tar for data snapshots.
  • Remove CEL validation disallowing onResume.fromData: Golden for gVisor, and enable combined restore demo tests for gVisor.

Fixes #451

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being deleted in #1376, please use the substrate proto ActorTemplate instead.

message ActorTemplate {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated the changes.

Comment thread cmd/ateom-gvisor/runsc.go Outdated
Comment on lines +234 to +238
// "-debug",
// "-debug-log", ateompath.RunscDebugLogDir(r.actorUID, containerName) + "/",
// "-debug-to-user-log",
// "-log-packets",
// "-strace",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we should write these to the debug mode for the ateom, that can be a follow-up but generally prefer to do that over leave commented lines :-)

@nybidari nybidari Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the commented debug flags now, will have a follow up PR to wire these flags to ateom's debug mode.

Comment thread cmd/ateom-gvisor/main.go
}
case ateompb.SnapshotScope_SNAPSHOT_SCOPE_FULL:
// Checkpoint pause container (root of the sandbox)
if err := rcmd.cmdCheckpoint(ctx, "pause", checkpointPath); err != nil {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be pause -> tar -> checkpoint instead of checkpoint -> tar? Or IOW is this the right failure handling for just resuming if the disk is transiently full or something?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a TODO

Comment thread cmd/ateom-gvisor/main.go
Comment on lines +763 to +766
tarErr := tarDurableVolumes(ctx, ateompath.DurableDirVolumeMountsDir(req.GetActorUid()), checkpointPath)
if err := rcmd.cmdResume(ctx, "pause"); err != nil {
return nil, fmt.Errorf("while resuming pause container: %w", err)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude surfaced:

Suggested change
tarErr := tarDurableVolumes(ctx, ateompath.DurableDirVolumeMountsDir(req.GetActorUid()), checkpointPath)
if err := rcmd.cmdResume(ctx, "pause"); err != nil {
return nil, fmt.Errorf("while resuming pause container: %w", err)
}
tarErr := tarDurableVolumes(ctx, ateompath.DurableDirVolumeMountsDir(req.GetActorUid()), checkpointPath)
// Undoing our own pause must not depend on the caller's context:
// tarutil does not check ctx, so a deadline expiring mid-tar would
// fail the resume instantly and leave the sandbox paused forever.
resumeCtx, cancelResume := context.WithTimeout(context.WithoutCancel(ctx), resumeTimeout)
defer cancelResume()
if err := rcmd.cmdResume(resumeCtx, "pause"); err != nil {
return nil, fmt.Errorf("while resuming pause container: %w", err)
}

I think that's right, or some variation on it, the alternative is to make tarutil context aware, but that seems like a bigger lift for this PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated the changes.

@nybidari
nybidari force-pushed the gv-durDir branch 3 times, most recently from 9ef5cd1 to 8815804 Compare September 2, 2026 20:00
@zoez7

Copy link
Copy Markdown
Collaborator

Needs a rebase. The test failure was fixed on main.

- Use direct host bind mounts for durable directories in gVisor containers
  instead of internal overlay filestores.
- Move tarutil into internal/tarutil so it can be shared across ateom packages.
- Archive durable directory bind mounts into durable-dir.tar on full and
  data checkpoints (replacing runsc fscheckpoint).
- On restore, unpack durable-dir.tar into the host bind mount before
  starting/restoring containers.
- Support SNAPSHOT_SCOPE_DATA_ON_GOLDEN in ateom-gvisor, combining golden
  guest state with latest actor durable data.
- Allow atelet to narrow full gVisor captures to durable-dir.tar for data
  snapshots.
- Enable combined restore demo tests for gVisor with proto ActorTemplate.
@zoez7

Copy link
Copy Markdown
Collaborator

Added e2e test in #1365 to test downgrading from Full -> DurDir. Test passed.

@zoez7
Zoe Zhao (zoez7) merged commit 4064d79 into agent-substrate:main Sep 2, 2026
10 of 11 checks passed
@BenTheElder

Copy link
Copy Markdown
Collaborator

Thanks!

@HavenXia

Copy link
Copy Markdown
Member

This also fixes #817

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.

Support resuming actors with golden memory snapshot and DurableDirectory

4 participants