Repository navigation
docs(sandbox): a first template from a container image, and offering templates to every user - #930
Merged
Merged
Conversation
…templates to every user Make a template from a container image walks a user from an image to a working template in eight steps, with python:3.12-slim: the registry and quota checks, the profile, the moca-ready layer, the spec field by field, dry-run/create/follow, activate and try, visibility, and the common refusals. Offer templates to every user tells an operator when to declare a template and when to use a deployment-visible template in the store, what installing each build's worker means, and what the policy controls. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
ingpaolodettori-dev
approved these changes
Nov 19, 2026
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Review — docs(sandbox): a first template from a container image, and offering templates to every user
Both pages fill the gap the template docs had between "here is the model" and "here is every flag", and the commands and outputs they show are the CLI's own. One nit inline.
The user page
- Every command exists with the flags shown:
templates create --spec/--profile/--dry-run,templates follow,templates activate --wait,create --template/--seed,up --template,run --sandbox,templates edit --visibility,templates tag … --build(sbx/cli.ts). The printed results match the code's text — the dry run's… passes the local checks (base)(templates.ts:490-505), the queued line's handle,follow's 0/1/5 with the 3600 s default (FOLLOW_TIMEOUT_S), andactive, leased until …(:767). - The spec guidance is the build's actual checks: id grammar (
TEMPLATE_ID_RE, 31 chars), pinned image,guest_ram_mb≥ 128, vcpus 1-32,expectas extended regexes each of which must match,expect_rc,timeout_s1-86400 (template-build.sh:128-252). The moca-ready list is the build's required-tools list (bash ls cat base64 file,:351-353) plus the/etc/hostsandlinux/amd64requirements from the onboarding guide. - The policy refusals,
probe_failed,409 template_existsand the quota notes matchtemplate-policy.ts, the host agent's failure codes, and the quota table.
The operator page
- The two ways are the two the control plane has: a declared entry (owner
null, no activation,hostManagedfalse) or a stored template withdeploymentvisibility. - Import-once is exact:
FileTemplateCatalog.importOnceimportsSH_SANDBOX_TEMPLATESinto an empty store and later only warns that the list differs (template-catalog.ts:278-300). - The declared-template steps match the scripts:
template-build.sh SPEC --kernel,template-register.sh --env-file,install-host.sh BUNDLE --snapshot … [--budget-mb|--no-egress],templates-check.sh; the worker id issbx_<id with - as _>_<first 12 hex>(template-build.sh:70-71,:219); setup.sh rolls the control plane and not the relay, as the guide's own evidence says. - The store path's "install each build's worker once" is the host agent's
worker not installed on this hostrefusal, and the lease/quota/trust rules matchsandbox-handlers.tsand the default policy (base 16384 MiB/8 vCPUs, registries<default>, quotas 100/10/8/200).
Checks — check-links 242 files/0 broken, publish hygiene 89 files clean, CI green (17/17).
One nit inline on the operator page's first sentence.
| > declared Stable; interfaces and limits may change. Known limits: | ||
| > [Limits operators must know](runbook.md#9-limits-operators-must-know). | ||
|
|
||
| A template every user of the sandbox service can create sandboxes from comes one of two ways: the |
There was a problem hiding this comment.
nit: the sentence is missing a word and reads awkwardly: "A template every user … can create sandboxes from comes one of two ways". "comes in one of two ways" (and "A template that every user …" if you want the relative clause signposted) would read cleanly.
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.
Summary
Two new how-to pages close the template gaps on the docs site:
docs/sandbox/how-to/template-from-image.md: Make a template from a container image. A user goes from an image to a working template in eight steps, with one worked example (python:3.12-slim):mocactl sbx policy,mocactl sbx quota);/etc/hosts, the guest agent's tools,linux/amd64);Rewritten from the onboarding guide's §4b, which it links for the long form.
docs/operate/sandbox-service/offer-templates.md: Offer templates to every user. For operators:SBX_TEMPLATES_FILE/SBX_WORKERS) and when to use a deployment-visible template in the store;It links runbook §5 and the host-agent section for the full procedures.
A pointer from
templates.md, a row in the user guide's Tasks table, and a bullet inoperate/index.md.Where the onboarding guide differs from the code
The pages follow the code:
deploymentvisibility (sandbox-handlers.ts), not "only you". Only self-attested templates are storedprivate.skip_git_identity_check. The guide'sbaseexample sets it, but ruleX12now refuses it without a gate record. The example leaves it out.<default>, so a Docker Hub image is refused until an admin addsdocker.io.SBX_TEMPLATE_STORE=1,SBX_TEMPLATES_FILEis imported once, and later changes are only warned about. The operator page says to add new templates through the store.The guide and the runbook's host-agent paragraph could get a follow-up so they match.
Checks
check-doc-links.py,check-docs-publish.shand prettier pass, from a clean clone of the branch.check-docs-site.sh: 67 pages, no broken links.Assisted-By: Claude Code