You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add shared runtime provider mapping
* feat: support codex runtime in planner config
* feat: support codex runtime in fast agent
* refactor: route harness providers through shared adapter
* fix: preserve fast runtime fallback mapping
* feat: patch agentfield codex structured output
* chore: install codex cli in docker images
* docs: document codex runtime configuration
* fix: stabilize docker codex runtime startup
* fix: make codex structured output schema-valid
* fix(codex): gate prompt-suffix patch on active provider
The codex harness patch was replacing _schema.build_prompt_suffix and
_runner.build_prompt_suffix globally at import time, so claude_code and
open_code runs were also receiving the codex-specific instruction:
"Do not try to create .agentfield_output.json yourself; the Codex CLI
will persist your final JSON response for AgentField."
That instruction is wrong for those providers — Claude / OpenCode are
supposed to use their Write tool to create the output file (the fast
path the runner expects), and forcing them onto the stdout-parse
fallback costs latency, drops the inline schema for small schemas, and
sends a confusing instruction referencing a Codex CLI that isn't in
the loop.
Use a contextvars.ContextVar set by a wrapped Agent.harness so that
the suffix dispatcher returns the codex-native suffix only when the
active call is for codex, and falls back to the original AgentField
suffix for every other provider.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(fast-planner): force fallback_used=False on successful parse
The codex strict-schema patch strips `default` from properties and
marks every field as required, so when FastPlanResult flows through
Codex the model has to invent a value for `fallback_used`. Despite
the prompt example showing `false`, Codex sometimes returns `true`
alongside a perfectly valid task list — making the flag meaningless
for any downstream consumer that gates on it.
`fallback_used` is planner-side state, not an LLM self-assessment:
it should be True iff the planner's `_fallback_plan(...)` path ran.
Override it back to False after a successful parse so the flag
reflects what actually happened, regardless of what the model wrote.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(codex): flag SWE_DEFAULT_MODEL requirement and bwrap host needs
Two gotchas surfaced when actually running a full main-mode build with
the codex runtime that weren't covered in the existing setup notes:
1. The Docker image bakes ENV HARNESS_MODEL=openrouter/moonshotai/kimi-k2.6
as an OpenCode-side fallback, and SWE-AF's model-resolution env cascade
reads HARNESS_MODEL. So a codex deployment that only sets
SWE_DEFAULT_RUNTIME=codex (without SWE_DEFAULT_MODEL) hands an
OpenRouter Kimi model id to the Codex CLI and the Product Manager
reasoner fails in ~13s. Document that SWE_DEFAULT_MODEL=gpt-5.3-codex
(or per-build models map) is required to pin the Codex model.
2. Codex CLI's workspace-write sandbox uses bubblewrap (`bwrap`) and
needs Linux user namespaces enabled on the host. Docker-on-WSL2 and
hardened environments refuse with "bwrap: No permissions to create a
new namespace", and the coder agents return success while writing no
files. Document the symptom so operators can recognize and fix it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Abir Abbas <abirabbas1998@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+56-2Lines changed: 56 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,9 +188,10 @@ Most agent frameworks wrap a single coder loop. SWE-AF is a coordinated engineer
188
188
189
189
</details>
190
190
191
-
**Claude & open-sourcemodels supported**: Run builds with either runtime and tune models per role in one flat config map.
191
+
**Claude, open-source, and Codex models supported**: Run builds with any runtime and tune models per role in one flat config map.
192
192
-`runtime: "claude_code"` maps to Claude backend.
193
193
-`runtime: "open_code"` maps to OpenCode backend (OpenRouter/OpenAI/Google/Anthropic model IDs).
194
+
-`runtime: "codex"` maps to the OpenAI Codex CLI backend.
194
195
195
196
## Adaptive Factory Control
196
197
@@ -279,6 +280,42 @@ curl -X POST http://localhost:8080/api/v1/execute/async/swe-planner.build \
279
280
}
280
281
JSON
281
282
283
+
# With Codex CLI runtime
284
+
curl -X POST http://localhost:8080/api/v1/execute/async/swe-planner.build \
285
+
-H "Content-Type: application/json" \
286
+
-d @- <<'JSON'
287
+
{
288
+
"input": {
289
+
"goal": "Add JWT auth",
290
+
"repo_url": "https://github.com/user/my-project",
291
+
"config": {
292
+
"runtime": "codex",
293
+
"models": {
294
+
"default": "gpt-5.3-codex"
295
+
}
296
+
}
297
+
}
298
+
}
299
+
JSON
300
+
301
+
# Fast mode with Codex CLI runtime
302
+
curl -X POST http://localhost:8080/api/v1/execute/async/swe-fast.build \
303
+
-H "Content-Type: application/json" \
304
+
-d @- <<'JSON'
305
+
{
306
+
"input": {
307
+
"goal": "Add a focused bug fix",
308
+
"repo_url": "https://github.com/user/my-project",
309
+
"config": {
310
+
"runtime": "codex",
311
+
"models": {
312
+
"default": "gpt-5.3-codex"
313
+
}
314
+
}
315
+
}
316
+
}
317
+
JSON
318
+
282
319
# Local workspace mode (repo_path) + targeted role override
283
320
curl -X POST http://localhost:8080/api/v1/execute/async/swe-planner.build \
284
321
-H "Content-Type: application/json" \
@@ -303,6 +340,12 @@ JSON
303
340
304
341
For OpenRouter with `open_code`, use model IDs in `openrouter/<provider>/<model>` format (for example `openrouter/minimax/minimax-m2.5`).
305
342
343
+
For Codex with ChatGPT subscription auth, install the Codex CLI on the host, run `codex login`, leave `OPENAI_API_KEY` unset for this process, and set `SWE_CODEX_AUTH_MODE=chatgpt` or `auto`. For OpenAI API-platform billing, set `SWE_CODEX_AUTH_MODE=api_key` and `OPENAI_API_KEY`.
344
+
345
+
> **Codex deployments using the Docker image must set `SWE_DEFAULT_MODEL=gpt-5.3-codex` on the environment** (or pass `models: {"default": "gpt-5.3-codex"}` in every build's `config`). The image bakes `HARNESS_MODEL=openrouter/moonshotai/kimi-k2.6` as an OpenCode fallback, and SWE-AF's model-resolution env cascade reads `HARNESS_MODEL` — so without `SWE_DEFAULT_MODEL` set, the Codex CLI receives an OpenRouter model id it can't handle and the Product Manager reasoner fails in ~13s. Setting `SWE_DEFAULT_MODEL` makes the cascade pin every role to the Codex model.
346
+
347
+
> Codex CLI's `workspace-write` sandbox uses bubblewrap (`bwrap`) and needs Linux user namespaces enabled on the host. Most production Linux hosts and managed container runtimes (Railway, etc.) allow this by default, but local Docker on WSL2 or hardened environments may refuse with `bwrap: No permissions to create a new namespace`. If the verifier reports that error, the coder ran but couldn't write files — enable user namespaces on the host before relying on the codex runtime there.
348
+
306
349
### Optional: web search
307
350
308
351
Coding and review agents can look up external documentation, library APIs, error messages, and version/deprecation status during a build. This is opt-in via two env vars on the deployment:
@@ -611,7 +654,7 @@ Pass `config` to `build` or `execute`. Full schema: [`swe_af/execution/schemas.p
|`runtime`|`"claude_code"`| Model runtime: `"claude_code"`or `"open_code"`. The default also honors the `SWE_DEFAULT_RUNTIME` env var when no `runtime` is passed in `config` — set it on the deployment so callers don't need to plumb a config through. |
657
+
|`runtime`|`"claude_code"`| Model runtime: `"claude_code"`, `"open_code"`, or `"codex"`. The default also honors the `SWE_DEFAULT_RUNTIME` env var when no `runtime` is passed in `config` — set it on the deployment so callers don't need to plumb a config through. |
615
658
|`models`|`null`| Flat role-model map (`default` + role keys below). Without a caller-supplied value, the `SWE_DEFAULT_MODEL` env var is used as the default for all roles — set it on the deployment to pin a model without code changes. Caller `models.default` or per-role keys still win. |
Copy file name to clipboardExpand all lines: docs/SKILL.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ curl -X POST http://localhost:8080/api/v1/execute/async/swe-planner.build \
75
75
76
76
| Key | Values | Description |
77
77
|-----|--------|-------------|
78
-
|`runtime`|`"claude_code"`, `"open_code"`| AI backend to use |
78
+
|`runtime`|`"claude_code"`, `"open_code"`, `"codex"`| AI backend to use |
79
79
|`models.default`| model ID string | Default model for all agents |
80
80
|`models.coder`| model ID string | Override for coder role |
81
81
|`models.qa`| model ID string | Override for QA role |
@@ -148,6 +148,12 @@ curl -X POST http://localhost:8080/api/v1/execute/async/swe-planner.build \
148
148
2. Model provider credentials configured in OpenCode (e.g., `OPENAI_API_KEY` for z.ai)
149
149
3. Model ID format matches what OpenCode expects
150
150
151
+
## Requirements for codex Runtime
152
+
153
+
1. Codex CLI installed and in PATH.
154
+
2. For ChatGPT subscription auth: run `codex login` on the host, set `SWE_CODEX_AUTH_MODE=chatgpt` or `auto`, and leave `OPENAI_API_KEY` unset for the agent process.
155
+
3. For OpenAI API-platform billing: set `SWE_CODEX_AUTH_MODE=api_key` and `OPENAI_API_KEY`.
| opencode CLI | 1.4+ | Only if using `open_code` runtime (see Known Issues) |
61
+
| Codex CLI | latest | Installed in the Docker image; required on host only to run `codex login` for ChatGPT subscription auth |
54
62
55
63
## Quick Start
56
64
@@ -68,6 +76,8 @@ This starts:
68
76
-**swe-agent** on `:8003` — SWE-AF full pipeline (`swe-planner` node)
69
77
-**swe-fast** on `:8004` — SWE-AF fast mode (`swe-fast` node)
70
78
79
+
To use Codex with a ChatGPT subscription, run `codex login` on the host before starting Docker and leave `OPENAI_API_KEY` unset for this process. The compose files mount `~/.codex` into both agent containers. To use OpenAI API billing instead, set `SWE_CODEX_AUTH_MODE=api_key` and `OPENAI_API_KEY`.
80
+
71
81
### Agent Only (connect to existing control plane)
72
82
73
83
If you already have an AgentField control plane running:
0 commit comments