runner

package
v0.3.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package runner is the container-backend sandbox runner entry point (`boid runner-container`, runner_container_linux.go's RunContainer). PR-4 (docs/plans/volume-only-daemon.md, the 2026-07 volume-only cutover) removed the former userns backend entirely — runner-outer/pasta/runner-inner/ runner-inner-child, the clone(CLONE_NEWUSER|CLONE_NEWNS)/pivot_root path in the now-deleted runner_linux.go, and the mount-guard evaluator that path used — leaving the container backend as the sole sandbox backend. See docs/{ja,en}/architecture/sandbox-internals.md for the current launch chain.

This file holds the portable helpers RunContainer and its predecessor shared (spec decoding, signal mapping, the post-namespace-setup file/ symlink/PATH/job-done steps) so they can be unit-tested independent of any syscall or container-runtime path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunContainer added in v0.1.0

func RunContainer(specPath, statePath string) (exitCode int, retErr error)

RunContainer is the `boid runner-container` entry point (docs/plans/phase6-container-backend.md §PR2 / §決定 2/3). It is the container-backend counterpart to RunInnerChild (runner_linux.go): both run the same post-namespace-setup sequence (write spec.Files, materialize spec.Symlinks, run the sandbox-internal clone if declared, resolve PATH, dispatch to the harness adapter, report job-done) via the shared helpers in runner.go. What RunContainer does *not* do, by design, is everything userns-specific that RunOuter/RunInner/RunInnerChild otherwise chain through:

  • No pasta relay (RunOuter/RunInner) — the container runtime supplies its own network namespace and egress policy (compose network / egress proxy, decision 5); there is no inner pasta hop to launch.
  • No clone(CLONE_NEWUSER|CLONE_NEWNS) / mount syscalls / pivot_root (setupMountNamespace/pivotInto) — the container runtime already provides the process/mount namespace isolation and the image's own rootfs *is* the sandbox root the moment this process starts (決定 2: "container entrypoint は clone/pivot_root を skip … namespace 隔離は container が提供").
  • No self-authored signal-forwarding loop or PID 1 reap loop. Decision 3 pins `HostConfig.Init: true` (docker-init/tini) as PID 1: it owns zombie reap and SIGUSR1 delivery to this process, and the harness adapters' own sigutil.ForwardAndWait (internal/adapters/sigutil) already translates a received SIGUSR1 into the agent's graceful SIGTERM — exactly the same as it does today when this same code runs as the userns runner's L3 child. Nothing new to write here.

RunContainer is the entry point of EVERY sandboxed job. It was inert when written (Phase 6 PR2 added it ahead of the backend that invokes it), which stopped being true in PR5 of that plan and is doubly untrue now: the image's own ENTRYPOINT is ["/usr/local/bin/boid","runner-container"] (build/container/Dockerfile), the container backend is boid's only backend since PR-4 of docs/plans/volume-only-daemon.md removed the userns one, and the `sandbox.backend` config option it was once gated behind no longer exists. Anything added here runs on every dispatch.

Types

type State

type State struct {
	// contains filtered or unexported fields
}

State appends NDJSON diagnostic records to /tmp/boid-<id>-runner-state.json. Each write is a single appended line followed by Sync(), so a panic / kill -9 still leaves the last reached phase flushed on disk. Every method is nil-safe.

func OpenState

func OpenState(path string) *State

OpenState opens (creating) the state file for append. A nil *State (returned when path is empty or open fails) makes all subsequent methods no-ops so the diagnostic path never blocks the run.

func (*State) Close

func (s *State) Close()

Close closes the underlying file.

func (*State) Fail

func (s *State) Fail(stage, phase string, err error)

Fail records a failed phase with an error detail.

func (*State) OK

func (s *State) OK(stage, phase string)

OK records a successful phase.

func (*State) Phase

func (s *State) Phase(stage, phase, status, detail string)

Phase records a single phase transition with ok/error status.

func (*State) Spec

func (s *State) Spec(stage string, spec sandbox.Spec)

Spec records the launch-time spec dump (first line of the file).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL