Skip to content

feat(sbx): install-host.sh sets the snapshot device's read-ahead (SBX_READ_AHEAD_KB) - #782

Merged
pdettori merged 7 commits into
rossoctl:mainfrom
webchang:pr/sbx-read-ahead
Nov 13, 2026
Merged

pdettori merged 7 commits into
rossoctl:mainfrom
webchang:pr/sbx-read-ahead

Conversation

@webchang

@webchang webchang commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Closes #780. One signed-off commit, plus merges of main (now ab8d10e).

What it does: install-host.sh sets the read-ahead of the block device holding $SBX_SRV, and keeps it set across reboots, so a template worker's cold start reads at the volume's throughput.

  • deploy/sbx/sbx-read-ahead.sh (new) resolves the device by path at every run (findmnt's MAJ:MIN, then /sys/dev/block; a partition goes through its parent disk).
  • install-host.sh:
    • SBX_READ_AHEAD_KB: default 512, 0 for off, any whole number from 0 to 16384, checked before the host is touched;
    • a oneshot sbx-read-ahead.service (RequiresMountsFor=$SBX_SRV, Before=sbx.slice);
    • the device's value before the first install is recorded, and the last uninstall (or 0) restores it and removes the unit.
  • [email protected]: After=sbx-read-ahead.service.
  • The docs: the README, and a RUNBOOK "Snapshot read-ahead" section with SBX0 KVM host: set the read-ahead of the snapshot device, so cold starts read at the volume's speed #780's figures and their conditions.

Limits:

  • Verified on one KVM host's reboot: after the boot, read_ahead_kb was 512, sbx-read-ahead.service had run (active, exited) and was ordered before sbx.slice. Other hosts and kernels are untested.
  • It's device-wide, so everything else on that volume reads ahead as much.
  • 512 suits a throughput-bound network volume; local NVMe may want less.
  • It changes the size of the reads, not the bytes a cold start reads.
  • A value set by hand is overwritten at the next boot, and the last uninstall restores the value recorded at the first install.

Tests:

  • deploy/sbx/tests/install-host.test.sh has 7 new blocks, with a mocked findmnt and a fake sysfs. They pass on bash 5, and on bash 3.2 everything passes except the janitor case's declare -A, which already stops on main.
  • shellcheck adds no findings.
  • deploy-scripts runs close to its 5-minute limit with the new shell suites; a canceled run with every test passing clears on rerun (CI: deploy-scripts' 5-minute limit cancels runs whose tests all pass #777).

6 files, +316 / -2.

Assisted-By: Claude Code

…_READ_AHEAD_KB)

A cold start reads its 4 GiB memory file from $SBX_SRV, left at the
kernel's 128 KiB read-ahead; on a network block volume whose largest
request is 128 KiB that keeps too few reads in flight to reach the
volume's throughput. Measured on one KVM host (750 MiB/s, 3,000 IOPS,
page cache dropped, 8 cold starts 4 at a time): all active at 100.7 s
at 128 KiB, 62.2 s at 512, the same bytes read.

SBX_READ_AHEAD_KB (default 512; 0 leaves the device alone; 0-16384,
else refused before the host is touched). sbx-read-ahead.sh finds the
device by path at every run (findmnt MAJ:MIN, /sys/dev/block; a
partition through its disk), and a oneshot sbx-read-ahead.service sets
it at boot, before sbx.slice. The value before the first install is
kept, and the last --uninstall (or 0) writes it back and removes the
unit. An unresolvable path or a refused value warns, never fails.
Device-wide: everything else on the volume reads ahead as much.

Tests: install-host.test.sh with a mocked findmnt and a fake sysfs.

Refs rossoctl#780

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 12, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

A small, well-tested change: input validation of SBX_READ_AHEAD_KB happens before the host is touched (regex plus a 16384 bound, decimal only), the device is resolved by MAJ:MIN at every run (partitions go through their disk), unit paths are checked against PLAIN_PATH_RE, and the root check, idempotent re-runs and manifest-driven removal all match the script's existing patterns. One suggestion: the value recorded at the first install doesn't say which device it came from, so if SBX_SRV moves to another volume, the new device's original value is never captured and the old device is never restored. One nit: the README says 0 'leaves the device alone', but on a host that already has the unit, 0 writes the recorded value back.

Author: webchang (MEMBER — maintainer)
Areas reviewed: install-host.sh read-ahead install/uninstall, sbx-read-ahead.sh device resolution, input validation, idempotency/manifest handling, systemd unit ordering, tests, README/RUNBOOK docs, commit conventions/DCO, agent-config gate
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (all 16 checks, including shellcheck, deploy-scripts and deploy-scripts-bash32)

0 must-fix, 1 suggestions, 1 nits.

Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).

install -d -m 0755 "$SBX_LIBEXEC_DIR" "$SBX_UNIT_DIR"
# The value before the FIRST install: a re-run (with this or another value) keeps it.
if [[ ! -s "$orig" ]]; then
(umask 077 && printf '%s\n' "$cur" >"$orig")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: read-ahead.orig holds only a number, with no device. The file is written only when it is empty ([[ ! -s "$orig" ]]), and remove_read_ahead (line 464) writes that number to whatever device the current $SBX_SRV resolves to. So if /srv/sbx is moved to another volume and the worker is re-installed, (a) the new device's original value is never recorded: the last uninstall writes the old device's value to the new device, and (b) the old device keeps 512 until a reboot. Suggested fix: store the device with the value, e.g. printf '%s %s\n' "$majmin" "$cur" (have resolve also print MAJ:MIN, or derive it from $q). Re-record when the MAJ:MIN differs; on removal, restore only if the device still matches, and warn otherwise.

Comment thread deploy/sbx/README.md
it.

A worker install also sets the kernel read-ahead of the block device holding `/srv/sbx` to
`SBX_READ_AHEAD_KB` (default 512 KiB; `0` leaves the device alone), so a worker's cold start reads its

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: "0 leaves the device alone" is true only on a host where read-ahead was never installed. On a host that has the unit, SBX_READ_AHEAD_KB=0 calls remove_read_ahead, which writes the recorded value back (install-host.sh:421-424; the RUNBOOK's "Turn it off" bullet says so). Suggest: "0 installs nothing, and restores the recorded value if an earlier install set one". The same wording is in the install-host.sh header (line 56) and in the die message at line 790.

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Adds deploy/sbx/sbx-read-ahead.sh (resolves the block device holding $SBX_SRV via findmnt MAJ:MIN -> /sys/dev/block, partition -> parent disk queue, dm/md/loop own queue) and has install-host.sh validate SBX_READ_AHEAD_KB (0..16384, decimal, no leading zero), install a oneshot sbx-read-ahead.service the workers are ordered after, record the pre-install value, and restore it on the last uninstall or SBX_READ_AHEAD_KB=0. The shell is careful: validation happens before any host change, the regex guards the arithmetic (no octal/injection via (( ))), paths going into the unit are checked against PLAIN_PATH_RE, everything is 3.2-safe, and the unresolvable cases (tmpfs/overlay/btrfs anonymous dev, no queue) warn rather than fail. Two issues: a re-run without the variable silently resets a host-wide setting another install chose, and the README describes 0 as 'leaves the device alone' when it actually restores and removes.

Author: webchang (MEMBER — maintainer)
Areas reviewed: Shell, systemd, Docs
Agent/IDE config (.claude/.vscode): none
Commits: all signed-off: yes
CI status: all 16 checks pass

Inline: 0 must-fix, 1 suggestion, 1 nit.

AI-assisted review, approved by a maintainer before posting.

Overlap with clawgenti (same head): +1 to clawgenti's README nit ("0 leaves the device alone" is wrong on a host that already has the unit). The same wording also appears at install-host.sh:56 and in the die message. We have not repeated it inline.

: "${SBX_ATTACH_SETTLE:=5}"
: "${SBX_BIN_DIR:=/usr/local/bin}"
# KiB, 0..16384; 0 leaves the device unchanged (and removes the unit a previous install left).
: "${SBX_READ_AHEAD_KB:=512}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: The read-ahead is host-wide (one unit, one device), but it is driven by a per-worker install whose env defaults to 512 every time. So on a host where the operator set SBX_READ_AHEAD_KB=1024 (or 0, to turn it off on local NVMe), the next install-host.sh <bundle> for any other worker, or a routine re-run to rotate a token, silently rewrites the unit to 512 (or reinstalls it after 0) and applies it right away. The RUNBOOK says this for 0, but nothing in the install output says it is overriding an earlier choice. Suggestion: when SBX_READ_AHEAD_KB is unset and a manifest-recorded sbx-read-ahead.service exists, keep that unit's value (parse its ExecStart= or record the chosen value next to read-ahead.orig), and record an explicit 0 so a later default install does not bring it back. Apply the 512 default only on a host with no earlier choice. At the very least, log read-ahead was N, now M when the value changes.

The boot starts sbx-read-ahead.service (a oneshot with RemainAfterExit),
so remove_read_ahead's plain disable left it loaded and active until
the next boot. It now runs `systemctl disable --now` (the unit has no
ExecStop, so stopping it changes no device setting) and a
daemon-reload after its files are gone.

Refs rossoctl#780

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
@webchang

Copy link
Copy Markdown
Member Author

Removing the read-ahead setting now stops its unit (disable --now; the unit has no ExecStop, so the device keeps the restored value) and reloads systemd after the files are gone. A live run had shown the unit still loaded and active until the next boot. New head: 87f26c1.

Assisted-By: Claude Code

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up at 87f26c1. The PR adds one commit, "removing read-ahead stops its unit, then reloads systemd" (signed off, Refs #780). remove_read_ahead now runs systemctl disable --now sbx-read-ahead.service and, after the unit files are gone, systemctl daemon-reload || true. That's correct. The oneshot has RemainAfterExit and no ExecStop, so stopping it is only a state change and doesn't touch the device. Before this, on the SBX_READ_AHEAD_KB=0 path, systemd showed the unit as loaded and active until the next boot. On the last-uninstall path (remove_shared_units), daemon-reload now runs twice, which is harmless. The test is updated to expect disable --now.

Not addressed (both non-blocking, from the 806626a round): the default of 512 on a re-run silently overrides an operator's earlier value or a 0 (install-host.sh:76), and the README wording "0 leaves the device alone" (README.md:152).

Author: webchang (MEMBER — maintainer) · Areas: Shell, systemd · Agent/IDE config: none · Commits: 2, all signed off · CI: all 16 checks pass.

AI-assisted review, approved by a maintainer before posting.

: >"$MOCK_LOG"
SBX_READ_AHEAD_KB=0 bash "$INSTALL" "$(bundle sbx_ra)" --snapshot default >"$TMP/out" 2>&1 || fail 're-run with 0'
[[ "$(cat "$DM/queue/read_ahead_kb")" == 256 && ! -e "$RAU" && ! -e "$RAO" ]] || fail '0 did not restore and remove the read-ahead'
! grep -q '^readahead ' "$EM" || fail "0 left readahead lines: $(cat "$EM")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: The SBX_READ_AHEAD_KB=0 case is the only path where the new daemon-reload in remove_read_ahead is the one that counts (on the last uninstall, --uninstall reloads again at the end anyway), but nothing asserts it there. Consider asserting that systemctl daemon-reload appears in $MOCK_LOG after systemctl disable --now sbx-read-ahead.service for this run.

@pdettori

Copy link
Copy Markdown
Member

need rebase and resolve conflicts

Upstream main (634781a) carries rossoctl#758's deploy fixes, which touch the
same lines as the read-ahead change. No API version change: this branch
claims none.

Conflicted:
- deploy/sbx/README.md: both paragraphs kept, the read-ahead one
  after the uninstall paragraph, then main's template-onboarding one.
- deploy/sbx/install-host.sh: main's SBX_WORKER_BIN default and its
  validate_worker comment kept; the SBX_READ_AHEAD_KB default and the
  read-ahead functions added beside them (this branch's older copy of
  the comment dropped).
- deploy/sbx/[email protected]: main's unit, with no moca-egress
  dependency (the egress drop-in carries it), kept; only
  sbx-read-ahead.service is added to After=, with its comment.
- deploy/sbx/tests/install-host.test.sh: main's snap() fixture and its
  guest-RAM and SBX_WORKER_BIN blocks kept; the findmnt mock, the
  SBX_SYSFS export and the read-ahead block added, the read-ahead block
  after main's.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Upstream main (f60db30) adds session grants (rossoctl#807) in the control
plane and its docs. No file conflicted, and no file this branch
changes is touched; no API version change.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
@pdettori

Copy link
Copy Markdown
Member

still merge conflicts

Conflicts:
- deploy/sbx/tests/install-host.test.sh: main's SBX_LIBEXEC_DIR (the VM
  reaper's install dir, under the test's temp dir) is kept on the shared
  export line, after this branch's SBX_SYSFS line. The read-ahead helper
  installs under the same SBX_LIBEXEC_DIR.

Auto-merged without conflict: [email protected] keeps main's
ExecStopPost= reaper and this branch's After=sbx-read-ahead.service.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Upstream main (949dc5f) adds SBX_WORKER_AT_BOOT (rossoctl#799), the worker
stop's VM reap (rossoctl#800), and template tags, edits and owner transfer
(rossoctl#774). This branch claims no API version.

Conflicted:
- deploy/sbx/install-host.sh (main): both checks kept, this branch's
  SBX_READ_AHEAD_KB refusal and then main's SBX_WORKER_AT_BOOT one,
  each before the host is touched.

Also changed in the merge:
- install-host.sh's header, the README and the RUNBOOK's read-ahead
  section say sbx-read-ahead.service is enabled whatever
  SBX_WORKER_AT_BOOT says, so a host agent's later worker starts read
  ahead too; install-host.test.sh checks it (a worker installed with
  SBX_WORKER_AT_BOOT=0 still enables the read-ahead, not the worker).
- deploy/sbx/README.md: a blank line after the read-ahead paragraph,
  which ran into the next one.
- [email protected] (auto-merged): main's ExecStopPost and this
  branch's After=sbx-read-ahead.service both kept.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up at b902571 (ab7e40b..b902571). This push has no commits of this PR's own. It merges main 1016d26 (#800, #768). The PR's net diff against main is byte-identical to the one at ab7e40b. I checked the hand resolution with git show --remerge-diff and a dropped-lines check against both parents. The conflict was in deploy/sbx/tests/install-host.test.sh. It keeps this PR's SBX_SYSFS fake beside #800's SBX_LIBEXEC_DIR on the shared export line. No conflict markers are left.

Author: webchang (MEMBER — maintainer)
Agent/IDE config (.claude/.vscode): none
Commits: no new own commits; one merge of upstream main 1016d26 (#800 worker-stop VM reaping, #768 --record / sbx token --renew-every); DCO pass
CI status: all green

AI-assisted review, approved by a maintainer before posting.

No conflicts: main adds setup.sh's Redis guard, its tests and the image's
Dockerfile.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up at 506a454 (b902571..506a454). There are no new commits of this PR's own. The push is two merges of upstream main.

  • 4b49e56 merges #799 (SBX_WORKER_AT_BOOT) and #774. I checked it with git show --remerge-diff. The main() conflict keeps both validations (SBX_READ_AHEAD_KB, then SBX_WORKER_AT_BOOT). The merge also adapts this PR to #799. sbx-read-ahead.service is still enabled when SBX_WORKER_AT_BOOT=0, which is right: under a host agent the boot still sets the read-ahead before any worker starts. The README, RUNBOOK and the header comment of install-host.sh now say so. The dm test adds a SBX_WORKER_AT_BOOT=0 case, which checks that the read-ahead unit is enabled and the worker is not. This matches the code: install_read_ahead always runs systemctl enable sbx-read-ahead.service.
  • 506a454 merges #810 and #812 with no conflicts. Its remerge-diff is empty.

No conflict markers are left. There are no .claude/ or .vscode/ changes.

Author: webchang (MEMBER — maintainer)
Agent/IDE config (.claude/.vscode): none
Commits: no new own commits; two merges of upstream main; DCO pass
CI status: green (one duplicate check job still running when this was drafted)

AI-assisted review, approved by a maintainer before posting.

@pdettori
pdettori merged commit 0a22858 into rossoctl:main Nov 13, 2026
17 checks passed
webchang added a commit to webchang/moca that referenced this pull request Nov 14, 2026
Brings upstream main 01528b6 (rossoctl#769, rossoctl#782, rossoctl#771, rossoctl#773) through
pr/i18-host-agent. Main took API 1.9.0, and the host agents moved to
1.10.0, so this branch's activation section moves to 1.11.0.

Conflicts:
- docs/api/CHANGELOG.md: ## 1.11.0 activation, above ## 1.10.0 host
  agents and main's ## 1.9.0, which are unchanged.
- docs/api/openapi.yaml: main's 409 self_attested on the owner transfer,
  then this branch's activate and deactivate paths. info.version is
  1.11.0.
- docs/reference/change-policy.md: main's list, then "the template host
  agents, then activation leases". Both version numbers are 1.11.0.
- docs/reference/http-api.md: the host agents row (API 1.10.0), then the
  Activation row (API 1.11.0). "Activation came with API 1.11.0."
- packages/control-plane/src/sandbox-handlers.ts: ReadinessFacts carries
  both this branch's placement and nowS and main's trusted set. Its
  docs argument and both returns carry all three.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
webchang added a commit to webchang/moca that referenced this pull request Nov 16, 2026
…te lifecycle stack

Upstream main 0dc3d01 (API 1.21.0) carries the reviewed, final form of
the features this branch held in early, integrated versions, through the
PRs filed from this fork (rossoctl#755-rossoctl#776, rossoctl#781, rossoctl#782, rossoctl#784-rossoctl#786, rossoctl#789-rossoctl#794,
rossoctl#798-rossoctl#800) and the maintainer's lease mode, grants and lease clients
(rossoctl#763, rossoctl#802, rossoctl#807, rossoctl#808, rossoctl#810, rossoctl#812, rossoctl#814). Where upstream has a feature,
upstream's version wins: its code, tests, openapi, CHANGELOG (byte
identical), docs and specs.

The fork was 736 commits behind and 390 ahead (merge base dd0ce71).

Conflict resolution (148 files, 82 both-modified, 66 both-added): every
conflicted file is upstream's side as is (byte identical to 0dc3d01).
No conflicted file differs from 0dc3d01 in this commit.

One file merged without a conflict and was set back to upstream's:
- packages/mocactl/src/sbx/push.ts: the auto-merge added the fork's
  baselineAtHead a second time beside upstream's own (fb28e06's
  function, already upstream); upstream's file as is.

With that, this commit's tree is 0dc3d01's plus the 18 files only the
fork has (below). Every other file the fork changed is upstream's.

Conflicted files, all resolved to upstream's side (0dc3d01):
- deploy/k8s/overlays/ocp-combined/kustomization.yaml (AA)
- deploy/k8s/overlays/ocp-combined/patch-addressing.yaml (AA)
- deploy/k8s/overlays/ocp-combined/patch-relay.yaml (AA)
- deploy/microvm/P4-ON-P6.md (UU)
- deploy/microvm/build-rootfs.sh (UU)
- deploy/microvm/build-snapshot.sh (UU)
- deploy/microvm/setup-microvm.sh (UU)
- deploy/microvm/tests/build-rootfs.test.sh (UU)
- deploy/microvm/tests/build-snapshot.test.sh (UU)
- deploy/microvm/tests/setup-microvm.test.sh (UU)
- deploy/sbx/README.md (UU)
- deploy/sbx/RUNBOOK.md (UU)
- deploy/sbx/host-agent.sh (AA)
- deploy/sbx/install-host.sh (UU)
- deploy/sbx/sbx-host-agent-wanted.service (AA)
- deploy/sbx/sbx-host-agent-wanted.timer (AA)
- deploy/sbx/sbx-host-agent.service (AA)
- deploy/sbx/[email protected] (UU)
- deploy/sbx/setup.sh (UU)
- deploy/sbx/template-onboarding/GUIDE.md (AA)
- deploy/sbx/template-onboarding/ONBOARDING.md (AA)
- deploy/sbx/template-onboarding/README.md (AA)
- deploy/sbx/template-onboarding/examples/django__django-11133.gate-record.json (AA)
- deploy/sbx/template-onboarding/examples/django__django-11133.json (AA)
- deploy/sbx/template-onboarding/governance/GATING-RULES.md (AA)
- deploy/sbx/template-onboarding/governance/PROCESS.md (AA)
- deploy/sbx/template-onboarding/governance/README.md (AA)
- deploy/sbx/template-onboarding/template-build.sh (AA)
- deploy/sbx/template-onboarding/template-register.sh (AA)
- deploy/sbx/template-onboarding/tests/examples.test.sh (AA)
- deploy/sbx/template-onboarding/tests/template-build.test.sh (AA)
- deploy/sbx/template-onboarding/tests/template-register.test.sh (AA)
- deploy/sbx/template-onboarding/verify-provenance.py (AA)
- deploy/sbx/templates-check.sh (AA)
- deploy/sbx/tests/host-agent.test.sh (AA)
- deploy/sbx/tests/install-host.test.sh (UU)
- deploy/sbx/tests/overlay-combined.test.sh (AA)
- deploy/sbx/tests/setup.test.sh (UU)
- deploy/sbx/tests/templates-check.test.sh (AA)
- deploy/vm/tests/setup-vm.test.sh (UU)
- docs/api/CHANGELOG.md (UU)
- docs/api/harness-openapi.yaml (UU)
- docs/api/openapi.yaml (UU)
- docs/concepts/sandboxes-and-tiers.md (UU)
- docs/reference/change-policy.md (UU)
- docs/reference/cli-mocactl.md (UU)
- docs/reference/configuration.md (UU)
- docs/reference/http-api.md (UU)
- docs/sbx/user-guide.md (UU)
- docs/specs/2026-10-15-sbx0-internal-sandbox-service-design.md (UU)
- docs/specs/2026-10-30-session-sandbox-templates-design.md (AA)
- docs/specs/2026-11-03-template-lifecycle-and-provenance-design.md (AA)
- docs/specs/2026-11-05-combined-control-plane-design.md (AA)
- docs/specs/2026-11-08-enrollment-and-roles-api-design.md (AA)
- docs/specs/2026-11-08-sandbox-egress-records-design.md (AA)
- docs/specs/2026-11-08-subject-trust-gate-records-design.md (AA)
- docs/specs/README.md (UU)
- harness/src/run-turn.ts (UU)
- harness/src/sandbox-affinity.ts (UU)
- harness/src/select-sandbox.ts (UU)
- harness/test/select-sandbox-templates.test.ts (AA)
- harness/test/turn-seed.test.ts (AA)
- harness/test/turn-stream.test.ts (UU)
- packages/control-plane/src/activation-lock.ts (AA)
- packages/control-plane/src/activation.ts (AA)
- packages/control-plane/src/egress-handlers.ts (UU)
- packages/control-plane/src/egress-log.ts (AA)
- packages/control-plane/src/errors.ts (UU)
- packages/control-plane/src/exchange.ts (UU)
- packages/control-plane/src/handler-util.ts (UU)
- packages/control-plane/src/handlers.ts (UU)
- packages/control-plane/src/host-handlers.ts (AA)
- packages/control-plane/src/identity.ts (UU)
- packages/control-plane/src/index.ts (UU)
- packages/control-plane/src/main.ts (UU)
- packages/control-plane/src/member-handlers.ts (AA)
- packages/control-plane/src/members.ts (AA)
- packages/control-plane/src/ownership.ts (UU)
- packages/control-plane/src/provenance.ts (AA)
- packages/control-plane/src/routes.ts (UU)
- packages/control-plane/src/sandbox-config.ts (UU)
- packages/control-plane/src/sandbox-handlers.ts (UU)
- packages/control-plane/src/server.ts (UU)
- packages/control-plane/src/template-catalog.ts (AA)
- packages/control-plane/src/template-policy.ts (AA)
- packages/control-plane/src/token.ts (UU)
- packages/control-plane/test/activation.test.ts (AA)
- packages/control-plane/test/egress-redis.test.ts (AA)
- packages/control-plane/test/errors.test.ts (UU)
- packages/control-plane/test/host-flow.test.ts (AA)
- packages/control-plane/test/members.test.ts (AA)
- packages/control-plane/test/openapi-contract.test.ts (UU)
- packages/control-plane/test/provenance.test.ts (AA)
- packages/control-plane/test/repository-allowlist.test.ts (AA)
- packages/control-plane/test/route-authz-enumeration.test.ts (UU)
- packages/control-plane/test/route-profile.test.ts (UU)
- packages/control-plane/test/routes.test.ts (UU)
- packages/control-plane/test/sandbox-egress.test.ts (AA)
- packages/control-plane/test/sandbox-handlers.test.ts (UU)
- packages/control-plane/test/session-templates.test.ts (AA)
- packages/control-plane/test/subject-trust.test.ts (AA)
- packages/control-plane/test/template-admin.test.ts (AA)
- packages/control-plane/test/template-catalog.test.ts (AA)
- packages/control-plane/test/template-create.test.ts (AA)
- packages/knative-server/src/server.ts (UU)
- packages/knative-server/src/turn-auth.ts (UU)
- packages/knative-server/test/turn-auth.test.ts (UU)
- packages/mocactl/src/api/errors.ts (UU)
- packages/mocactl/src/api/frames.ts (UU)
- packages/mocactl/src/cli.ts (UU)
- packages/mocactl/src/core/session-manager.ts (UU)
- packages/mocactl/src/core/session-options.ts (UU)
- packages/mocactl/src/headless.ts (UU)
- packages/mocactl/src/sbx/api.ts (UU)
- packages/mocactl/src/sbx/call-record.ts (AA)
- packages/mocactl/src/sbx/cli.ts (UU)
- packages/mocactl/src/sbx/commands.ts (UU)
- packages/mocactl/src/sbx/dry-run.ts (AA)
- packages/mocactl/src/sbx/exec.ts (UU)
- packages/mocactl/src/sbx/run.ts (UU)
- packages/mocactl/src/sbx/templates.ts (AA)
- packages/mocactl/test/contract.test.ts (UU)
- packages/mocactl/test/harness.test.ts (UU)
- packages/mocactl/test/headless.test.ts (UU)
- packages/mocactl/test/helpers/sbx.ts (UU)
- packages/mocactl/test/run-record.test.ts (AA)
- packages/mocactl/test/sbx-admin-subjects.test.ts (AA)
- packages/mocactl/test/sbx-cli.test.ts (UU)
- packages/mocactl/test/sbx-egress.test.ts (AA)
- packages/mocactl/test/sbx-exec.test.ts (UU)
- packages/mocactl/test/sbx-templates.test.ts (AA)
- packages/mocactl/test/session-manager.test.ts (UU)
- packages/mocactl/test/session-options.test.ts (UU)
- remote-worker/cmd/microvm-worker/main.go (UU)
- remote-worker/cmd/microvm-worker/template_record.go (AA)
- remote-worker/cmd/microvm-worker/template_record_test.go (AA)
- remote-worker/cmd/microvm-worker/verify_cache.go (AA)
- remote-worker/cmd/microvm-worker/verify_cache_test.go (AA)
- remote-worker/internal/egress/audit_test.go (UU)
- remote-worker/internal/session/labels.go (UU)
- remote-worker/internal/vmpool/errors.go (UU)
- remote-worker/internal/vmpool/guestconn.go (UU)
- remote-worker/internal/vmpool/guestconn_test.go (UU)
- remote-worker/internal/vmpool/launcher_firecracker.go (UU)
- remote-worker/internal/vmpool/launcher_firecracker_egress_unix_test.go (UU)
- remote-worker/internal/vmpool/snapshot.go (UU)
- remote-worker/internal/vmpool/snapshot_test.go (UU)
- remote-worker/internal/vmpool/verifycache.go (AA)

Fork-only files, kept as they are (upstream has no such file):
- deploy/sbx/mint-login.sh, deploy/sbx/tests/mint-login.test.sh: a test
  login minted with the deployment's signing key. Checked against
  upstream: makeSigner/mint, SANDBOX_API_ISSUER, the moca-mu1 Secret and
  its label, the env keys it reads and mocactl's sbx-auth.json shape are
  all still upstream's.
- deploy/sbx/template-onboarding/deck/ (README, requirements, the two
  generators, deck_kit.py, the two PDFs, .gitignore): the fork's decks.
- deploy/sbx/template-onboarding/GUIDE.pdf: regenerated from upstream's
  GUIDE.md in a later commit.
- deploy/sbx/template-onboarding/governance/GAPS-AND-ASSUMPTIONS.md and
  INVENTORY-2026-11-02.md: the fork's register and inventory.
- docs/specs/2026-11-09-cold-start-pacing-design.md,
  2026-11-09-memory-aware-placement-design.md and
  2026-11-10-mocactl-template-commands-design.md: the fork's design
  notes; upstream folded their content into its lifecycle spec
  (§6.4 memory, §6.5 pacing) and the user guide (mocactl).
- docs/tools/gen_pdf.py, docs/tools/gen_toc.py: the PDF and TOC tools.

Fork-only behaviour, decided one by one (from git log 0dc3d01..f125c02
--no-merges, checked against 0dc3d01):

Ported onto upstream's code, each in its own commit after this one:
- The pinned-session retire guard (c571226): a retire is refused
  (409 build_in_use) while an active Moca Pi session is pinned to the
  build. Upstream's buildsInUse checks live sandboxes only and its
  comment says pinned sessions are still to be checked.
- Reuse only while a host holds the snapshot (G29, 521efe5): upstream
  reuses any registered build with the same inputs; its own lifecycle
  spec (§4, Reuse) says a registered build is reused only while a host
  reports holding its snapshot.
- install-host.sh --uninstall-shared and the mounted legacy jail guard
  (5e66397): upstream has neither.
- GUIDE §4b.4's base example without skip_git_identity_check
  (f125c02): upstream applies X12 under every profile, so its example
  create would be refused.
- Links from upstream's READMEs to the fork-only files above.

Dropped, because upstream's design replaces them on purpose:
- Removal of admin-rejected builds: upstream stops them and never
  removes them (the user's decision in rossoctl#786).
- The harness-profile catalog's fallback to SH_SESSION_TEMPLATES
  (902255b): upstream serves the harness profile the store's templates
  only (its test was renamed so); a combined plane is unaffected.
- The fork's register ids (G-numbers), window dates and results
  pointers inside the documents upstream now has (RUNBOOK, README,
  GUIDE, ONBOARDING, PROCESS, GATING-RULES, P4-ON-P6, the specs):
  upstream's text wins; the fork's own documents above keep them.
- The fork's image-builder-specific wording in GATING-RULES.md:
  upstream's generic wording (the image builder) is taken as is.

Dropped, could be re-proposed (no upstream equivalent, but the port is
an API change or its intent upstream is unclear):
- TurnPlacement.template, a turn result naming the session's sandbox
  template (9d6004d): a harness API field; upstream's CHANGELOG is kept
  byte identical.
- An imported build's catalog entry and create record carrying the
  declared seed (20d0995): sessions are seeded the same (upstream falls
  back to the declared seed); only the field in the catalog API goes.
- mocactl: sbx create --seed checking the seeded HEAD against the spec's
  baseline_commit; activate --wait stopping at once on not_held or
  memfile_mismatch; ApiError's readiness, readinessReason and
  queuePosition in refusals; an admin write refused when the control
  plane URL came only from the login; the admin-write issuer check for
  the combined profile; the dry run's X1.offline check and its guest_mb
  and git-less advice; the quota, policy and build lines' extra fields
  (quotaSource, selfAttest, allowedRepositories, heldBy, attestation).
  Upstream's reviewed client (rossoctl#767, rossoctl#768) left them out; the server
  still enforces every rule.

Already upstream (not lost): build reuse (G21), the verify cache, the
host agent's --keep-shared removals, read-ahead, the hash_version 2
check in the microVM worker, M7, G39, G42, G43, G48, G49, G50, mocactl
--record, --version, the minted login's own control plane, activate
--wait sizing, and every other fork feature listed in the task.

The relay's per-client tokens: not on this branch (the fork's
sandbox-relay main.ts is older upstream code), so nothing to resolve.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added this to the v0.11.0 milestone Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SBX0 KVM host: set the read-ahead of the snapshot device, so cold starts read at the volume's speed

4 participants