Preflight
preflight
¶
First-run readiness gate for terok-executor run.
Mandatory prerequisites (podman, sandbox services, container images) block the launch if unmet after interactive remediation; optional prerequisites (SSH key, per-agent credentials) print the consequence of skipping and let the launch proceed.
The check-and-fix surface lives on the Preflight
class: parameters that thread through every probe (provider, base
image, family, interactivity mode, --yes short-circuit) are held
once on the instance instead of being repeated in every free-function
signature. Callers construct Preflight(provider="claude").run()
in production; tests construct it with defaults and call individual
check_* methods.
CheckResult(name, ok, message)
dataclass
¶
Preflight(provider, base_image='ubuntu:24.04', family=None, interactive=True, assume_yes=False, credential_set='default', mounts_dir=None)
dataclass
¶
Holds the parameters that thread through every prerequisite check.
The orchestrator run
walks every gate / probe in order and reports a single
"mandatory-everything-passed" verdict. Individual probes
(check_podman
etc.) are exposed as methods so callers (doctor surfaces, tests)
can ask narrow questions without paying for the full sweep.
provider
instance-attribute
¶
base_image = 'ubuntu:24.04'
class-attribute
instance-attribute
¶
family = None
class-attribute
instance-attribute
¶
interactive = True
class-attribute
instance-attribute
¶
assume_yes = field(default=False)
class-attribute
instance-attribute
¶
credential_set = 'default'
class-attribute
instance-attribute
¶
Vault DB namespace to check for stored credentials. Pairs with
Authenticator.run's
credential_set — a project running with per-project credentials
passes its own value so the preflight verdict reflects what the
runtime will actually load, not the shared host-wide bucket.
mounts_dir = None
class-attribute
instance-attribute
¶
Override for the agent-config mount tree. None means use the
global paths.mounts_dir. Callers
that pair a non-"default" credential_set with a per-project
mount tree (terok in scope=project mode) must override this too —
otherwise the captured OAuth credential's post-capture writer drops
the phantom marker into the wrong tree and the runtime never sees it.
run()
¶
Run every prerequisite check and return True iff mandatory items pass.
In non-interactive mode, missing mandatory prerequisites are
reported once and the return is False; in interactive mode
each one is offered up as a y/N fix before counting against
readiness. Optional items never turn the return into False —
their consequence is printed and the launch proceeds.
Source code in src/terok_executor/preflight.py
check_podman()
¶
Verify that podman is installed and responds to podman version.
Source code in src/terok_executor/preflight.py
check_git()
¶
Report whether git is available on the host PATH.
Informational only: terok-sandbox's git gate uses the host git
binary to mirror upstream repositories, but a container without a
gate is functionally identical from a security perspective — the
gate exists to provide a push channel, not to enforce isolation.
A missing git therefore degrades the workflow (no in-container
git push) but never blocks a launch.
Source code in src/terok_executor/preflight.py
check_sandbox_services()
¶
Verify the shield OCI hooks are installed.
The vault and git gate are not host services: the per-container
supervisor (spawned by the terok-sandbox OCI hook) embeds the
vault proxy and serves the git gate in-process, both starting
on demand. The only host-side service that must exist before a
launch is therefore the shield OCI hooks; the git binary that
drives gate mirrors is surfaced separately by
check_git.
Source code in src/terok_executor/preflight.py
check_images()
¶
Check whether L0+L1 container images exist.
Source code in src/terok_executor/preflight.py
check_credentials()
¶
Check whether credentials are stored for the configured provider.
Source code in src/terok_executor/preflight.py
check_ssh_key(scope='standalone')
¶
Check whether a gate-signing SSH key exists for scope.
Source code in src/terok_executor/preflight.py
check_shield()
¶
Check whether shield OCI hooks are installed (informational).