Documentation
¶
Overview ¶
Package codex implements adapters.HarnessAdapter for the Codex CLI.
Phase 3-c prototype: the goal is to validate that adapters.HarnessAdapter composes for a non-claude harness, not to reach feature parity with the claude adapter. Run() forks `codex exec` with signal forwarding and exit normalisation; session persistence, payload-patch application and boid task notify integration are deliberately left out (see docs/plans/agent-aware-boid.md Phase 3-c).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter implements adapters.HarnessAdapter for the Codex CLI.
func (*Adapter) Bindings ¶
Bindings declares the host bind-mounts codex.Adapter.Run() needs inside the sandbox.
Phase 4 PR3 (docs/plans/home-workspace-volume.md) retires every entry this method used to return: the rw ~/.codex state dir, the resolved `codex` binary's parent dir (PATH), the ro ~/.volta shim tree, and the per- embedded-skill ~/.local/share/boid/skills/<name> -> ~/.claude/skills/<name> binds. All of that state now lives directly in the sandbox's $HOME, which Runner.Dispatch (internal/dispatcher/workspace_home.go) bind-mounts from a persistent per-workspace home directory instead of a fresh tmpfs — so ~/.codex, ~/.volta etc. simply already exist at those paths without any adapter-declared bind. The codex CLI binary itself is expected to be installed into that same workspace home by the workspace's init.sh (see the plan doc's init.sh 契約 section); a missing binary now fails fast with an explicit message from Run() (run.go) instead of silently falling back to a bind that no longer exists.
Embedded skills DO reach the sandbox's $HOME, but by no mount at all, and the dispatcher owns that too. They are baked into the runner image (build/container/Dockerfile, internal/dispatcher's embeddedSkillsImageDir) and symlinked into each of skillDiscoveryRoots by the workspace-home init container's prelude. Two earlier mechanisms sat here: Phase 4 PR3 copied the content into the workspace home (skills.DeployAll straight into <home>/.claude/skills), which had to go once the home became a named volume the daemon cannot write to; PR3 of docs/plans/workspace-home-volume-persistence.md (論点 e-2) then replaced that with one read-only bind per skill, sourced from a host-visible directory the daemon re-materialized on every dispatch.
Keeping skill delivery dispatcher-side rather than restoring it here is what keeps this method nil: how skills reach a home is a property of how boid stages a sandbox, identical for every harness, not of what the codex CLI needs. Which directories a harness then SCANS is the harness's own business, and the three do not agree — see skillDiscoveryRoots for the table and why a link is written into more than one place.
The HarnessAdapter interface still requires this method; returning an empty slice keeps the contract satisfied for any future $HOME-independent bind a harness might need.
func (*Adapter) Run ¶
Run forks codex. Interactive vs non-interactive is keyed off rc.TaskID: session jobs (JobKindSession) carry no task and are user-initiated, so they land in interactive TUI mode; hook jobs carry a BOID_TASK_ID and fall through to non-interactive `codex exec`. This mirrors how the claude adapter discriminates JobKindSession from JobKindHook via rc.TaskID == "".
Other responsibilities mirror the claude / opencode adapters: signal forwarding via sigutil, exit code normalisation for daemon-initiated stops, PWD strip on the child env, and cmd.Dir as the source of truth for the workdir.
Session persistence and payload-patch application are deliberately NOT wired here — see docs/plans/multi-harness-production.md for the explicit non-goals (interactive sessions are run-and-done, no resume yet).