arcbox / app
AGENTS.md4.3k starsChanged 4 months agoApache-2.0View on GitHub
Covers arcbox-daemon (startup/shutdown), arcbox-core (vm_lifecycle), arcbox-api (gRPC/diagnostics), arcbox-cli (daemon handoff), and arcbox-docker (Engine API proxy). Reference material lives in docs/daemon-lifecycle.md (lock/handoff, residual-state tables) and docs/data-directories.md (filesystem paths) — point there, don't restate. arcbox-cli ships one binary, abctl. User-facing strings must name it. - Startup is a phased, typed pipeline and the order is load-bearing — see root AGENTS.md "Architecture Principles" and docs/daemon-lifecycle.md before reordering. The current chain is 8 steps (prepare_host → acquire_daemon_lease → start_control_plane → release_stale_resources → prepare_assets →…
- Reads credentials
Trending
Quiet since September.thin dataabout the whole repository
Who's talking about arcboxlabs/arcbox
- A Hacker News story“ArcBox: From-Scratch Container Runtime for macOS in Rust (Docker, K8s, MicroVMs)”Hacker News · Jul 20, 2026 · 3 points
- @github-trending-rs.bsky.social“🚀 Skyrocketing! 🚀 (200+ new stars) 📦 arcboxlabs / arcbox ⭐ 3,352 (+360) 🗒 Rust Run AI agents on real …”Bluesky · Sep 6, 2026
- @githubprojects.bsky.social“arcboxlabs/arcbox Agents need powerful system access. Giving them your actual machine is the uncomfortable …”Bluesky · Sep 6, 2026
- @github-trending-rs.bsky.social“🎉 Celebrating! 🎉 (500+ new stars) 📦 arcboxlabs / arcbox ⭐ 2,448 (+506) 🗒 Rust Run AI agents on real and …”Bluesky · Sep 2, 2026
- 1Password/for-open-source“Application for ArcBox”GitHub · Apr 18, 2026
The biggest 5 of 6 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 6
Talked about on Bluesky, GitHub and Hacker News (6 times).
On Bluesky · 3
- Sep 6, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 arcboxlabs / arcbox ⭐ 3,352 (+360) 🗒 Rust Run AI agents on real and isolated machines — own… — @github-trending-rs.bsky.social0 likes and reposts · 1 reply
- Sep 6, 2026arcboxlabs/arcbox Agents need powerful system access. Giving them your actual machine is the uncomfortable part. ArcBox gives agents… — @githubprojects.bsky.social0 likes and reposts · 1 reply
- Sep 2, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 arcboxlabs / arcbox ⭐ 2,448 (+506) 🗒 Rust Run AI agents on real and isolated machines — own kernel,… — @github-trending-rs.bsky.social0 likes and reposts · 1 reply
On GitHub · 2
- Apr 18, 2026Application for ArcBox — 1Password/for-open-source0 reactions · 2 comments
- Mar 23, 2026feat: remove daemon plist log paths (companion to arcbox#99) — arcboxlabs/arcbox-desktop0 reactions
On Hacker News · 1
- Jul 20, 2026ArcBox: From-Scratch Container Runtime for macOS in Rust (Docker, K8s, MicroVMs)3 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- common/AGENTS.mdAGENTS.md
- computer/AGENTS.mdAGENTS.md
- engine/AGENTS.mdAGENTS.md
- guest/AGENTS.mdAGENTS.md
- rpc/AGENTS.mdAGENTS.md
- runtime/AGENTS.mdAGENTS.md
- virt/AGENTS.mdAGENTS.md
- xtask/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 126
Every Bonjour operation needs the Local Network privilege (TN3179): mDNSResponder answers kDNSServiceErr_PolicyDenied (-65570) within a …
- Very specific: line 348
NOT stop or restart a running VM.
- Very specific: line 449
START of the gap where no guest exists.
- Very specific: line 558
Every host listener that is not a container's needs an owner key Runtime::is_container_owner rejects.
- Very specific: line 561
Stop and delete release the hold *before* closing the listeners, and apply does nothing without the hold, so a listing that raced a stop …
- Very specific: line 579
Never block a russh Handler callback on the process: russh returns window to the client as soon as data arrives, so the handler is the only …
- Very specific: line 610
Stop the daemon by launchd label or by the PID in daemon.lock, never by process name.
- Very specific: line 614
Every step reports Done, Skipped(why) or an error, and the command exits non-zero when any step failed.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
app/ — Daemon & Core Agent Guidance
Covers arcbox-daemon (startup/shutdown), arcbox-core (vm_lifecycle),
arcbox-api (gRPC/diagnostics), arcbox-cli (daemon handoff), and
arcbox-docker (Engine API proxy). Reference material lives in
docs/daemon-lifecycle.md (lock/handoff, residual-state tables) and
docs/data-directories.md (filesystem paths) — point there, don't restate.
arcbox-cli ships one binary, abctl. User-facing strings must name it.
Startup & readiness contract
- Startup is a phased, typed pipeline and the order is load-bearing — see
root AGENTS.md "Architecture Principles" and
docs/daemon-lifecycle.mdbefore reordering. The current chain is 8 steps (prepare_host → acquire_daemon_lease → start_control_plane → release_stale_resources → prepare_assets → boot_runtime → start_runtime_services → mark_ready,arcbox-daemon/src/main.rs), each producing a richer context type so skipping a phase is a compile error (context.rs). gRPC (start_control_plane) must come before the slow boot phases so clients can watch progress. - Two runtime handles, do not conflate them (
context.rs):shared_runtimeis filled only after full init and gates normal RPCs withUNAVAILABLEviaruntime.ready();early_runtimeis filled the momentRuntimeis constructed, before the VM boots, and is diagnostics-only. WHY: a stuck boot never fillsshared_runtime, so any RPC needed to debug it must readearly_runtime.GetVirtioDebugis the one such RPC (arcbox-api/src/system.rs,self.early_runtime.ready()). Never gate a diagnostic onshared_runtime; gate onearly_runtime.ready()instead —ready()is theSharedRuntimeExtmethod (grpc/mod.rs) that returnsUNAVAILABLEonly while the handle'sOnceLockis empty, andearly_runtimefills the momentRuntimeis constructed. WatchSetupStatusis the sole readiness/failure signal clients (desktop, e2e) may use — never log-grep or sleep. Fatal startup failures MUST callSetupState::set_failedbefore exit (200ms flush grace,main.rs) so clients see the cause instead of a bare disconnect. Route-install state is mirrored intoSetupState.route_installedbyservices::route_status_loop(ContainerRouteInstalledsets,MachineStoppedclears) — WHY: VM restarts install the route outside the cold-start path that sets the flag directly, so without the bridge the flag goes stale until the next daemon restart.- A
SetupStatus.Phasevalue that nothing publishes is invisible as a gap — it simply never arrives, so a client waits forever or reports a plausible zero. Declaring a phase inapi.prototherefore obliges you to publish it; the happy-path progression and which phases are conditional live in the enum's own doc comment (api.proto) anddocs/daemon-lifecycle.md, and must be updated with any change. This was CORE-67:VM_STARTING/VM_READY/NETWORK_READYsat declared and unpublished, leaving the slowest stretch of startup silent. - The VM phases are reported from inside
Runtime::init, not derived from pipeline order (InitProgress→SetupPhaseinstartup/mod.rs::init_runtime). WHY:boot_runtimeis one stage that stages guest binaries, boots the VM, waits for the agent, then waits for dockerd. Publishing at the stage boundaries would bill the binary download toVM_STARTINGand makeVM_READYmean "dockerd answered" — the span ABX-309 budgets would measure the wrong thing.initreportsSystemVmStartingafter the binaries are staged andSystemVmReadywhenvm_lifecycle.ensure_readyreturns (readiness level 2 below); the dockerd wait lands in theVM_READY → NETWORK_READYwindow.initreports nothing under--no-linux-vm, which is what keeps the VM pair off the wire when no guest boots. SetupStatestreams every update, not the newest snapshot (arcbox-api/src/system.rs: awatchforGetSetupStatus, abroadcastforWatchSetupStatus). WHY:NETWORK_READYandREADYare published ~300 µs apart with no await point between them, so a snapshot channel hands a subscriber onlyREADYwhenever it does not get scheduled in that window — indistinguishable from a phase that was never published, and the exact bug CORE-67 set out to remove. The two halves are kept atomic by opposite sides of one lock:publishbroadcasts from insidesend_modify, holding the write lock, andsubscribetakes the snapshot and the receiver together under the read lock that write lock excludes. Split either pair and you drop an update or replay one already folded into the snapshot, walking a client's phase backwards. Regressions:back_to_back_phases_are_all_delivered,the_snapshot_is_not_replayed_as_an_update.- A listener the phase promises is bound before
start_servicesreturns, never inside its spawned task (DnsService::bind_requestedinstart_control_plane, thenDockerApiServer::bind+serve— CORE-71). WHY: a task that binds and only logs its error cannot fail startup, so the pipeline publishesNETWORK_READYandREADYfor a daemon whose primary API no client can reach.NETWORK_READYtherefore covers whichever services this daemon runs —--no-linux-vmreaches it with DNS alone — and the Kubernetes proxy is the deliberate exception: a taken 16443 is tolerated, so it is started here but not promised. Adding a listener means deciding which of those two it is. DNS is promised yet never fails on a taken default: it binds the profile's port (ArcboxProfile::dns_host_port, 5553 production / 5554 development) and falls back to an OS-allocated one, which self-setup publishes through/etc/resolver/<domain>andabctl dns statusreads back from that file; only an explicit--dns-port/ARCBOX_DNS_PORTmust bind. The DNS socket is bound instart_control_plane, right after the lease is held, and served fromstart_servicesonce the runtime'sNetworkManagerexists (ControlPlaneincontext.rscarries it across). WHY: both profiles' daemons run on one machine, and a development build that shared 5553 with production crash-looped under launchd for three days, a full VM boot per 5 s cycle, because the bind then sat afterboot_runtime; a bind failure now costs no boot. - An unknown name under the local domain is answered NODATA, never
NXDOMAIN (
DnsForwarder::try_resolve_locally_or_nodata). WHY: the domain ends in.local, which RFC 6762 gives to mDNS, so mDNSResponder multicasts every*.arcbox.localquestion as well and takes the unicast answer only when it is positive or NODATA; NXDOMAIN, SERVFAIL and REFUSED are ignored and the lookup waits out the 5 s mDNS timeout per record type, 10 s for a getaddrinfo miss (measured 2026-10-01,docs/experiments/2026-10-01-local-domain-negative-answers.md). A bound socket that does not answer yet behaves exactly like no listener, so the startup window between the DNS bind andstart_servicesneeds no "not ready" answer either. The guest agent's own DNS server (guest/arcbox-agent/src/dns_server.rs) keeps NXDOMAIN: its clients are Linux resolvers, which have no mDNS leg. - The resolver-domain owner also registers its names with mDNSResponder
(
arcbox-daemon/src/mdns/, started fromrecovery::rununder the sameowns_dns_resolverpredicate that installs/etc/resolver/<domain>, and only for a domain ending in.local). Unicast and Bonjour answer from one table:NetworkManager::subscribe_dns_changesstreams everyregister_dns/deregister_dns/set_dns_domainas aDnsChange, andlocal_dns_entriesis the snapshot a lagging subscriber resyncs from. The records arekDNSServiceFlagsUniqueon the loopback interface (if_nametoindex("lo0")): nothing leaves the host, and mDNSResponder answers a query for a type the name lacks (AAAA for an IPv4 name) at once, which it does not do forkDNSServiceInterfaceIndexLocalOnlyrecords (a Mac without the resolver file then waits 5 s on every AAAA; measured 2026-10-01). A second owner of a name getsNameConflict, which is why only the resolver owner registers (a development daemon shareshost.arcbox.localwith production). Every Bonjour operation needs the Local Network privilege (TN3179): mDNSResponder answerskDNSServiceErr_PolicyDenied(-65570) within a millisecond for a process without it, the mirror logs that once and retries every 60 s, and the unicast server keeps answering.launchddaemons, root and Terminal.app children are exempt; alaunchdagent (the production daemon underSMAppService) inherits ArcBox.app's privilege, so the first registration raises the system's Local Network alert for ArcBox once, and a daemon started from a third-party terminal inherits that terminal's. The privilege follows the responsible app bundle: a Homebrewpython3execsPython.app, so a Python probe is "Python" in System Settings, not the terminal it ran from. The same privilege gates the clients: on macOS 15+ a process without it cannot resolve any.localname, through the resolver file or otherwise (measured 2026-10-01: getaddrinfo fails in 0.00 s whiledscacheutil, which asks root's opendirectoryd, answers), so "curl foo.arcbox.localfails instantly from my terminal" is that terminal's Local Network setting, not a daemon bug. SetupStatus.vm_runningis owned byservices::vm_running_loop, which mirrorsVmLifecycleState::is_ready(readiness level 2 below) offRuntime::subscribe_system_vm_state. WHY: it used to be set once by cold-start recovery on a successful guest query and never cleared, so it readtruefor the rest of the daemon's life after any stop (CORE-70). A second writer re-introduces that class of drift — the loop owns both edges. It is armed frominit_runtimebeforeRuntime::init, not fromstart_services: the VM goes ready partway throughinit, so a later start would report it down for the whole dockerd wait. And it is only as good as the lifecycle state — an unmanaged guest crash leaves thatRunning(ABX-414: noHealthMonitorloop), so the flag says "the daemon believes the VM is up", not "the VM answered just now". Regression:vm_running_loop_follows_the_lifecycle_both_ways.- Startup-cancellation invariant: the flock (
daemon_lock) andearly_runtimeare held inStartupHandles, not only in pipeline-local context (context.rs,main::runkeeps a clone). WHY: a signal can drop the startup future mid-boot while the VM keeps booting in its own lifecycle tasks —interrupt_startupreaches that orphan VM throughhandles.early_runtime(shutdown.rs), and the flock must survive the cancellation or a concurrent daemon boots into the same disk images. Do not move these into pipeline-local state. main::runkeeps a signal watcher armed for the entire startup window; the default SIGTERM disposition would otherwise kill the process mid-boot and orphan the VM + its Virtualization.framework helpers.
Failure signatures (symptom → first commands → likely cause)
- Guest boots and daemon reaches READY, but every registry pull / TLS
handshake fails certificate-validity checks. First: check the daemon log
for
guest clock sync ping failed(a warn, not an error);rg -n "sync_guest_clock" engine/arcbox-engine/src/vm_lifecycle/boot.rs. Likely cause: the HV backend has no RTC (ABX-416); the guest wall clock is pushed only by the best-effort post-readiness agent ping (AgentPingRequest.timestamp_secs→ agentclock_settime). If that ping fails the guest sits at the kernel default epoch and boot still succeeds, so the symptom surfaces far downstream. Do NOT remove the ping until a PL031 RTC device lands. - Large VM (>8 vCPUs) boot-wedges; guest PID 1 in D-state. First, while the
VM is still alive, capture the live snapshot — do NOT do console-log
archaeology (it produced multiple wrong root causes on ABX-386): call the
GetVirtioDebugRPC (SystemService, served fromearly_runtime) or read the e2e-capturedvirtio-debug.json. Compare per-queue live avail/used indices. Likely cause: a per-queue register-file bound too small for one-blk-queue-per-vCPU (ABX-386 class;MAX_VIRTQUEUESlives invirt/arcbox-vmm). Seevirt/AGENTS.md"Debugging" andvirt/arcbox-vmm/AGENTS.md"MMIO Register File". dockercommands hang or hit a dead pooled connection right after a backend switch / VM restart. First:rg -n "reset_if_restarted|restart_generation" app/arcbox-docker app/arcbox-core. Likely cause: the proxy's restart-detection ordering broke (see Docker proxy contract below).- Operations fail with stale-CID / connection-refused errors while both
MachineManagerstate andVmLifecycleStatestill sayRunning. First: confirm whether the guest actually died (GetVirtioDebug, guest console). Likely cause: no crash auto-recovery —HealthMonitor's monitoring loop is unimplemented (vm_lifecycle/health.rs:intervalis stored, no loop consumes it) andon_ensure_ready(actor.rs) short-circuits onis_ready(), returning the cached CID without probing, so a dead guest never leavesRunning(ABX-414). - Daemon log's
ARCBOX_BUILD_SHA("arcbox-daemon starting",main.rs) doesn't match the commit you built ("which binary am I running?"). First:cargo clean -p arcbox-daemon && cargo build -p arcbox-daemon. Likely cause:arcbox-daemon/build.rsemits norerun-if-changedon.git/HEAD, so a rebuild that changes no package source file reuses the cached SHA — a new commit alone logs a STALE sha (the build.rs comment claiming it stays "fresh" holds only when a package file also changed). - Daemon logs "ArcBox daemon stopped" but the process never exits. First:
look for a
mount_nfsorumountchild of the daemon. Likely cause: a new call site runs one of them outsidehost_mount. Both the~/ArcBox/dockerexport and the machine mounts go throughhost_mount, where each is a tokio child bounded byMOUNT_ATTEMPT_TIMEOUT(20 s per attempt) orUNMOUNT_TIMEOUT(5 s) withkill_on_drop; the oldspawn_blockingremount with no per-attempt bound was this signature (fixed 2026-10-03). - Daemon never logs "ArcBox daemon stopped" after the VM stopped. First:
sample the daemon for a thread inside
stat/getattrlist. Likely cause: somethingstat'd an NFS mount point whose server is gone (canonicalize,metadata,existson~/ArcBox/dockeror a machine mount), which blocks until the mount'sdeadtimeout. Resolve a mount point withhost_mount::current_mount_info— a wrapper overarcbox_core::host_mount::MountTable, whichabctl uninstallreads too — which reads the mount table and never touches the point, and escalate toumount -fwhen a plainumountis refused (3044b3f7, 2026-10-03).
Machine root mounts
- A running distro machine's
/is mounted read-write on the host, at~/ArcBox/machines/<name>, under the one host mount root~/ArcBoxthat also holds the docker export atdocker/(ARCBOX_HOST_MOUNT_DIRmoves the root; the e2e harness and the dev daemons point it into their data dir; ADR 0003), byarcbox-daemon/src/machine_mount. Thestartup::host_mountsstep ofrelease_stale_resourcesfirst releases whatever a previous daemon left under the root — and the pre-0003 layout,~/ArcBoxitself and~/ArcBoxMachines/<name>— reading the mount table rather thanstat'ing dead mount points. The agent serves NFSv3 from annfs3_serverin its own process and the host's NFS client reaches it over the bridge NIC, not a vsock relay (ADR 0002).mount_machineandunmount_machineare the only entry points and both are idempotent; the loop follows the event bus the waymachine_dnsdoes and re-derives the mount set from the machine records, so one pass repairs a lagged receiver. Event::MachineStopping { name }is internal:stop,graceful_stopandremovepublish it before the VM goes down so the unmount still reaches a live server, and it is not mapped onto the public event stream. Daemon shutdown unmounts everything before it stops the machines for the same reason. A release can fail (the client still has requests in flight, seen 2026-10-04); the entry then stays in the registry and a background task retries past the mount'sdeadtimeout(60 s). Entries carry a generation so a retry never unmounts a newer incarnation of the name.- The export hides
/arcbox(ArcBox's own VirtioFS shares) and never puts the Mac's AppleDouble._sidecars on disk: it translates them intouser.*extended attributes on the target file (guest/arcbox-agent/src/machine_export/vfs/sidecar/). macOS cannot store an xattr on NFSv3 and stampscom.apple.provenanceon every file a downloaded app writes, so without that every host write littered the machine with._*files and git took a._pack-*.idxfor a pack index. Regression signature:ls -ainside the machine shows._files next to files the Mac wrote.
Backend transport & agent
MachineManager::connect_agentyields different transports by backend: blocking on the HV AF_UNIX socketpair, async on VZ AF_VSOCK and on Linux. Branch onAgentClient::is_blocking()(engine/arcbox-engine/src/agent_client.rs); calling a*_blockingRPC on VZ (or an async RPC on HV) fails deterministically.sync_guest_clock(vm_lifecycle/boot.rs) is the reference pattern:spawn_blockingthe connect, then dispatchping_blockingvspingonis_blocking().- Streaming RPCs do not exist on the HV transport.
AgentTransport::Blockingrefusesasync_send/async_recv, so a streaming RPC the daemon issues unconditionally at startup kills every HV boot — the sandbox cleanup replay did exactly that (Failed to initialize sandbox cleanup … streaming RPCs not supported on blocking transport) untilinit_runtimegated it onbackend.supports_nested_virt(); HV runs no sandboxes, so there is nothing to replay. A new startup RPC either has a blocking variant or a per-backend skip. CI runs no HV daemon-level scenario, so the check is manual:ARCBOX_VM_BACKEND=hv cargo test -p arcbox-e2e --test boot_assets -- --ignored. - On VZ, one guest→host vsock stream the host stops reading stalls the
whole VM: every new vsock connection to it times out until that stream is
read or closed (measured 2026-09-26: before machine exec had a window,
abctl machine pingfailed duringssh … 'cat /dev/zero' | sleep 40;docker versionstill hangs duringdocker run … cat /dev/zero | sleep 30). The host must never stop draining a guest stream, so a streaming RPC needs an application-level window, not a bounded channel. Machine exec has one: the host grants output in encoded-frame bytes (OUTPUT_WINDOW,engine/arcbox-engine/src/agent_client/machine_exec.rs), the agent grants stdin (STDIN_WINDOW,guest/arcbox-agent/src/agent/linux/machine_exec/flow.rs), and neither side sends past its window, so both can always keep reading. An agent that grants no window is refused at exec time ("restart the machine to update it"). The Docker API channel (2375) has one too since protocol v5:HalfCloseStreamgrants each direction 1 MiB in-band (WINDOW, header top bit set) and keeps a reader task on the connection, so a pauseddocker attachbacks up into dockerd's socket, not the vsock. The sandbox streams open withSANDBOX_STREAM_WINDOW(4 MiB,wire.rs) returned bySandboxStreamWindowframes; the guest'ssandbox/window.rsnever sends past it and the host'sagent_client/sandbox_stream.rsreturns it as the consumer takes frames. A writer whose peer has gone fails withBrokenPipeinstead of waiting for a grant that cannot come — without that, dropping an attach hung the container's stop. The Kubernetes (16443) and NFS (2049) relays wrap the sameHalfCloseStreamaround their TCP bytes since v6, so every guest→host vsock the daemon opens is windowed.
VM lifecycle internals (engine/arcbox-engine/src/vm_lifecycle)
VmLifecycleManageris a thin facade over a single actor (actor.rs): mutations go throughCommandvariants on anmpscchannel; reads (state,is_running) come lock-free from awatchchannel and must never block. Slow I/O (create/start/agent-wait/stop) runs in preemptible sub-tasks (boot.rs) soforce_stopcan preempt an in-flight boot or graceful stop. Adding a synchronous mutation or blocking the actor loop breaks force-stop preemption.- The actor is spawned lazily on the first async facade call (
ensure_actor,mod.rs). WHY: constructors are synchronous and may run outside a tokio runtime (e.g.Runtime::newin tests) wheretokio::spawnpanics. DEFAULT_STARTUP_TIMEOUT_SECS = 90is deliberately generous (erofs rootfs- large
docker.imgmount under CPU/I/O pressure). A tight 30s budget raced the cold-boot path into "timeout waiting for agent" loops — do not tighten it toward the <1.5s cold-boot target.
- large
- The idle balloon never shrinks, on either backend, by design — the
gate is
BalloonDeps::reclaim_capable(balloon/controller.rs), false on both, and load-bearing (full evidence inballoon/mod.rsdocs). VZ (measured 2026-07-29, macOS 26.4): inflation releases NOTHING host-side (15.35 GB inflated, daemonphys_footprintbyte-identical, pages compressed as live data under real host pressure) — guest RAM lives in Apple's XPC process, so measure that process, not the daemon, and nothing the daemon does can release it. HV (since 2026-09-25): the guest's free page reporting returns idle memory continuously with no host-side target — the device releases each reported range by refreshing its stage-2 mapping (virt/arcbox-vmm/AGENTS.md"Releasing guest RAM") — so a host-driven shrink would only starve a guest that was already giving the memory back. Host footprint is NOT the configuredmemory_mb— guest RAM is committed lazily, so the cost is the high-water mark of guest-touched pages (a fresh idle 16 GB VM ≈ 718MB); on VZ that mark only ratchets upward, on HV it follows the guest's free memory back down. Do not flip a backend to reclaim-capable without a measured hostphys_footprintdrop on inflate. set_resourceshas the same shape asset_backendbelow: it changes the CPU/memory the next (re)boot creates the machine with, the boot's drift check recreates a machine that differs, andRuntime::resize_system_vmis the apply-now path — validate against the host, write[vm]in the user'sconfig.toml(config::persist, in place viatoml_edit),shutdown,set_resources,ensure_ready. Persist before the restart: a size the daemon applied but forgot on its next start is worse than one it refused.set_backendonly changes the backend used on the next (re)boot; it does NOT stop or restart a running VM. To apply immediately the caller forces a recreate viaRuntime::switch_system_vm_backend. The backend is seeded from the persisted machine, so it survives daemon restarts. WARNING:Runtime::switch_system_vm_backend(runtime.rs) runsshutdown→set_backend→ensure_readywith NO serialization against a concurrentensure_ready; a boot landing between the stop andset_backendboots the OLD backend and the switch still reports success (ABX-414).- Three readiness levels, never read one as another — each gates a
different call surface. (1)
MachineManagerMachineState::Running(machine.rs::start): for the System VM (distro: None) this flips the instant the VM process starts, BEFORE the agent answers — the agent wait (wait_for_machine_ready) is gated ondistro.is_some()and never runs for the System VM, so it means only "VM process exists," which is exactly whatconnect_agent/connect_vsock_portgate on. (2)VmLifecycleState::Running: the agent replied to a ping. (3) docker-ready: guest dockerd answers/_ping(GuestDockerBackendwatch). A consumer readingMachineManagerRunningas "usable" issues RPCs into a VM whose agent/dockerd is not up. TheMachineManagerMachineStatelives outside the lifecycle actor on purpose (physical vs logical layering) — do not unify them. - A distro Machine is not usable when its agent answers — its own init
has not run yet. The boot shim runs
machine-init, backgrounds the agent, and only thenexecs the distro's/sbin/init(boot-assets/.../machine-init.sh), so the distro's networking comes up after the agent is already serving and typically reconfigures the interface from scratch — measured on alpine as a ~20 ms window with zero routes, ~100 ms afterStartwould otherwise have returned (CORE-66).wait_for_machine_readytherefore also gates onSystemInfo.distro_init_pending, which the agent reads from a sentinel (guest/arcbox-agent/src/boot_done.rs) written by a hookmachine_initinstalls into the distro — a static systemd unit orderedAfter=multi-user.targetand pulled in by amulti-user.target.ddrop-in, an openrc service thatdepend()safter *, or a sysvinit inittabwaitentry appended after therc Nlines; runit and BusyBox-only images get no hook, and readiness does not wait for them. Never give the systemd unit an[Install]section: a first boot applies the preset policy, and ondisable *distros (Fedora, the RHEL family, openSUSE) that removed the.wantslink before the unit ever ran, so every start burned the 60 s readiness timeout. Do NOT replace the hook with an inspection of the init system's runtime state:/run/openrc/rc.startingis absent both before openrc runs and after it finishes, so that check reports "settled" during exactly the window it exists to catch — a version built that way shipped and never fired once. Unit ordering is a public contract; a runtime directory's layout is not. Same shape as Lima's/run/lima-boot-doneand multipass's cloud-initboot-finished; cloud-init itself is unavailable because the mirrored images are the linuxcontainersdefaultvariant, which does not ship it. Two consequences worth knowing: the field is phrased as pending so an agent predating it decodes false and behaves exactly as before; and readiness now costs what the distro's boot costs — 2–5 s on alpine, debian, fedora and ubuntu, up to ~10 s on arch and rocky (measured 2026-09-26) — because that is when the machine actually becomes usable. - Distro machines boot with
net.ifnames=0, and their agent serves RPC only. The mirrored images' own network config (networkdeth0.network, netplan,ifcfg-eth0, ifupdown) nameseth0, the name a container's NIC has. With udev renaming the virtio NIC toenp0s1, that config matched nothing: the distro never took over DHCP, systemd-resolved had no upstream, and ubuntu's start took ~14 s instead of ~4 s. The flag is part of the machine cmdline, which is fixed at create, so existing machines keep the old naming until they are recreated. The agent tells a machine from the System VM byarcbox.machine_rootfs=on the kernel cmdline (agent::Guest) and then starts none of the System VM's services (guest/AGENTS.md).SystemInfo.ip_addressescomes fromgetifaddrs, never fromhostname: NixOS and Oracle ship none, and BusyBox's-iresolves the host name through DNS, which behind a proxy reported a fake IP. Not ArcBox bugs, and not mirrored: the kali and openSUSE Tumbleweeddefaultimages ship no udev, so no device unit ever appears in a VM, and systemd waits 90 s fordev-hvc0.device(theserial-getty@hvc0thatconsole=hvc0generates) beforemulti-user.target— seen on kali's console; openSUSE times out the same way. The boot-test loop that found all of this:ARCBOX_MACHINE_IMAGE_BASE=<dir>pointing at a localmachine-images syncoutput (the directory, not itsindex.json), andabctl machine execinto the machine whilestartis still waiting. - A running machine is published as
<hostname>.arcbox.localat its bridge NIC address (arcbox-daemon/src/machine_dns.rs,arcbox-core/src/runtime/machine_dns.rs), the System VM asdefault.arcbox.local. The hostname ismachine_hostname(name)(_and.become-;createrefuses a name that cannot become a DNS label), the same string the shim gets on the cmdline, so the guest and the Mac agree. The loop follows machine events and re-derives the answer fromMachineInfo.bridge_ip_addresseach time: distro machines record it inwait_for_machine_ready, the System VM in the lifecycle boot'srecord_bridge_address(before the actor hearsAgentReady, so theMachineStartedit publishes finds the record filled); every stop path clears it. The record, not the event, is the truth, which is also what repairs a lagged receiver with one pass. Entries carry themachine:owner prefix andregistered_container_idsexcludes it — without that the Docker host reconciler tears every machine down as a vanished container within one interval. The entry goes throughRuntime::register_dns, so the resolver owner's mDNS mirror (above) announces<hostname>.arcbox.localonlo0like a container's name and withdraws it when the machine stops:dns-sd -G v4 <hostname>.arcbox.localshows the record on interface 1 while the machine runs (verified 2026-10-04 with a development daemon on an isolated.localdomain). Regression signature:dig <name>.arcbox.localat the daemon's DNS port answers NODATA (NOERROR, no answer) for a running machine whoseinspectshows a bridge address. restart_generationreports departures, not arrivals. It is bumped on VM stop (Effect::BumpGeneration, fired fromstoppingonVmEvent::Stopped), so a task that waits for it to advance wakes at the START of the gap where no guest exists. Underswitch_system_vm_backendit then races the reboot with the sameDEFAULT_STARTUP_TIMEOUT_SECSbudget the boot itself gets; after a plain stop with the daemon still alive, no guest is coming at all. Anything that must act when the VM comes up watchesVmLifecycleManager::subscribe_state(Runtime::subscribe_system_vm_state) instead: wait forVmLifecycleState::is_ready, do the work, then wait for it to clear. Reference consumer: the~/ArcBox/dockerexport reconcile (arcbox-daemon/src/nfs_mount.rs), whose per-incarnation supervisor loop also carries the companion rule — one pass's failure must be retried, not propagated out of the loop, or every later incarnation inherits the broken state (ABX-426).- Two startup timeouts cover SEQUENTIAL phases; don't conflate them.
DEFAULT_STARTUP_TIMEOUT_SECS = 90(mod.rs) budgets VM boot → agent ready;ContainerRuntimeConfig::startup_timeout_ms = 150_000(config.rs) budgets agent ready → dockerd/_ping. Residual skew: the guest watch loop (guest/arcbox-agent/src/agent/linux/rpc.rshandle_watch_readiness) emitsRuntimeFailedat exactly its own deadline, which equals the host's recv deadline, so the host can drop the stream before the failure detail lands (ABX-414). - Clone, export and import act on a stopped machine's
data.imgand nothing else (engine/arcbox-engine/src/machine/{clone,transfer}.rs,machine/archive/). The rootfs is a shared read-only image, so a clone is oneclonefile(2); export snapshots the disk the same way under the registry lock and writes the archive from the snapshot without it; import restores intomachines/.import-*and moves the disk into place under the lock likecreate(.export-*/.import-*leftovers are swept when the manager starts). A running machine is refused: its btrfs volume has dirty pages the host cannot see and no quiesce path through the agent. The archive is a.tar.zstwithmanifest.jsonfirst (the settings plus theMachineImageManifestof the image it boots) anddata.imgas a hand-written GNU sparse 1.0 entry, so a mostly-empty disk costs its extents, not its size. Import needs the same image (distro, version, rootfs digest, this host's arch) in the local image registry and never pulls. A clone or an import gets its ownarcbox.machine_name=on the cmdline, which the guest applies on every boot (machine_identity), so the source's name never leaks through the overlay's/etc/hostname. MachineManager::set_resourceswrites the new CPU/memory to the VM config and the persisted record at once; a stopped machine boots with it next, a running one keeps its size and the result saysrestart_required. It restarts nothing. The default machine is[machine] default_machinein the user'sconfig.toml(config::persist::set_default_machine, in place viatoml_edit), and the CLI's optional[NAME]resolves to it (arcbox-cli/src/commands/machine/target.rs).
Docker proxy ↔ lifecycle contract (cross-crate)
VmLifecycleManager::restart_generation() is bumped on every VM stop
(the fetch_add lives in actor.rs's Effect::BumpGeneration arm;
mod.rs holds only the read accessor). The Docker proxy compares it via
the request path to detect a
System VM restart (backend switch / recovery) and reset stale state
(arcbox-docker/src/proxy/state.rs). Reading a stop-edge counter is correct
here precisely because the proxy acts on its next request, which by
definition arrives once the VM is back — do not copy the pattern into a task
that must act at the restart itself (see "reports departures, not arrivals"
above). When editing either side, keep in lockstep:
reset_if_restartedmust drop the pooled connections BEFORE flipping cached readiness toUnverified. WHY: a concurrent verifier that seesUnverifieddials_pingimmediately and must use the fresh client; resetting after would race it onto a connection to the dead VM.- Endpoint readiness is verified with an HTTP
GET /_pingagainst guest dockerd (ABX-408), not mere socket-connectability. Do not substitute a connect check. - Both the request path (
ensure_endpoint_verified) and the host-networking reconciler go through the samereset_if_restartedso they react to a restart through one pool.
Host port forwarding & image pull (arcbox-docker)
- Published container ports are forwarded in userspace: container inspect →
parse_port_bindings→PortForwarderbinds a hostTcpListener/UdpSocketper rule (virt/arcbox-net/src/port_forward.rs), reachable via loopback. No privileged helper is involved, so a high/ephemeral host port is safe to publish under an isolated test daemon (it touches none of the three e2e host-globals). A host port below 1024 binds as non-root only on0.0.0.0: XNU asks for the reserved-port privilege only when the bind names a specific address (measured 2026-09-26 as uid 501:0.0.0.0:999binds,127.0.0.1:999is EACCES, TCP and UDP alike). There is no helper fallback, so a low port works in the default LAN-exposed mode and fails in loopback mode (expose_ports_to_lan = false); keep published test ports ephemeral. - The host bind address of a publish with no particular address (
-p 8080:80,-p 0.0.0.0:8080:80) follows[docker] expose_ports_to_lan(DockerConfig::default_publish_address): every interface by default, loopback when off. A binding that names an address is honoured either way, and sandbox exposures are loopback-only regardless. The relay then dials the guest at its uplink address, which dockerd's own DNAT for an address-pinned binding does not match — the guest agent mirrors those (guest/AGENTS.md); without the mirror0.0.0.0publishes work and127.0.0.1:publishes RST. - Image pull is NOT an ArcBox code path:
POST /images/create(docker pull) is proxied verbatim to guest dockerd, which does the registry pull. This is whatruntime/AGENTS.mdmeans by "the pull path elsewhere" — there is no host-side pull module to call; drive it through the Docker API proxy.
Kubernetes LoadBalancer forwarding
- k3s runs servicelb (traefik stays disabled), so a LoadBalancer Service gets
a svclb pod and the node IP, 10.0.2.2, as its ingress. The daemon
(
arcbox-daemon/src/kubernetes_lb.rs) polls the agent'sKubernetesLoadBalancersevery 2 s over one kept connection, only while the VM is ready and the Kubernetes hold is set, and applies each listing throughRuntime::apply_kubernetes_load_balancers(arcbox-core/src/runtime/kubernetes_lb.rs): one host listener per port of a Service that has an ingress, keyedk8s:<ns>/<name>:<port>/<PROTO>, bound ondefault_publish_address(). The relay's traffic to10.0.2.2:<port>is DNATed by kube-proxy's loadbalancer-IP rule, so unlike Docker's address-pinned publishes it needs no guest mirror. - Every host listener that is not a container's needs an owner key
Runtime::is_container_ownerrejects; otherwise the Docker host-networking reconcile treats it as a vanished container's and closes it. - Stop and delete release the hold before closing the listeners, and
applydoes nothing without the hold, so a listing that raced a stop cannot reopen them.abctl kubernetes statusprints each port's outcome (forwarded, pending, skipped, failed).
SSH server (arcbox-ssh)
ssh [user@]<machine>@arcboxreaches a loopback server in the daemon (app/arcbox-ssh, wired inarcbox-daemon/src/ssh_service.rs). It binds like the Kubernetes proxy:--ssh-port(0 for any) must bind or startup fails, while the default 16022 (SSH_HOST_PORT) is best-effort. The host key and the one accepted client key are generated once under<data_dir>/ssh/, next to theconfigand aknown_hoststhat pins the host key;abctl ssh installadds oneIncludeline to~/.ssh/config.- Sessions run on the machine exec path (login sessions, signals, PTY
resize),
direct-tcpiponMachineTcpConnectRequest, andsftpon the machine's ownsftp-server(absent from the mirrored images until the user installs it). - Never block a russh
Handlercallback on the process: russh returns window to the client as soon as data arrives, so the handler is the only backpressure, and the same connection carries all output. Input goes throughinput::SessionInputand output throughOutbound; blocking the handler instead deadlockedcat big | ssh m cat | slow.
Boot-asset pin (engine/arcbox-image)
assets.lockis embedded at COMPILE TIME (include_str!("../../../../assets.lock"),lockfile.rs): the daemon verifies against whateverassets.lockexisted when it was built. Changing the boot manifest/rootfs requires editing the repoassets.lockAND rebuilding the daemon — editing the file alone changes nothing.- The
manifest_sha256pin is verified on BOTHget_assetsandprepare_binaries(verify_manifest_pin,provider.rs), fail-closed on mismatch. A pin MISMATCH makesresolve_desired_booterror;boot.rscatches it and downgrades to acould not resolve desired boot params; skipping drift checkwarn, then boots on the PERSISTED cmdline (drift recreate skipped). A MISSING pin is a loud warn + skipped verification, kept deliberately so local dev can boot unreleased assets (#369). Symptom of an accidental stale/missing pin: boots keep an old kernel/cmdline with only that warn — grep the daemon log for it.
Uninstall contract (arcbox-cli commands/uninstall/)
uninstall/inventory.rsanddocs/data-directories.md"11. Uninstall" are one contract: a new path ArcBox writes on the host lands in both, with its owner check. A privileged path is removed only when it passes the helper's ownership rule, andis_arcbox_ownedrequires an ArcBox bundle name, not only thexbinlayout: OrbStack links its CLI tools from the same layout, and a layout-only check replaced and deleted its links (#715).- Stop the daemon by launchd label or by the PID in
daemon.lock, never by process name.pkill -f com.apple.Virtualization.VirtualMachinestopped every VZ guest on the Mac, other tools' included (#716). The daemon stops its own System VM on SIGTERM; a free flock means the process is gone. - Every step reports
Done,Skipped(why)or an error, and the command exits non-zero when any step failed. Never print a checkmark for a step whose body discarded its result (#716). - A CLI test that reaches
setup::profilemust inject the home throughsetup::Integration::under.profile_path()probes the real login shell'sZDOTDIR, and a test that resolved it from the environment rewrote a developer's~/.config/zsh/.zprofile(2026-10-01).
Extending checklists
- Changing a phase's ordering or adding a phase: update the chain in
main::start, the context types incontext.rs, anddocs/daemon-lifecycle.mdtogether; re-check the gRPC-before-slow-phases and lock-before-gRPC constraints. - Adding a diagnostic RPC: serve it from
early_runtime, notshared_runtime, and add a test that it answers whileshared_runtimeis empty. - Touching the daemon lock / socket paths / spawn handoff: the CLI's
matching logic (
arcbox-clidaemon-spawn.lock+daemon.lockhandoff) must change with it — seedocs/daemon-lifecycle.md"Spawn serialization". - Validate untrusted RPC/request inputs once at the daemon boundary. The
checked-arithmetic rule for virtqueue/ring values (ring GPA, descriptor
field, queue index) lives in
virt/AGENTS.md"Guest-controlled input" — that surface belongs tovirt/, not this layer. - A background loop that talks to a guest agent follows
kubernetes_lb.rs/disk_reclaim.rs: gate onsubscribe_system_vm_state, dispatch on the transport (Runtime::trim_machine_diskis the pattern for a unary RPC that must also work on the HV blocking socketpair), and keep the scheduling behind a trait so the timing is unit-tested withstart_paused.
Validation ladder (cheapest first)
VZ is the oracle backend: HV-only red points at the HV implementation; double red (HV and VZ) points above the hypervisor. Run cheapest first:
- Crate unit tests for the touched crate.
- Daemon-level e2e with
ARCBOX_VM_BACKEND=hv:cargo test -p arcbox-e2e --test virtio_debug -- --ignored(liveGetVirtioDebugsnapshot) and--test boot_assets -- --ignored. The e2e targets are#[ignore]d — without-- --ignoredthe run reports "0 tests run" and validates nothing. - Race-class fixes:
cargo xtask e2e --repeat N(prebuilds once, archives per-run logs/metrics, preserves failed data dirs).
e2e realities (see tests/e2e/AGENTS.md): readiness only via
WatchSetupStatus; failures self-preserve forensics (data dir kept,
virtio-debug.json captured while the VM is alive, metrics.json phase
timings) — read those before re-running; a stale staged arcbox-agent
fails boots confusingly (newest mtime wins); point ARCBOX_E2E_IMAGE at a
reachable mirror rather than weakening a test.
Known gaps / open issues
- ABX-415: daemon SIGSEGV on SIGTERM teardown after successful runs. The
daemon's
shutdown.rsonly triggers the VM stop; the suspect crash site is the HV teardown ordering (virt/arcbox-vmm/AGENTS.md"Teardown ordering") — do not misdiagnose it as a new regression from your change. - ABX-416: no PL031 RTC on HV (see the clock-sync failure signature above).
- Current HV daemon perf is far from targets (root AGENTS.md table): daemon-ready ~11s (target <1.5s), idle CPU ~3.87% (<0.05%), idle RSS ~1.04GB (<150MB). These are known baselines, not per-change regressions.
- The
kick_broadcasts/unpark_broadcastssnapshot fields are retired and read 0 (2026-09-30): no io worker kicks vCPUs after an interrupt any more (seevirt/arcbox-vmm/AGENTS.md"Async-Worker Completion Contract"). HV idle CPU is ~6.7%, ~5.6 points of it therx-injectthread's yield/poll loop. - ABX-413: tgz-packaged docker-tools are verified only via their sha sidecar at download time; the EXTRACTED binary is never re-hashed.
- ABX-414: lifecycle-hardening umbrella — the three-level readiness split,
the unimplemented
HealthMonitorloop (no crash auto-recovery), the unserializedswitch_system_vm_backend, and the guest-vs-host readiness deadline skew (all detailed above). - ABX-417: the
arcbox-bootregistry crate still carries the upstream fixed-temp-name download bug, and the stagedarcbox-agentbinary is verified by existence + exec-bit only (no hash).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

