runner

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package runner is the go-native sandbox runner. It replaces the former bash trio (outer.sh / setup.sh / inner.sh): runner-outer launches pasta, which runs runner-inner (in pasta's user+net namespace), which clones runner-inner-child (CLONE_NEWUSER|CLONE_NEWNS) to lay out the mount namespace, pivot_root, and exec the agent.

The syscall-heavy work lives in runner_linux.go; this file holds the portable helpers (spec decoding, pasta argv, signal mapping, guard evaluation) so they can be unit-tested off the syscall path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunInner

func RunInner(specPath, statePath string) (int, error)

RunInner is the `boid runner-inner` entry point. It runs inside pasta's user+net namespace (inner uid 0). It applies the nft egress rules, then clones runner-inner-child into a fresh user+mount namespace. Mirrors the former setup.sh's nft + `unshare --user … --root` hand-off.

func RunInnerChild

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

RunInnerChild is the `boid runner-inner-child` entry point (L3). It runs in the cloned user+mount namespace, lays out the sandbox root via bind mounts, pivot_root's into it, writes spec.Files (DNS stub, the $HOME/.boid/output sentinel — task-context data is pulled on demand over the broker RPCs since the Phase 5b PR6 cutover, not written to disk here any more), runs the agent, and posts the broker job-done. Mirrors the former inner.sh.

func RunOuter

func RunOuter(specPath, statePath string) (int, error)

RunOuter is the `boid runner-outer` entry point. It runs on the host as the daemon's direct child and manages the pasta lifecycle: it launches `pasta … -- boid runner-inner`, captures pasta's own stderr to a temp file (dumped only on failure), then performs host-side cleanup of the sandbox ROOT and staging dirs after pasta returns. Mirrors the former outer.sh.

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, pastaCmdline []string)

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