Skip to content

Document sandbox template onboarding and the template lifecycle #753

Closed

Description

@webchang

Problem

Upstream documents one way to add a template: an operator's manual steps in deploy/sbx/RUNBOOK.md §5
(build the snapshot, pick a worker id, edit SBX_WORKERS and SBX_TEMPLATES_FILE, re-run setup.sh,
install the worker). Nothing tells an operator, or a user, how to turn a container image (for example a
SWE-bench instance image) into a checked Moca template end to end, which rules it must pass, how to
choose it from a session or a sandbox, or how it is updated, activated, retired and traced. The units
filed with #730 to #752 each add a piece; without one guide they are hard to use together.

Proposal

Markdown documentation, split in two PRs (about 2,500 lines in all), each landing after the units it
describes; a section can instead ride with its unit's PR if maintainers prefer.

  • PR-31a, the onboarding guide (about 1,400 lines):
    • deploy/sbx/template-onboarding/GUIDE.md: the mental model (what a snapshot holds, where things
      run, names), the flow on one page, the template spec, a worked example on Moca's public sandbox
      image, from an OCI image to a Moca template, self-serve (pick a profile; make an image
      Moca-ready; path A base on a public Python image; path B a user's own gate record; what Moca
      records; what users hit when refused), a worked SWE-bench instance (spec, build, a client that seeds
      first, an agent on the template), two templates side by side, update and retire, templates in Moca
      Pi sessions (a session pinned to a build, end to end), capacity, and troubleshooting.
    • ONBOARDING.md (the step list), template-onboarding/README.md,
      governance/README.md and governance/PROCESS.md (how gating rules are owned and changed); the
      guide lines of deploy/microvm/P4-ON-P6.md.
  • PR-31b, operations (about 1,100 lines):
    • deploy/sbx/RUNBOOK.md: the template store, the host agent, enrollment and roles through the API,
      guest egress records, memory-aware placement, cold-start pacing, Redis's memory limit, sizing a
      worker's budget for concurrent use, and a login note for clusters whose router certificate is not
      in Node's store (NODE_EXTRA_CA_CERTS for the harness client); deploy/sbx/README.md.
    • deploy/sbx/templates-check.sh and tests/templates-check.test.sh: a live check, gated by
      SBX_LIVE_CHECK=1, that a client chooses the template its sandbox runs on (two users, two or more
      templates, an optional per-template probe; SBX_CHECK_EXEC=0 checks the control plane alone).
    • docs/sbx/user-guide.md (the template commands; that a probe sandbox created with --seed and
      then changed needs sbx rm --force), packages/mocactl/README.md, docs/specs/README.md,
      docs/index.md, the SBX0 design's pointers, and the template lifecycle design's validation head
      and decisions.

Not proposed: a slide deck and its generator, a PDF of the guide (and the guide's section on
regenerating it), the doc tooling under docs/tools/, an internal inventory of images, the lifecycle
design's status and order-of-work sections (§10.1, §11), and the working list of open gaps and
assumptions we kept for our deployment (its open items are filed as issues when a unit touches them). Our deployment's names are replaced by "the cluster"
and "the KVM host".

What the PR will contain

As above: two PRs, Markdown plus one script and its test. The worked examples name public SWE-bench
instance ids and public images only; image locations are given without a registry host.

Depends on

The units it documents: #730, #731, #736-#752 (PR-31a mostly #731, #736-#738, #740-#742, #750, #751;
PR-31b mostly #734, #739, #741-#745, #752). Related: #728 (the retry contract the user guide's exit
codes describe).

How to verify

  • make check-links
  • bash deploy/sbx/tests/templates-check.test.sh
  • A reader follows GUIDE §4b path A on a deployment with the units above: from python:3.12-slim to a
    registered template and a sandbox on it, using only mocactl.

Limits / out of scope

  • The SWE-bench example reads as an example; Moca's templates are not benchmark-specific.
  • The guide describes the units as filed; a section whose unit changes in review changes with it.
  • Sections marked unverified (for example a non-empty egress log) stay marked until run on a
    deployment.

Assisted-By: Claude Code

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions