diff --git a/docs/architecture.md b/docs/architecture.md index 50a2940d90..6be75f9696 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -323,7 +323,7 @@ flowchart TB without overlays, and `FULLSEND_FALLBACK_MODELS` applies as each runtime allows. Decided, not yet implemented. - Plugins are runtime-scoped harness resources: a harness declares `plugins:` as one list of directories in its own repository (same trust and fetch path as skills), and each entry's format decides which runtime loads it — a `plugin.json` bundle is Claude Code's, a directory pi's `-e` loader resolves is uploaded and loaded after a tree-hash preflight computed from the host copy. Each runtime names and skips the entries in the other format, so the list survives a runtime switch. Because `--no-extensions` plus explicit `-e` closes the set of code that can register tools, no per-tool declaration is needed ([ADR 0094](ADRs/0094-pi-extensions-are-harness-resources.md)). -- Native Codex children run under a runner-owned policy: Bootstrap registers roles for an agent with the `Agent` tool, under harness security, whose parent model Codex resolves to collaboration V1 (a V2 or unlisted parent keeps the multi-agent tools off), and binds each child's model (a persona's own entry in its role file, the run-level default otherwise), and a mandatory dispatch hook admits only fresh-context V1 spawns of registered roles after checking `hooks.json` and the role files against runner-held digests ([ADR 0126](ADRs/0126-fullsend-owned-codex-subagents.md)); not yet implemented, so review and retro still run in one context on Codex ([#6970](https://github.com/fullsend-ai/fullsend/issues/6970)). +- Native Codex children run under a runner-owned policy: Bootstrap registers roles for an agent with the `Agent` tool, under harness security, whose parent model Codex resolves to collaboration V1 on the direct route (a V2, unlisted or `gateway/` parent keeps the multi-agent tools off), and binds each child's model (a persona's own entry in its role file, the run-level default otherwise) and the run's effort, and a mandatory dispatch hook admits only fresh-context V1 spawns of registered roles after checking `hooks.json` and the role files against runner-held digests; after each iteration the runner checks the spawns seen in the stream or in the children's rollouts on disk, each child once, against the hook's admissions ([ADR 0126](ADRs/0126-fullsend-owned-codex-subagents.md), [#6970](https://github.com/fullsend-ai/fullsend/issues/6970)). ### Behaviour testing diff --git a/docs/cli/agent.md b/docs/cli/agent.md index e1647dfe61..1ff12c1345 100644 --- a/docs/cli/agent.md +++ b/docs/cli/agent.md @@ -432,11 +432,12 @@ fullsend agent set review --subagent correctness=opus --subagent default=haiku | `--runtime` | Agent runtime for this agent (`claude`, `pi`, `codex` or `opencode`) | | `--model` | Model for this agent — an alias, a model id, or `provider/id` on pi, codex, and opencode (codex takes OpenAI ids and `gateway/` only) | | `--effort` | Effort level for this agent (`low`, `medium`, `high`, `xhigh`, `max`) | -| `--subagent` | Per-persona model override as `key=value` (repeatable). Key is a persona name or `default`; value is a model reference. Pass an empty value (`--subagent key=`) to clear an inherited entry — that writes `key: ~` in the config, after which the persona resolves the way an unmentioned one does (its frontmatter model, then `subagents.default`). On pi, a value that resolves to `openai/` prints a warning when the agent's local harness declares no `openai` provider; see [pi § Route a persona to OpenAI](../runtimes/pi.md#route-a-persona-to-openai) | +| `--subagent` | Per-persona model override as `key=value` (repeatable). Key is a persona name or `default`; value is a model reference (on codex, an OpenAI id the pinned CLI's catalog lists). Pass an empty value (`--subagent key=`) to clear an inherited entry — that writes `key: ~` in the config, after which the persona resolves the way an unmentioned one does (on pi, its frontmatter model, then `subagents.default`; on codex, the run-level child model, see [Codex § Child models](../runtimes/codex.md#child-models)). On pi, a value that resolves to `openai/` prints a warning when the agent's local harness declares no `openai` provider; see [pi § Route a persona to OpenAI](../runtimes/pi.md#route-a-persona-to-openai) | See [Runtimes — per-agent settings](../runtimes.md#per-agent-runtime-model-and-effort) for precedence. -See [pi § Per-persona model configuration](../runtimes/pi.md#per-persona-model-configuration) for -how `subagents` map to persona dispatch. +See [pi § Per-persona model configuration](../runtimes/pi.md#per-persona-model-configuration) and +[Codex § Child models](../runtimes/codex.md#child-models) for how `subagents` map to persona +dispatch on each runtime. ## `agent remove` diff --git a/docs/cli/run.md b/docs/cli/run.md index 862c933183..91edfadd4d 100644 --- a/docs/cli/run.md +++ b/docs/cli/run.md @@ -91,6 +91,9 @@ subagents: correctness → anthropic-vertex/claude-opus-4-6 (from frontmatter) subagents: docs-currency → google-vertex/gemini-3.8-flash (from subagents.docs-currency) ``` +On codex a delegating agent prints the run-level default and one line per persona with its own +`subagents` entry; see [Codex › Child models](../runtimes/codex.md#child-models). + A malformed `subagents` key or model reference is rejected by config validation, before the sandbox is created, like the other invalid overrides above. A key that names no discovered persona, or a model this run cannot serve, is caught slightly later — at Bootstrap, once the @@ -173,7 +176,8 @@ differences in the last bullet. sub-agent, which is what keeps the invariant true across a retry. - **What stays parent-only.** `num_turns` and `tool_calls` are read from the parent's stream and are not broken down or added to per model — a child's turns and tool calls are recorded in its own - session transcript (`transcripts/-sub-*.jsonl`) instead. + session transcript (`transcripts/-sub-*.jsonl`; on codex + `transcripts/-sub-.jsonl`, see [Codex › At a glance](../runtimes/codex.md#at-a-glance)) instead. - A model spec of `unknown` is a pi usage record, or a codex child rollout, that carries no model at all; its usage is bucketed there rather than dropped. A dispatch rejected *before* a model was resolved writes no record, so it never reaches the breakdown. diff --git a/docs/contributing/runtime-implementation.md b/docs/contributing/runtime-implementation.md index 38023cfb1c..1224e8b6c8 100644 --- a/docs/contributing/runtime-implementation.md +++ b/docs/contributing/runtime-implementation.md @@ -203,7 +203,7 @@ Harness `security.fail_mode` controls whether critical findings **block** the ru | Interface | Responsibility | |-----------|----------------| | `runtime.Runtime` | Name, config dir, env exports, bootstrap, run loop, per-iteration cleanup, user processes cleanup | -| `runtime.BootstrapInput` | Portable agent name/path, skill dirs, declared plugins (`Plugins() []PluginInput` — name, host path, format kind, env, pi args; ADR 0094) to upload, and the per-repo model alias overrides (`ModelAliases() map[string]string`, from `models.aliases`; nil when the repo sets none). A runtime loads the entries whose `Kind` it reads and must warn and skip the rest, never drop them silently, and the agent's per-persona sub-agent model map (`AgentSubagents() map[string]*string`, from `agents[].subagents`; a nil value is a tombstone; ADR 0104), the parent's resolved model (`ParentModel() string`), and whether the run-scoped OpenAI provider was attached (`OpenAIProviderAttached() bool`). pi admits a configured child's `openai/` model only when that is true, because `OPENAI_API_KEY` is in the sandbox only then (#7981) | +| `runtime.BootstrapInput` | Sandbox name, portable agent name/path, skill dirs, declared plugins (`Plugins() []PluginInput` — name, host path, format kind, env, pi args; ADR 0094) to upload, and the per-repo model alias overrides (`ModelAliases() map[string]string`, from `models.aliases`; nil when the repo sets none). A runtime loads the entries whose `Kind` it reads and must warn and skip the rest, never drop them silently, and the agent's per-persona sub-agent model map (`AgentSubagents() map[string]*string`, from `agents[].subagents`; a nil value is a tombstone; ADR 0104), the parent's resolved model (`ParentModel() string`), the run's resolved effort (`Effort() string`: the harness effort after the `agents:` entry and `--effort`, or `""` when none is set; when set, codex binds it as every native child's effort and checks it against each child model's supported levels), and whether the run-scoped OpenAI provider was attached (`OpenAIProviderAttached() bool`). pi admits a configured child's `openai/` model only when that is true, because `OPENAI_API_KEY` is in the sandbox only then (#7981) | | `runtime.SandboxHooksBootstrap` | Optional `BootstrapInput` extension — runtime-neutral sandbox tool hook config (`security.SandboxHookConfig`); every runtime should honour it | | `runtime.TranscriptHandler` | Extract transcripts/debug logs; parse errors for CI annotations | | `runtime.DebugLogNamer` | Optional — names the per-iteration debug-log artifact (default `agent-debug.log`) | @@ -1166,7 +1166,7 @@ flowchart TB 0.159.3) its `.codex/skills` even with the project untrusted; both are covered by the host-side and in-sandbox context scans, which match `SKILL.md` anywhere in the repo. The agent reads those files through the shell, and Codex 0.157.0 truncates a single exec at 10,000 tokens (head and - tail), so `codexNoSubagentNote` tells it to count lines with `awk 'END { print NR }'` (`wc -l` + tail), so both runtime notes (`codexChunkedReadNote`) tell it to count lines with `awk 'END { print NR }'` (`wc -l` misses a last line with no trailing newline) then `sed -n` a long `SKILL.md` in at most 200-line ranges, one per tool call (#7831). A native child runs with its role's `developer_instructions` in place of the parent's, so every role file opens with @@ -1267,7 +1267,7 @@ Matcher translation, per group: |---|---|---| | `Bash` | `Bash` | codex's shell tool has the same name | | `Write`, `Edit`, `MultiEdit` | `apply_patch` | the canonical name; `Write`/`Edit` would also match as aliases | -| `Agent`, `Task` | `spawn_agent` | not reachable in v1 — no sub-agent roster is wired | +| `Agent`, `Task` | `spawn_agent` | reached by a delegating agent's spawns (ADR 0126); the spawn guard is the last row | | `Read`, `Glob`, `Grep`, `LS`, `WebFetch`, `WebSearch` | *dropped, with a note* | no codex tool; the `Bash` groups cover this work | | `*` (`security.AllTools`) | *matcher key omitted* | an absent matcher matches every tool | | `PostToolUseFailure` (any tools) | *not wired* | codex has no such event and does not need one — see below | @@ -1367,22 +1367,37 @@ file when a child starts, so Run exports their digests as `FULLSEND_CODEX_SPAWN_ handler re-hashes them, and lists `agents/`, before applying the policy, on its own deadline below the hook timeout at which codex kills a handler and lets the call through. No role, no spawn. -A handler codex kills at that timeout still lets the call through, so after each iteration the -runner cross-checks the stream's completed `spawn_agent` items, read on the host, against the -guard's `codex_spawn_guard_admit` lines in `/sandbox/workspace/.security/findings.jsonl` and fails -the run (`codex_spawn_without_admission`) on a shortfall, a spawn not sent by the primary thread, -a spawn item too long to read, or a failed read. The count spans the run's iterations, so -`ClearIterationArtifacts` must leave `.security/` in place (it clears `output/`, the sessions -directory and the debug log, nothing else under the workspace). Codex can drop a stream -notification under backpressure and says so on stderr: the launch sets `RUST_LOG` outright after -`.env` (codex's default filter with `codex_exec` and `codex_app_server::in_process` at warn; codex's -commands inherit it), the runner scans that stderr on the host (the sandbox log under `--debug`) -and warns on the line, and on exec's warning that its `thread/read` backfill of the turn's items -failed. The check cannot catch a forged admission (the log is agent-writable), a surplus admission -covering a later spawn (counts, not ids), a resume (a `wait` item in the stream), or a spawn both -of whose notifications codex dropped, or whose dropped completed item the backfill did not bring -back (it runs only for a completed turn on a non-ephemeral thread, and only when `thread/read` -succeeds). +A handler codex kills at that timeout still lets the call through, so after each iteration of a +delegating agent (and any iteration whose stream shows a spawn) the runner counts the iteration's +spawns from two sources, each child once by thread id, and cross-checks the run's total against the +guard's `codex_spawn_guard_admit` lines in `/sandbox/workspace/.security/findings.jsonl`: the +stream's `spawn_agent` items, read on the host, completed or failed (a blocked spawn returns before +the handler and emits none, `core/src/tools/registry.rs`; a spawn refused at the thread limit fails +at `reserve_spawn_slot` after the guard admitted it and names no child), counted by their receiver +ids plus the items that name none; and the rollouts under the sessions directory whose +`session_meta` parent is the primary thread or a counted child, plus any file whose first line is +empty, cut before it names a parent, or not a `session_meta` record, under the thread id in its +name, the run's own excepted; such a file is a parent only when the stream names it. A child writes +its rollout at its first recorded item, so a spawn the stream lost is still counted; a previous +iteration's files and a root the agent's own `codex exec` writes under `CODEX_HOME` are not, unless +their first line is empty, cut or 1 MiB or longer. The run fails (`codex_spawn_without_admission`) +on a shortfall, a spawn not sent by the primary thread, a spawn item too long to read, an unknown +primary thread id with a child-shaped rollout present, or a failed read of either side. The count +spans the run's iterations, so `ClearIterationArtifacts` must leave `.security/` in place (it +clears `output/`, the sessions directory and the debug log, nothing else under the workspace). The +usage fold reads the union of the stream's children and the children on disk. Codex can drop a +stream notification under backpressure, of any thread, and says so on stderr: the launch sets +`RUST_LOG` outright after `.env` (codex's default filter with `codex_exec` and +`codex_app_server::in_process` at warn; codex's commands inherit it), and the runner scans that +stderr on the host (the sandbox log under `--debug`) and warns on the line and on exec's warning +that its `thread/read` backfill of the turn's items failed. Drops stay warnings, as #8712 settled: +most drops hide no spawn. The check cannot catch a forged admission (the log is agent-writable), a +resume (a `wait` item in the stream), a spawn hidden from both sides (stream items lost and the +rollout, or an ancestor's, deleted, renamed or its `session_meta` edited), a child that never +recorded an item, or a surplus admission covering a later spawn (counts, not ids): codex can reject +an admitted call before it emits an item (`parse_collab_input` on a spawn with no message, or +`prepare_agent_spawn_config` after `item.started`), and another PreToolUse hook running beside the +guard can block a call the guard admitted. **PATH is pinned across `.env` for the same reason the interpreter is.** The hook scripts resolve their tools by name — `tirith_check.py` runs a bare `tirith` — so a `.env` that prepends a directory @@ -1527,11 +1542,8 @@ Two artefacts of the run are worth knowing about: and local smoke runs. - The rollout session files are archived as transcripts but not error-classified: only the tee'd `exec --json` capture yields a verdict, which is what the runner's exit-code override reads. -- Sub-agent roles are generated (`agents/.toml`, digest-guarded) for an agent with the `Agent` - tool under harness security whose parent model Codex resolves to collaboration V1 (ADR 0126), but - codex's multi-agent tools stay off (`[agents] enabled = false`), so `review`/`retro` are unsupported; - `Bootstrap` appends a runtime note telling the agent to execute sub-agent definitions itself, in - order, as it does for pi. +- Native sub-agents (ADR 0126) have not completed a fleet-shaped run; `review`/`retro` stay on + Claude Code in the docs until one does. ### Re-check on a `CODEX_VERSION` bump @@ -1553,4 +1565,6 @@ Two artefacts of the run are worth knowing about: | Project trust and `AGENTS.md` | the pinned untrusted entry must still stop codex recording its own trust level, the repo's `.codex/` layer must stay unloaded, and `$CODEX_HOME/AGENTS.md` must still load while the project is untrusted, or the bridge stops reaching the agent | `codex-rs/app-server/src/request_processors/thread_processor.rs` (trust write), `codex-rs/config/src/loader/mod.rs`, `codex-rs/core/src/agents_md.rs`, `codex-rs/codex-home/src/instructions/mod.rs` | | JSONL event structs, rollout line types and rollout file naming | the stream parser and transcript extraction; a rollout line type missing from `codexRolloutEnvelopes` discards the whole transcript | `codex-rs/exec/src/exec_events.rs`, `codex-rs/history/src/rollout_payload.rs` (`RolloutItemWire`), `codex-rs/thread-store/src/local/helpers.rs` | | The multi-agent tool names (`multi_agent_v1*`, `collaboration*`, the bare V1 `spawn_agent`), the block contract (exit 2 with non-empty stderr blocks; a timeout kills the handler and lets the call through), `agent_id` and `agent_type` in a child's payload, the spawn arguments, and what a child start rereads (`hooks.json` and the role file) | the spawn guard's matcher, pass-through set, policy, digest set and deadline rest on them; a renamed tool is denied (loud), but a payload without `agent_id`, a new model or effort argument, a changed block contract or a child that rereads another file turns a deny into a pass | `codex-rs/core/src/tools/handlers/multi_agents_spec.rs`, `codex-rs/core/src/tools/registry.rs` (`function_hook_tool_name`), `codex-rs/hooks/src/engine/command_runner.rs` (the timeout branch), `codex-rs/core/src/agent/role.rs` (the role file, read at spawn) | -| The bundled catalog's `multi_agent_version` entries, the version codex supplies to an entry that carries none, and the floor model (`codex debug models --bundled`; at 0.159.3 `gpt-5.6-luna` is the listed model that selects `v1`, and `gpt-5.5` carries no version, which the `multi_agent` feature, on by default, resolves to V1) | part two of the delegation gate and the child-model floor rest on them: a bump that moves the floor to V2, or drops it, turns native sub-agents off for every agent; a bump that turns `multi_agent` off by default, or gives the null entry a version, changes which parents delegate; and the fixture `internal/runtime/testdata/codex/models-bundled-0.159.3.json` must be regenerated, never edited | `codex-rs/models-manager/models.json` in the bumped tag; regenerate the fixture with the one-liner in `codex_personas_test.go`'s `TestCodexCatalog` comment and run `go test ./internal/runtime/ -run 'TestCodexCatalog\|TestCodexParentResolvesV1'` | +| The bundled catalog's `multi_agent_version`, `default_reasoning_level` and `supported_reasoning_levels` entries, the version codex supplies to an entry that carries none, and the floor model (`codex debug models --bundled`; at 0.159.3 `gpt-5.6-luna` is the listed model that selects `v1` and defaults to `medium`, and `gpt-5.5` carries no version, which the `multi_agent` feature, on by default, resolves to V1, and lists `low` to `xhigh`) | part two of the delegation gate, the child-model floor and the child-effort check rest on them: the floor must stay listed, or every delegating agent without `subagents.default` or `FULLSEND_CODEX_SUBAGENT_MODEL` fails Bootstrap, while the floor's own collaboration version does not matter for children (a child runs under its parent's; moving luna to V2 only stops luna parents from delegating); a bump that turns `multi_agent` off by default, or gives the null entry a version, changes which parents delegate; a changed level set changes which run efforts Bootstrap accepts; and the fixture `internal/runtime/testdata/codex/models-bundled-0.159.3.json` must be regenerated, never edited | `codex-rs/models-manager/models.json` in the bumped tag; regenerate the fixture with the one-liner in `codex_personas_test.go`'s `TestCodexCatalog` comment and run `go test ./internal/runtime/ -run 'TestCodexCatalog\|TestCodexParentResolvesV1\|TestResolveCodexChildModels_Effort'` | +| The `[agents]` keys codex reads (`enabled`, `max_concurrent_threads_per_session`, `max_depth`, `default_subagent_model`, `default_subagent_reasoning_effort`, and `[agents.]` `description` and `config_file`) and the order of the child path: with no model argument a child takes `default_subagent_model` and, with no effort argument, `default_subagent_reasoning_effort`, else that model's catalog default; a role file applies after and its effort is checked against its own model | `codexAgentsBlock` writes the keys and Bootstrap checks the child efforts on that order; a renamed key or a changed order silently changes every child's model or effort | `codex-rs/config/src/config_toml.rs` (`AgentsToml`), `codex-rs/core/src/config/mod.rs`, `codex-rs/core/src/agent/child_config.rs` (`apply_requested_spawn_agent_model_overrides`, `apply_spawn_agent_role`), `codex-rs/core/src/agent/role.rs` | +| What writes a rollout under the sessions directory in an exec run, rollout naming and the date layout, creation at a child's first recorded item, a PreToolUse block returning before the tool handler, and spawn-slot reservation before thread creation | the disk side of the admission cross-check (the four facts are in `internal/runtime/testdata/codex/README.md`) | `codex-rs/core/src/tools/registry.rs`, `codex-rs/core/src/agent/control/spawn.rs`, `codex-rs/rollout/src/rollout_file_name.rs`, `codex-rs/features/src/lib.rs` (the memories default) | diff --git a/docs/guides/getting-started/choosing-a-runtime.md b/docs/guides/getting-started/choosing-a-runtime.md index cfdd4831f5..8b1a94c3a9 100644 --- a/docs/guides/getting-started/choosing-a-runtime.md +++ b/docs/guides/getting-started/choosing-a-runtime.md @@ -4,7 +4,7 @@ sidebar_label: Choose a Runtime # Choose an agent runtime -> **Claude Code is the stable default.** The fleet agents have run on Claude Code in production for a long time; it is what a new installation gets unless you ask for something else. **pi and codex are experimental** — pi works end to end for `triage`, `prioritize`, `code`, `fix` and `review`/`retro`; codex runs OpenAI models through the same secretless credential path but has no sub-agent roster yet, so `review`/`retro` are best left on Claude Code there. Neither runtime has completed a fleet pilot. Unless you are taking part in one, keep the default. +> **Claude Code is the stable default.** The fleet agents have run on Claude Code in production for a long time; it is what a new installation gets unless you ask for something else. **pi and codex are experimental** — pi works end to end for `triage`, `prioritize`, `code`, `fix` and `review`/`retro`; codex runs OpenAI models through the same secretless credential path; `review`/`retro` are best left on Claude Code there. Neither runtime has completed a fleet pilot. Unless you are taking part in one, keep the default. This page explains what the choice means and where it is made. **You do not select anything on this page** — the selection happens in the next step. On GitHub, [Configuring GitHub](configuring-github.md) asks when you run `fullsend github setup` (press Enter for `claude`) or you pass `--runtime`. On GitLab, set `runtime:` in `defaults.config`, `gitlab.config`, or the repository entry's `config` in `repos.yaml` before running `fullsend repos install` (there is no install flag) — see [Configuring GitLab](configuring-gitlab.md). @@ -16,7 +16,7 @@ Fullsend supports multiple agent runtimes. A runtime is the program that runs in |---------|--------|-------------|-------------| | `claude` | **Stable (default)** | Claude Code on Vertex AI | Every production deployment — mature, full sub-agent support for `review`/`retro` | | `pi` | Experimental (enablement phase) | [Pi](https://github.com/earendil-works/pi) — Claude on Vertex by default; any provider pi supports by model name (e.g. Gemini on Vertex with the same credentials) | Opt-in pilots only; see [Runtimes](../../runtimes.md) for known constraints | -| `codex` | Experimental | [Codex](https://github.com/openai/codex) — OpenAI models through the same secretless credential path, or any Responses-capable model through an inference gateway (`gateway/`) | Opt-in pilots only, when you want GPT specifically. No sub-agent roster, so keeping `review`/`retro` on Claude Code is recommended; needs an OpenAI or `gateway/` model named (`FULLSEND_CODEX_MODEL`) because the fleet harnesses ask for `opus`; see [Codex](../../runtimes/codex.md) | +| `codex` | Experimental | [Codex](https://github.com/openai/codex) — OpenAI models through the same secretless credential path, or any Responses-capable model through an inference gateway (`gateway/`) | Opt-in pilots only, when you want GPT specifically. Sub-agents run as [native Codex children](../../runtimes/codex.md#sub-agents), not yet verified fleet-wide, so keeping `review`/`retro` on Claude Code is recommended; needs an OpenAI or `gateway/` model named (`FULLSEND_CODEX_MODEL`) because the fleet harnesses ask for `opus`; see [Codex](../../runtimes/codex.md) | | `opencode` | Experimental | [OpenCode](https://opencode.ai/) — reads `AGENTS.md` natively | Opt-in read-only agents (`triage`, `prioritize`) until the security-hook adapter lands; see [OpenCode](../../runtimes/opencode.md) | ## When and how the runtime is selected diff --git a/docs/reference/config-reference.md b/docs/reference/config-reference.md index 859874e106..14d35bf1ea 100644 --- a/docs/reference/config-reference.md +++ b/docs/reference/config-reference.md @@ -47,7 +47,7 @@ agents: # Registered agent sources and per-agent tu runtime: claude # Per-agent runtime override model: opus # Per-agent model override (model id or provider/id) effort: high # Per-agent reasoning effort: low, medium, high, xhigh, max - subagents: # Per-agent sub-agent model map + subagents: # Per-agent sub-agent model map (pi and codex) default: sonnet # Fallback model for personas without an explicit entry code-reviewer: opus # Model for a specific persona # trigger: # When the built-in review agent runs (review entry only) @@ -205,7 +205,10 @@ effort, sub-agent models and the trigger. - **`subagents`** — Map of persona names to model references. The `default` key sets the fallback for personas without an explicit entry. A `~` (null) value tombstones an inherited entry. Keys must be lowercase alphanumeric - segments joined by hyphens (max 64 chars). + segments joined by hyphens (max 64 chars). On codex, for an agent that + delegates, the values must be OpenAI ids and a key must name a registered + persona or `default`; see + [Codex › Child models](../runtimes/codex.md#child-models). - **`trigger`** — A [CEL trigger](../guides/user/cel-triggers-reference.md) (a boolean over the normalized `event`). It decides routing for the built-in review, retro, triage and prioritize agents only: on one of those diff --git a/docs/runtimes.md b/docs/runtimes.md index b06b4c0f49..5236117037 100644 --- a/docs/runtimes.md +++ b/docs/runtimes.md @@ -55,10 +55,10 @@ sequenceDiagram | | Claude Code | pi | codex | |---|---|---|---| | Models | Anthropic on Vertex; any Messages-capable model through an [inference gateway](runtimes/claude.md#inference-gateway-route) (`gateway/`) | Claude, **Grok** and **Gemini** on Vertex; **GPT** via OpenAI WIF (opt-in, [not yet exercised live](runtimes/pi.md#models-and-providers)) | **GPT**, via OpenAI WIF ([not yet exercised live](runtimes/codex.md#not-yet-exercised)); any Responses-capable model through an [inference gateway](runtimes/codex.md#models-through-an-inference-gateway-experimental) (`gateway/`, experimental) | -| Sub-agents | Native (`Agent` tool) | `Agent`/`Task` via a fullsend extension | Not available | +| Sub-agents | Native (`Agent` tool) | `Agent`/`Task` via a fullsend extension | Native Codex children under a runner-owned policy, for an agent whose tools include `Agent` (or that declares no `tools:`), with harness security on, on a parent model Codex resolves to collaboration V1 on the direct route ([Sub-agents](runtimes/codex.md#sub-agents)) | | Default alias models | `opus`/`sonnet`/`haiku` → `claude-*-5-5`, passed as the id; `fable` by Claude Code's own table; sub-agent frontmatter resolved by Claude Code | `opus`/`sonnet`/`haiku` → `claude-*-5-5`, `fable` → `claude-fable-5-1`, children included | Not applicable — OpenAI models only | | Fallback model chain | Alias requests retried by the runner when Vertex does not serve the model (Claude Code's own "model not available" result naming the model, or Vertex's [two 404/403 messages](runtimes/claude.md#models)): `FULLSEND_FALLBACK_MODELS`, else the alias's built-in chain (`opus` → `claude-opus-4-6`, `sonnet` → `claude-sonnet-4-6`, `haiku` → `claude-haiku-4-5`); only an explicit `FULLSEND_FALLBACK_MODELS` is also passed as `--fallback-model`, never the built-in chain; pinned ids, retargets and sub-agents fail loudly | The same chain, same provider only; sub-agent children asking for an alias use its built-in chain; pinned ids and retargets fail loudly | Ignored with a warning | -| Roles | All | All; `review`/`retro` at `--thinking medium` by default | Same recommendation as before — no sub-agent roster on codex | +| Roles | All | All; `review`/`retro` at `--thinking medium` by default | Same recommendation as before until a fleet-shaped run completes ([Sub-agents](runtimes/codex.md#sub-agents)) | | Effort | `--effort low..max` | `--thinking`, same levels (`high` when unset) | `model_reasoning_effort`, same levels | | Tools | Native Claude permission syntax | `--tools` (strict) + a first-token Bash allowlist | Shell + `apply_patch` only; `tools:` is recorded, not enforced (the allowlist hook is opt-in) | | Security controls | Full matrix | Full matrix; stricter on failed-call sanitizing | Full matrix; post-tool hooks detect and block but cannot rewrite output | diff --git a/docs/runtimes/codex.md b/docs/runtimes/codex.md index 1964082422..7071615ff3 100644 --- a/docs/runtimes/codex.md +++ b/docs/runtimes/codex.md @@ -130,19 +130,114 @@ own log. **Check the effort level against the model.** Effort is passed to the gateway as is, and some models refuse some levels with an upstream 400. Check the levels your model accepts before you set `effort`. +**No native sub-agents.** A `gateway/` parent keeps Codex's multi-agent tools off and runs in one +context, whatever its id (see [Sub-agents](#sub-agents)). + +### Child models + +A native child (see [Sub-agents](#sub-agents)) runs on the first of these that is set: + +1. `subagents.` on the agent's `agents:` entry — that persona's role file carries the model; +2. `FULLSEND_CODEX_SUBAGENT_MODEL` on the runner — the run-level default for every other child; +3. `subagents.default` on the agent's `agents:` entry; +4. `gpt-5.6-luna`. + +Positions 2 to 4 set Codex's `agents.default_subagent_model`, which every child without its own +entry takes — the personas without an entry and the unnamed children of `retro` alike. A +persona's frontmatter `model:` is never applied on codex. Only OpenAI ids are accepted +(`openai/` or the bare id): a Claude alias, another provider's prefix, a `gateway/` spec (a +delegating run is always on the direct route; see [Sub-agents](#sub-agents)) or `inherit` fails +Bootstrap and names the key: + +``` +subagents.correctness: "xai-vertex/xai/grok-4.6" is not an OpenAI model id (openai/ or the bare +id); set an OpenAI id (openai/) or tombstone the entry (`correctness: ~` under subagents:) so the +run-level default applies +``` + +A tombstone (`correctness: ~`) removes an inherited entry, as on pi, so a `subagents` map written +for pi can stay in a parent layer. Bootstrap also checks every resolved model, the floor included, +against the catalog bundled with the pinned Codex CLI (`codex debug models --bundled`, read offline +in the sandbox) and fails naming the position that supplied an unlisted id: Codex itself checks a +run-level default only at each spawn and a role-file model not at all. A listed model the provider +does not serve still fails that child at its first request: it ends `errored`, no other model is +substituted, and the parent treats that role as failed. The floor is `gpt-5.6-luna`, the cheap +gpt-5.6 tier #6970 chose; it must be listed in the bundled catalog, and its collaboration version +does not matter, because a child runs under its parent's. The runner reads `FULLSEND_CODEX_SUBAGENT_MODEL` from its own +environment: you set it for a local `fullsend run`, and on GitLab a project or group CI/CD variable +reaches it, since the job runs `fullsend run` in its own environment. The GitHub fleet workflows do +not pass it, and unlike `FULLSEND_CODEX_MODEL` it is not read from repository variables, so on that +path set `subagents.default` instead. + +Every child runs at the run's effort (`effort:`, an `agents:` entry or `--effort`) when one is set: +Bootstrap writes it as `agents.default_subagent_reasoning_effort`. Codex checks a child's effort +against its model at every spawn and refuses the spawn when the model lacks it, so Bootstrap checks +the effort against the run-level child model and every persona model in the bundled catalog and +fails naming the effort, the model and the position that chose it; at the pin only `max` on +`gpt-5.5` fails. With no run effort, codex resets every child to the run-level child model's +catalog default (`medium` for `gpt-5.6-luna`, `low` for `gpt-5.6-sol`), a persona with its own +model included, and Bootstrap checks that level against the persona models. pi children run at +`medium` unless `FULLSEND_PI_SUBAGENT_THINKING` says otherwise. Bootstrap prints what it resolved: + +``` +subagents: default → gpt-5.6-luna (from built-in default; children that name no persona and personas without an entry) +subagents: correctness → gpt-5.6-sol (from subagents.correctness) +subagents: effort → high (from the run's effort; every child) +``` + +## Sub-agents + +An agent whose `tools:` frontmatter includes `Agent` (or its alias `Task`), or declares no `tools:` +at all, runs its sub-agents as native Codex children when harness security is enabled and Codex +resolves its parent model to collaboration V1 on the direct route (see the end of this section). Bootstrap registers +one role per persona it discovers under the uploaded skills' `sub-agents/*.md`, plus a generic +`default` role for a task that names no persona and an instruction-only `explore` role for a +skill's `Explore` pass (nothing enforces read-only on a child). The roster is not a fixed list: +the runtime note at the end of the agent's instructions names it (`Registered sub-agent roles: +...`), and `config.toml` in a kept sandbox declares it. An agent whose `tools:` list leaves +`Agent` out, and any run with harness security disabled, keeps Codex's multi-agent tools off and +runs in one context, as before. + +A child gets no copy of the parent's conversation (`fork_context: false`): it starts from its +role's instructions and the message its parent sends. At most four are open at once, and the depth +is one. A runner-owned hook admits a spawn only for a registered role with `fork_context: +false` and no model or effort override; it denies resume, Codex's built-in `explorer` and +`worker`, and any spawn from a child. A denied spawn is final for that role: the parent runs that +sub-agent definition itself. A spawn the hook did not admit fails the run after the fact, within +the limits named in [Troubleshooting](#troubleshooting): per iteration the runner counts the +spawns seen in the event stream or in the children's rollouts on disk, each child once, and +compares the run's total with the admissions the hook recorded. Every child's rollout is saved and redacted like the +parent's, and its tokens are in `metrics.json` (see [At a glance](#at-a-glance)). + +Delegation needs a parent model Codex resolves to collaboration V1: its entry in +the pinned CLI's bundled catalog selects V1, or carries no version and Codex's +`multi_agent` feature, on by default, supplies V1 (on the current pin +`gpt-5.6-luna`, `gpt-5.5` and a hidden catalog entry). Bootstrap reads that +catalog; for any other parent, a V2 model such as `gpt-5.6-sol` or a model the +catalog does not list included, it keeps Codex's multi-agent tools off, prints +one line saying why (`sub-agents: parent model "gpt-5.6-sol" selects +collaboration "v2"; native sub-agents need a parent Codex resolves to +collaboration V1, running in one context`), and the agent runs in one context. +A `gateway/` parent runs in one context the same way, whatever its id +(`sub-agents: parent model "gateway/gpt-5.6-luna" takes the inference gateway +route, where native sub-agents are not supported, running in one context`): +children would inherit the gateway provider with bare OpenAI ids it may not +serve, and native children have not been run on that route. + ## At a glance | | | |---|---| | Credentials | A runner-exchanged OpenAI WIF token in CI, or your `OPENAI_API_KEY` on the runner locally — never in the sandbox. Codex reads a placeholder from a runner-owned token file and re-reads it when the credential is refreshed ([ADR 0092](../ADRs/0092-openai-wif-credential-delivery.md)). A `gateway/` model uses the inference gateway's credential the same way ([Models through an inference gateway](#models-through-an-inference-gateway-experimental)) | | Unattended | Approvals off; codex's own sandbox off, because OpenShell is the boundary. A missing credential exits before the agent starts | -| Artifacts | `output.jsonl` (the `codex exec --json` stream), `transcripts/-.jsonl`, `metrics.json` with `runtime: codex`, plus `codex-debug.log` with `--debug`. Only uncompressed rollouts are extracted — codex compresses older sessions, so a `.jsonl.zst` is never the run's own transcript. The agent's final message is in the stream; `--output-last-message` also drops it in the runner-owned config directory inside the sandbox, which is a convenience when inspecting a kept sandbox rather than a downloaded artifact | -| Extra knobs | `FULLSEND_CODEX_MODEL` (the runner-side model default for codex runs; see [Models](#models)) | -| Not supported | Sub-agents, `plugins:`, fallback chains, non-OpenAI providers (other than through a Responses-capable inference gateway), Chat Completions or Messages on a gateway | +| Artifacts | `output.jsonl` (the `codex exec --json` stream), `transcripts/-.jsonl` for the root thread and `transcripts/-sub-.jsonl` for each native child (`generic` for the `default` role, which codex records as no role when the spawn names no `agent_type`; `explore` keeps its name), `metrics.json` with `runtime: codex` (and `per_model_usage` for a delegating agent), plus `codex-debug.log` with `--debug`. Only uncompressed rollouts are extracted — codex compresses older sessions, so a `.jsonl.zst` is never the run's own transcript. The agent's final message is in the stream; `--output-last-message` also drops it in the runner-owned config directory inside the sandbox, which is a convenience when inspecting a kept sandbox rather than a downloaded artifact | +| Sub-agents | Native Codex children for an agent whose tools include `Agent` (or that declares no `tools:`), with harness security on, on a parent model Codex resolves to collaboration V1 on the direct route, under a runner-owned policy: registered roles only, fresh context, depth one, four open; see [Sub-agents](#sub-agents) | +| Extra knobs | `FULLSEND_CODEX_MODEL` (the runner-side model default for codex runs; see [Models](#models)), `FULLSEND_CODEX_SUBAGENT_MODEL` (the run-level child model; the GitHub fleet workflows do not pass it; see [Child models](#child-models)) | +| Not supported | `plugins:`, fallback chains, non-OpenAI providers (other than through a Responses-capable inference gateway), Chat Completions or Messages on a gateway, delegation from a parent model on collaboration V2 or from a `gateway/` parent (see [Sub-agents](#sub-agents)) | Cost is recorded as **zero** in `metrics.json` on codex: the `codex exec --json` stream carries no cost field, so the value stays `0`. -Token counts are recorded normally on the direct route; through a gateway +Token counts are recorded normally on the direct route and include native children; through a gateway they can read 0 (see [Models through an inference gateway](#models-through-an-inference-gateway-experimental)). See [Computing dollar cost from token telemetry](../guides/infrastructure/distributed-tracing.md#computing-dollar-cost-from-token-telemetry) for a list-price estimate from `run-telemetry.jsonl`, including Codex reasoning tokens. @@ -303,12 +398,10 @@ has no default behaviour-test coverage; its scenario is gated. What was run, and is recorded in [codex runtime internals](../contributing/runtime-implementation.md#codex-runtime-internals-6920). -**Keep `review` and `retro` on Claude Code.** fullsend turns off Codex's native delegation -(`agents.enabled = false` and `features.multi_agent_v2 = false` in the config it writes) because it -does not yet support persona wiring or child token accounting, so those two agents run in a single -context instead of with their reviewer personas. Nothing prevents a repo-wide `runtime: codex` from -applying to them — they will run — so pin them with `runtime: claude` on their `agents:` entries if -you want the roster: +**Keep `review` and `retro` on Claude Code.** Their sub-agents run as native Codex children +([Sub-agents](#sub-agents)), but that path has not completed a fleet-shaped run yet. Nothing +prevents a repo-wide `runtime: codex` from applying to them — they will run — so pin them with +`runtime: claude` on their `agents:` entries until it has: ```yaml agents: @@ -316,6 +409,11 @@ agents: runtime: claude ``` +**`code` and `fix` delegate too.** They declare no `tools:`, so on a V1 parent on the direct route with harness security +on they get the `default` and `explore` roles, children with the parent's shell and `apply_patch`, +the spawn guard and the dispatch note, as `review` does. Both have run end to end that way on +`gpt-5.6-luna` and chose not to spawn, so neither has run a native child yet. + ## Troubleshooting **``codex preflight: `codex --version` exited 127``, or @@ -388,21 +486,28 @@ The first two exit 97 and mean the hook wiring cannot be trusted; the third exit credential-and-trust guard. All three are fail-closed by design. Between iterations the agent runs as the same user as those files, so "did the agent write there?" is the question to ask first. -**A spawn failed the admission check.** After an iteration whose `exec --json` stream reported a -completed `spawn_agent`, the runner compares the run's completed spawns with the spawn guard's -`codex_spawn_guard_admit` lines in `/sandbox/workspace/.security/findings.jsonl`, and the run fails -whatever codex's exit code. Each message says why: +**A spawn failed the admission check.** After every iteration of a delegating agent, and any +iteration whose stream shows a spawn, the runner counts that iteration's spawns from two sources, +each child once by its thread id: the `spawn_agent` items in the `exec --json` stream, completed or +failed (each passed the guard; a spawn the guard blocks emits none, and one codex refused before a +thread existed names no child), and the rollouts under `$CODEX_HOME/sessions` whose parent is the +run's thread or one of its children (a file whose first line is empty, cut before it names a +parent, or not a `session_meta` record counts too, under the thread id in its name, +`rollout-