Can wb-vmd hand guest connections to our Go daemons as descriptors, also across a restore?
Answered 2026-10-05: yes, with conditions. Decided 2026-10-06: A, the host opens every connection. The decision and its reasons are in the I29I29 (closed): X18-vsock-handoff: Host-guest socket and descriptor hand-offX18-vsock-handoff (added to S11-verification-and-spikes in #14) comment that starts Decision (2026-10-06):. Source: X18-vsock-handoffX18-vsock-handoff: Host-guest socket and descriptor hand-offCan wb-guestd, written in Go, open AFVSOCK sockets in a macOS guest? (I29I29 (closed): X18-vsock-handoff: Host-guest socket and descriptor hand-offX18-vsock-handoff (added to S11-verification-and-spikes in #14)). Changes S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does., S08-workspace-and-gitS08-workspace-and-git: Workspace and Git Round TripHow code gets into the guest and how the agent's work gets back out, without sharing the host filesystem., S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq…, S12-platformsS12-platforms: PlatformsWhich host and guest operating systems Wraith Box targets, how platform-specific code is isolated, what each platform uses, and how wb works inside WSL. and S13-guest-confinementS13-guest-confinement: Guest ConfinementControls inside the guest that narrow what a project user's processes can do, and tell the host which program opened each connection.. Follow-ups: I86I86 (open): Cold boot to wb-guestd takes about 11 s, above the NFR01-startup ceilingFound by X18-vsock-handoff (#29)., and I101I101 (closed): X27-vsock-confinement: vsock confinement of project usersThe B29-vsock-handoff decision (#29) is that the host opens every host-guest connection., which checks that a project user can’t open, bind or listen on vsock and pose as wb-guestd.
Figure 1. Guest bytes go between our Go daemons and the guest through Apple’s Virtualization service process, never through wb-vmd’s code. wb-vmd only creates the connections and hands them over (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.). At a restore every vsock connection ends, and wb-hostd connects again (S06-vm-lifecycleS06-vm-lifecycle: VM Lifecycle, Images and the Guest AgentHow guest images are built, how VMs are kept warm, how projects and sessions map onto guests, and what wb-guestd does.).
What changes in the specs
Section titled “What changes in the specs”The hand-off itself needs no choice: wb-vmd passes each vsock descriptor with its ports, and the network socket end, over a socketpair that carries one descriptor per message, then closes its copies. wb-hostd routes only on the destination port, which it chose, and reconnects to wb-guestd after every restore. A relay in wb-vmd, the fallback the issue named, isn’t needed.
The decision: may the guest open connections to the host? (decided: A)
Section titled “The decision: may the guest open connections to the host? (decided: A)”Any process in the guest that can open a vsock socket can dial a listener on the host, and it picks its own source port. So a connection that the guest opens says nothing trustworthy about which project or session it belongs to.
Impact
Section titled “Impact”Evidence
Section titled “Evidence”- verified
golang.org/x/sys/unixhasAF_VSOCKandSockaddrVMfor darwin. A Go LaunchDaemon in the guest listened, accepted, dialed the host, and served gRPC. Source: X18-vsock-handoffX18-vsock-handoff: Host-guest socket and descriptor hand-offCan wb-guestd, written in Go, open AFVSOCK sockets in a macOS guest?, “Answer” part 1,results/handoff-run2.jsonlon the spike branch. - verified The descriptor of a vsock connection is a Unix stream socket. It kept working in a Go process after
wb-vmdclosed or dropped its copy, and whilewb-vmdwas stopped withSIGSTOP. Source: “Answer” part 2,results/handoff-run2.jsonl. - verified Half-close works in both directions, as X07-git-round-tripX07-git-round-trip: Git round tripRemote helper over vsock, read-only upload-pack, restricted receive-pack into the landing repository, flagging of risky paths. assumed. Source:
results/halfclose.jsonl. - verified After a save and a restore into a new VM, all old connections read EOF on both sides, and a new connection works 5 ms after
resume. Source: “Answer” part 4. - verified Restore from a fresh clone to
wb-guestdanswering gRPC: 4.13 s p50, 4.21 s p95, 20 runs. Source: “Measurements”,results/stats.txt. - verified A restore while the host is locked fails with “permission denied”, with the Secure Enclave key refused in the system log. Source: “Measurements”,
results/restore-4g-failed-syslog.txtandresults/restore-4g-failed.jsonl. - assumed That a working guest, with more memory in use, also restores to
wb-guestdwithin the budget. Every state here was an idle guest. The time-to-prompt benchmark of S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq… measures it. - assumed That a non-root process in the guest can open a vsock socket, and that the session’s Seatbelt profile can deny it (S13-guest-confinementS13-guest-confinement: Guest ConfinementControls inside the guest that narrow what a project user's processes can do, and tell the host which program opened each connection.). Neither was tried. Option A doesn’t depend on either, because the host refuses guest-opened connections itself.
- assumed That the VM stops with
wb-vmdifwb-vmdexits. Not tested, and no recommendation depends on it.
What it unblocks
Section titled “What it unblocks”The wb-vmd and wb-guestd contracts in I52I52 (closed): S04-architecture, S09-policy-credentials-audit, S10-tech-stack: first .proto contracts and settings schemaS04-architecture says all IPC is protobuf over gRPC and S10-tech-stack adds proto/ "with the first RPC"., the vsock RPCs of the walking skeleton (V1-M2-walking-skeletonV1-M2-walking-skeleton: Walking skeletonwb-vmd boots a fixture VM bundle in its confined process, wb-guestd answers over vsock, a data disk made on the host holds the homes, and wb shell opens a PTY as a project user, with its output through the terminal fi…), and X17-image-buildX17-image-build: Unattended image buildCan a macOS guest installed from an Apple restore image get past Setup Assistant, with wb-guestd running as a root LaunchDaemon, without SSH, scripted clicks, or MDM? (I28I28 (closed): X17-image-build: Unattended image buildX17-image-build (added to S11-verification-and-spikes in #14)), which gets evidence that VZMacGuestProvisioningOptions works on a macOS 27 host and guest.
Details and glossary
The descriptor is a Unix socket. On the host, socket(AF_VSOCK) fails: only Virtualization talks to the virtual device. It hands each connection out as one end of a Unix socket and copies bytes to the device itself. So the bytes stay out of wb-vmd’s code path, but they do go through Apple’s service process, as they would with any design on macOS.
wb-vmd sends the ports with the descriptor. The process that gets a Unix socket can’t ask it which vsock port it came from. wb-vmd reads the ports from VZVirtioSocketConnection and sends them along, and wb-hostd decides which service a connection reaches by that port.
A restore ends every connection. It creates a new VM process. The old VM’s connections die with it, and the guest, which resumes with its old memory, finds its side of each connection closed. Its listener still works, so wb-hostd connects again.
How the daemon got into the guest. The spike used the macOS 27 provisioning options to create a user with remote login on the first boot. It then copied the daemon in over SSH and shut the guest down, 40 s in all. That is a spike shortcut: the product’s image build is X17-image-buildX17-image-build: Unattended image buildCan a macOS guest installed from an Apple restore image get past Setup Assistant, with wb-guestd running as a root LaunchDaemon, without SSH, scripted clicks, or MDM?, and no product image may descend from these bundles, which have remote login on and an admin user with a password.
- vsock: the host-guest socket, a direct channel between the host and the guest that doesn’t go through the network.
- Descriptor: a number a process uses to refer to an open socket or file. A process can send one to another over a Unix socket (
SCM_RIGHTS). - Half-close: one side says it’s done sending, and can still receive.
- p50, p95: the median, and the value 95% of runs stay under.