build(docker): bake chromium runtime libs and refresh pinned tools (#357)

* build(docker): bake chromium runtime libs and refresh pinned tools

Install the Chromium runtime libraries in the runner image from Playwright's
own resolver instead of a hand-maintained package list, so a Playwright e2e
suite runs in the Manager container without root or sudo. PLAYWRIGHT_VERSION
is shared with the sandbox guest image and the docker-build workflow.

Refresh the remaining pins: node 24.21.0, pnpm 10.28.1, OpenCode 1.18.31,
microsandbox 0.7.2 and @opencode-ai/sdk 1.18.31. CI moves to Node 24 to match
the image and the documented requirement.

uv stays at 0.12.7. The runner previously fetched the unversioned installer
URL, so UV_VERSION and the workflow build argument had no effect; it now
installs from the versioned URL and asserts the installed version, and the
workflow pins the release instead of resolving the newest tag. The pin cannot
move past 0.12.7 yet because 0.12.8 and later segfault under qemu-user x86_64
emulation, which is how an arm64 host builds the amd64 platform.

* chore(docker): bump the sandbox image digest to the 1.63 build

The guest image was rebuilt and republished for Playwright 1.63.0, uv 0.12.7
and pnpm 10.28.1. Moving the digest is what makes deployments adopt it:
attestation compares the reference string, so a rebuilt image behind the old
digest would never be pulled or recreated.

* build(sandbox): align toolchain pins and verify on native runners

* feat(sandbox): run Docker with persistent guest storage

* chore(docker): pin the Docker-enabled sandbox image
This commit is contained in:
Chris Scott authored and GitHub committed 2026-09-19 22:30:29 -04:00
1 parent 50da84541a
commit 65f5bd0e6a
19 files changed
+863 -112

No files matched your search

+38 -4
View File
@@ -14,6 +14,10 @@ import {
export const WORKSPACE_SANDBOX_NAME = 'ocm-workspace'
export const SANDBOX_DOCKER_DATA_VOLUME_NAME = 'ocm-workspace-docker-data'
export const SANDBOX_DOCKER_DATA_GUEST_PATH = '/var/lib/docker'
export const SANDBOX_DOCKER_DATA_SIZE = '20G'
export const SANDBOX_UNAVAILABLE_PREFIX = 'Sandbox enforcement is on but the sandbox is unavailable: '
const SANDBOX_PLAN_REQUEST_MARGIN_MS = 30000
@@ -171,7 +175,18 @@ export function quoteForShell(value: string): string {
return `'${value.replace(/'/g, `'\\''`)}'`
}
function buildSandboxDockerDataMountArg(): string {
return `${SANDBOX_DOCKER_DATA_VOLUME_NAME}:${SANDBOX_DOCKER_DATA_GUEST_PATH}:kind=disk,size=${SANDBOX_DOCKER_DATA_SIZE}`
}
function parseSandboxNamedMountSpec(spec: string): { name: string; guest: string } {
const [name = '', guest = ''] = spec.split(':')
return { name, guest }
}
export function buildSandboxCreateArgs(): string[] {
const tmpfsSizeMib = resolveSandboxRuntimeTmpfsSizeMib(parseMemoryMib(ENV.SANDBOX.MEMORY))
if (tmpfsSizeMib === null) throw new Error('sandbox memory must be positive to size the runtime tmpfs')
return [
'run',
'-d',
@@ -190,6 +205,10 @@ export function buildSandboxCreateArgs(): string[] {
'-u',
resolveSandboxExecUser(),
...sandboxMountRoots().flatMap((root) => ['--mount-dir', `${root}:${root}`]),
'--mount-named',
buildSandboxDockerDataMountArg(),
'--tmpfs',
`/tmp:${tmpfsSizeMib}M`,
'-w',
getReposPath(),
'--entrypoint',
@@ -353,6 +372,7 @@ function parseSandboxCreateArgs(args: string[]): {
cpus: number
user: string
mountDirs: string[]
namedMounts: Array<{ name: string; guest: string }>
workdir: string
entrypoint: string[]
shell: string
@@ -361,6 +381,7 @@ function parseSandboxCreateArgs(args: string[]): {
} {
const labels: Record<string, string> = {}
const mountDirs: string[] = []
const namedMounts: Array<{ name: string; guest: string }> = []
let name = ''
let memory = ''
let cpus = 0
@@ -390,8 +411,10 @@ function parseSandboxCreateArgs(args: string[]): {
case '-m': memory = value ?? ''; i += 1; break
case '-c': cpus = Number(value); i += 1; break
case '--net': i += 1; break
case '--tmpfs': i += 1; break
case '-u': user = value ?? ''; i += 1; break
case '--mount-dir': if (value !== undefined) mountDirs.push(value); i += 1; break
case '--mount-named': if (value !== undefined) namedMounts.push(parseSandboxNamedMountSpec(value)); i += 1; break
case '-w': workdir = value ?? ''; i += 1; break
case '--entrypoint': if (value !== undefined) entrypoint = [value]; i += 1; break
case '--shell': if (value !== undefined) shell = value; i += 1; break
@@ -400,7 +423,7 @@ function parseSandboxCreateArgs(args: string[]): {
if (image === '' && !token.startsWith('-')) image = token
}
}
return { name, labels, memory, cpus, user, mountDirs, workdir, entrypoint, shell, image, cmd }
return { name, labels, memory, cpus, user, mountDirs, namedMounts, workdir, entrypoint, shell, image, cmd }
}
export function buildCanonicalSandboxSpec(): Record<string, unknown> {
@@ -421,6 +444,15 @@ export function buildCanonicalSandboxSpec(): Record<string, unknown> {
quota_mib: null,
}
})
const namedMounts = args.namedMounts.map((mount) => ({
type: 'Named',
name: mount.name,
guest: mount.guest,
options: { readonly: false, noexec: false, nosuid: false, nodev: false },
stat_virtualization: 'strict',
host_permissions: 'private',
follow_root_symlinks: false,
}))
return {
name: args.name,
image: {
@@ -449,7 +481,7 @@ export function buildCanonicalSandboxSpec(): Record<string, unknown> {
env: [],
labels: args.labels,
rlimits: [],
mounts: bindMounts,
mounts: [...bindMounts, ...namedMounts],
patches: [],
network: { enabled: true, ports: [] },
init: null,
@@ -528,7 +560,9 @@ export function buildSandboxProvisionArgs(): string[] {
`echo 'ocm-exec:x:${uid}:${gid}:Manager sandbox exec user:/home/ocm-agent:/bin/sh' >> /etc/passwd; ` +
`grep -q '^ocm-exec:' /etc/shadow || echo 'ocm-exec:*:19000:0:99999:7:::' >> /etc/shadow; ` +
`}; ` +
`getent passwd ${uid} >/dev/null || exit 1`,
`getent passwd ${uid} >/dev/null || exit 1; ` +
`if getent group docker >/dev/null 2>&1; then ` +
`usermod -aG docker "$(getent passwd ${uid} | cut -d: -f1)" || exit 1; ` +
`fi`,
]
}
+53
View File
@@ -228,6 +228,7 @@ function emptyArrayMismatch(value: unknown, path: string): string | null {
type ParsedSandboxMount =
| { kind: 'bind'; host: string; guest: string; readonly: boolean }
| { kind: 'tmpfs'; guest: string; readonly: boolean }
| { kind: 'named'; name: string; guest: string; readonly: boolean }
| { kind: 'other' }
function parseInspectMount(mount: unknown): ParsedSandboxMount | null {
@@ -241,6 +242,10 @@ function parseInspectMount(mount: unknown): ParsedSandboxMount | null {
if (typeof mount.guest !== 'string') return null
return { kind: 'tmpfs', guest: mount.guest, readonly }
}
if (mount.type === 'Named') {
if (typeof mount.name !== 'string' || typeof mount.guest !== 'string') return null
return { kind: 'named', name: mount.name, guest: mount.guest, readonly }
}
return { kind: 'other' }
}
@@ -282,6 +287,7 @@ async function attestWorkspaceSandboxConfig(config: unknown): Promise<SandboxAtt
const canonicalMounts = Array.isArray(canonical.mounts) ? canonical.mounts : []
const expectedRoots = new Set<string>()
const expectedRealRoots = new Set<string>()
const expectedNamedMounts: Array<{ name: string; guest: string }> = []
for (const rawMount of canonicalMounts) {
const mount = parseInspectMount(rawMount)
if (mount?.kind === 'bind') {
@@ -292,6 +298,8 @@ async function attestWorkspaceSandboxConfig(config: unknown): Promise<SandboxAtt
} catch {
return { trusted: false, reason: `cannot resolve the canonical bind mount root ${resolvedRoot}` }
}
} else if (mount?.kind === 'named') {
expectedNamedMounts.push({ name: mount.name, guest: mount.guest })
}
}
@@ -304,6 +312,7 @@ async function attestWorkspaceSandboxConfig(config: unknown): Promise<SandboxAtt
const mounts = Array.isArray(spec.mounts) ? spec.mounts : []
const bindRoots = new Set<string>()
let runtimeTmpfsSeen = false
let dockerDataVolumeSeen = false
for (let mountIndex = 0; mountIndex < mounts.length; mountIndex++) {
const rawMount = mounts[mountIndex]
const mount = parseInspectMount(rawMount)
@@ -385,6 +394,47 @@ async function attestWorkspaceSandboxConfig(config: unknown): Promise<SandboxAtt
reason: `sandbox configuration mounts[${mountIndex}].size_mib does not match the canonical specification`,
}
}
} else if (mount.kind === 'named') {
if (dockerDataVolumeSeen) {
return { trusted: false, reason: `sandbox has a duplicate Docker data volume mount at ${mount.guest}` }
}
dockerDataVolumeSeen = true
const expectedNamedMount = expectedNamedMounts[0]
if (
mount.readonly ||
expectedNamedMount === undefined ||
expectedNamedMount.name !== mount.name ||
expectedNamedMount.guest !== mount.guest
) {
return { trusted: false, reason: 'sandbox has an unexpected named volume mount' }
}
const namedMountOptions = isRecord(rawMount) && isRecord(rawMount.options) ? rawMount.options : {}
for (const flag of ['readonly', 'noexec', 'nosuid', 'nodev'] as const) {
if (namedMountOptions[flag] !== false) {
return {
trusted: false,
reason: `sandbox configuration mounts[${mountIndex}].options.${flag} does not match the canonical specification`,
}
}
}
if (rawMount.stat_virtualization !== 'strict') {
return {
trusted: false,
reason: `sandbox configuration mounts[${mountIndex}].stat_virtualization does not match the canonical specification`,
}
}
if (rawMount.host_permissions !== 'private') {
return {
trusted: false,
reason: `sandbox configuration mounts[${mountIndex}].host_permissions does not match the canonical specification`,
}
}
if (rawMount.follow_root_symlinks !== false) {
return {
trusted: false,
reason: `sandbox configuration mounts[${mountIndex}].follow_root_symlinks does not match the canonical specification`,
}
}
} else {
return { trusted: false, reason: 'sandbox has an unexpected mount type' }
}
@@ -395,6 +445,9 @@ async function attestWorkspaceSandboxConfig(config: unknown): Promise<SandboxAtt
if (!runtimeTmpfsSeen) {
return { trusted: false, reason: `sandbox is missing the runtime tmpfs mount at ${SANDBOX_RUNTIME_TMPFS_GUEST}` }
}
if (!dockerDataVolumeSeen) {
return { trusted: false, reason: 'sandbox is missing the Docker data volume mount' }
}
const resources = isRecord(spec.resources) ? spec.resources : {}
if (resources.cpus !== canonicalResources.cpus) {