docs: CoW snapshot-fork backend design (Tier 3)#17
Merged
Conversation
This was referenced Jun 11, 2026
Design-only proposal: a second snapshot-capable backend (Firecracker/CH) behind the existing backend trait for high-fan-out agent sandboxes, since libkrun has no snapshot. Maps forkd (snapshot+UFFD+diff-chaining) and clone (shadow-clone+KSM) onto a3s-box, reusing the overlay rootfs CoW, warm pool, and — the key advantage — the existing guest vsock exec server as the post-fork re-injection hook. Phased plan: P0 KSM/boot-trim (done, #16) → P1 per-image template pool + re-inject handshake (doable on libkrun, de-risks) → P2 real snapshot-fork backend → P3 diff-chaining + balloon.
56bc3b6 to
d5b287e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Design-only proposal (no implementation) for the high-fan-out agent-sandbox story, completing the CoW optimization plan started in #16.
Core decision: libkrun has no snapshot/restore (verified: 0 of ~75
krun_*are snapshot; guest RAM is anonymous-private;krun_start_entertakes over the process). So rather than fork libkrun's memory VMM, add a second snapshot-capable backend (Firecracker / Cloud Hypervisor) behind the existing backend trait — libkrun stays default; the fork backend serves fan-out.Maps forkd (template snapshot + UFFD CoW restore + diff-snapshot chaining) and clone (shadow-clone + KSM) onto a3s-box, reusing what already exists: overlay rootfs CoW, the warm pool, and — the key advantage — the guest vsock exec server as the post-fork re-injection hook (reidentify + exec-main handshake, since a forked child needs hostname/IP/box_id/command re-stamped).
Phased plan:
Recommendation: build P1 next (cheap, libkrun-native, validates demand); treat P2 as a funded epic.