Skip to content

Add standby / restore + fork support for Mac vz hypervisor#115

Merged
sjmiller609 merged 13 commits intomainfrom
codex/mac-standby-support
Mar 3, 2026
Merged

Add standby / restore + fork support for Mac vz hypervisor#115
sjmiller609 merged 13 commits intomainfrom
codex/mac-standby-support

Conversation

@sjmiller609
Copy link
Collaborator

@sjmiller609 sjmiller609 commented Feb 27, 2026

Summary

  • teach the VZ shim about save/restore state, snapshot manifest handling, and platform configuration so standbys serialize RAM on macOS 14+ ARM
  • extend the higher-level VZ hypervisor client and starter to expose Snapshot()/RestoreVM() plus runtime validation and manifest wiring
  • document the new behavior and add an integration test that exercises the full VZ standby/restore cycle

Testing

  • Added integration test

Note

Medium Risk
Adds VZ snapshot save/restore and manifest-based restore/fork flows, touching VM lifecycle control paths and hypervisor abstractions. Main risk is snapshot/restore compatibility and path/identity rewrites causing restore failures, though changes are largely gated to darwin/arm64 and covered by new integration tests.

Overview
Enables standby/restore on macOS VZ by teaching vz-shim to save/restore VM machine state and persist a snapshot manifest (config.json + machine-state.vzm), including a stable platform machine identifier for restore compatibility.

Extends the VZ hypervisor implementation to expose Snapshot() and RestoreVM() (arm64-only capability), adds a shim /api/v1/vm.snapshot endpoint, updates VM state mapping for saving/restoring transitions, and introduces VZ snapshot-manifest rewriting so forking from standby/running works (with vsock socket naming registered via hypervisor.VsockSocketNameForType).

Updates docs and CI/test harness: clarifies standby/restore semantics/requirements, adds macOS 14+/arm64 integration tests for VZ standby/restore and running-source fork, and makes Go test timeouts configurable via GO_TEST_TIMEOUT.

Written by Cursor Bugbot for commit d481c16. This will update automatically on new commits. Configure here.

@sjmiller609 sjmiller609 changed the title Add VZ snapshot/restore support and tests Add standby / restore support for Mac vz hypervisor Feb 28, 2026
@sjmiller609 sjmiller609 enabled auto-merge (squash) February 28, 2026 00:40
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@sjmiller609 sjmiller609 disabled auto-merge March 2, 2026 20:24
@sjmiller609 sjmiller609 marked this pull request as draft March 2, 2026 21:18
@sjmiller609
Copy link
Collaborator Author

i'll try to implement fork in here too

@sjmiller609 sjmiller609 changed the title Add standby / restore support for Mac vz hypervisor Add standby / restore + fork support for Mac vz hypervisor Mar 2, 2026
@sjmiller609 sjmiller609 marked this pull request as ready for review March 2, 2026 21:48
@sjmiller609 sjmiller609 enabled auto-merge (squash) March 2, 2026 21:56
rgarcia added 2 commits March 2, 2026 18:39
Two fixes for macOS development:

1. Wire cfg.Build.DockerSocket into builds.Config so the config file
   value (e.g. Colima socket path) is actually used instead of always
   falling back to /var/run/docker.sock.

2. Restore pre-PR#99 behavior of keeping the VM alive after the
   entrypoint exits by waiting on the guest-agent. PR#99 changed init
   to immediately power off the VM when the entrypoint exits, which
   breaks images like alpine:latest whose CMD is /bin/sh — the shell
   gets no stdin and exits instantly, killing the VM before anyone can
   `hm exec` into it. The guest-agent keeps the VM alive and accessible
   until an explicit stop/delete.
@sjmiller609 sjmiller609 disabled auto-merge March 3, 2026 00:16
cfg.Build.DockerSocket was parsed from config.yaml but never passed to
builds.Config, so the docker_socket setting was silently ignored and the
build manager always fell back to /var/run/docker.sock.
@sjmiller609 sjmiller609 enabled auto-merge (squash) March 3, 2026 00:30
Copy link
Contributor

@rgarcia rgarcia left a comment

Choose a reason for hiding this comment

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

this is awesome

@sjmiller609 sjmiller609 merged commit 561e34f into main Mar 3, 2026
6 checks passed
@sjmiller609 sjmiller609 deleted the codex/mac-standby-support branch March 3, 2026 00:43
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