Skip to content

Add Codex engine alongside Claude - #480

Merged
max-sixty merged 8 commits into
mainfrom
codex
May 15, 2026
Merged

max-sixty merged 8 commits into
mainfrom
codex

Conversation

@max-sixty

@max-sixty max-sixty commented May 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds harness: claude | codex to .config/tend.yaml. The generator
routes per harness: action ref, secret names, prompt invocation syntax.
Claude path output is byte-identical to before.

Two slices:

  1. Harness plumbing. harness config field, generator routing,
    harness-aware tend check (verifies the right secret per harness),
    install-tend skill branched on harness for the auth-token step,
    docs updated across README, docs/security-model.md,
    docs/tend.example.yaml, CLAUDE.md. New tests including 8
    parametrized snapshot baselines for the Codex variants.

  2. codex/action.yaml. New composite action at
    max-sixty/tend/codex@v1. Bypasses openai/codex-action and shells
    out to codex exec directly so we can support both auth modes from
    one path:

    • OPENAI_API_KEY (recommended; standard API billing).
    • CODEX_AUTH_JSON (subscription-funded — written to
      ~/.codex/auth.json. OpenAI's docs explicitly discourage this on
      public repos; the install skill refuses it for public repos.)

    Installs the tend-ci-runner plugin via the new (alpha.17)
    codex plugin add non-interactive path. Builds Codex from source
    meanwhile — the npm release with plugin add hasn't shipped yet
    (PR [codex] add plugin marketplace CLI commands openai/codex#21396). The npm install -g @openai/codex block is
    preserved as a commented swap-in for once it does.

What tend-ci-runner becomes under Codex

A real Codex plugin: plugins/tend-ci-runner/.codex-plugin/plugin.json
declares it; .agents/plugins/marketplace.json exposes it as part of
the tend marketplace. Adopters install it (in CI) via the action's
codex plugin marketplace add + codex plugin add steps. Skills
themselves are unchanged — same SKILL.md files, same cross-skill
references using /tend-ci-runner:NAME syntax (Codex interprets these
correctly without translation, verified by smoke test).

Shared system prompt

shared/system-prompt.md holds the harness-neutral conduct/scope rules.
Both actions consume it via envsubst (\${BOT_NAME}); each action
prepends a harness-specific skill-loading directive on top. Edits to
the shared file affect both harnesses.

Caveats called out

  • Tend's own CI stays on Claude in this PR. Flipping
    `.config/tend.yaml` to `harness: codex` requires `v1` to point at
    the release that includes `codex/action.yaml` — sequenced as a
    follow-up per `TODO.md`.
  • Cold cargo build is ~23 min on M-series. Cached via Swatinem;
    cache misses re-pay. Acceptable for testing the path; revisit when
    alpha.17+ binaries ship to npm or by caching the built binary itself.
  • Plugin install is REPL-only on stable Codex (≤0.130, alpha.16).
    Hence the source build at alpha.17.

Test plan

  • `pre-commit run --all-files` clean
  • `cd generator && uv run --frozen pytest` — 226 passed
  • Local `codex exec` smoke test against the alpha.17 binary:
    marketplace adds, plugin installs, all 9 tend skills appear in skill
    list, `$triage` invocation reads the right SKILL.md
  • Generator output for tend's own config is byte-identical to main
  • CI green
  • Once merged: cut release, then flip tend's own config to codex
    (separate PR per `TODO.md`)

🤖 Generated with Claude Code

max-sixty and others added 3 commits May 14, 2026 12:57
Adds engine = "claude" | "codex" to .config/tend.toml. Generator routes
per engine: action ref (max-sixty/tend@v1 vs max-sixty/tend/codex@v1),
secret names (CLAUDE_CODE_OAUTH_TOKEN vs OPENAI_API_KEY / CODEX_AUTH_JSON),
and an effort knob for Codex reasoning level. Claude-path output is
byte-identical to before; new snapshot tests cover the Codex variants.

Ships codex/action.yaml — installs @openai/codex on the runner and shells
out to `codex exec` directly (bypassing openai/codex-action so we can
support both API-key and auth.json subscription auth from one path). The
action stages skills via an AGENTS.md slash-command-translation hack —
tracked for rework in TODO.md after a smoke test confirmed Codex's native
~/.agents/skills/ discovery works without the AGENTS.md indirection.

tend check grows engine-aware secret validation; install-tend skill
branches on engine for the auth-token step. Docs updated across README,
docs/security-model.md, docs/tend.example.toml, and CLAUDE.md.

Tend's own .config/tend.toml stays on Claude — TODO.md notes the cutover
sequence (merge → release 0.0.19 → flip config) since regenerating
workflows now would reference the not-yet-tagged max-sixty/tend/codex@v1.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	CLAUDE.md
#	README.md
#	docs/tend.example.yaml
#	generator/tests/test_generate.py
#	plugins/install-tend/skills/install-tend/SKILL.md
…ests

The first cut staged tend's skills via an AGENTS.md slash-command-translation
hack. A local smoke test of `codex exec` confirmed that's unnecessary —
Codex has a real plugin system with native skill discovery, so we install
tend-ci-runner as a Codex plugin instead.

The codex action now:

- Builds Codex CLI from source at rust-v0.131.0-alpha.17 (the first build
  with `codex plugin add`, merged a few hours ago in PR openai/codex#21396).
  Cached via Swatinem/rust-cache. The earlier `npm install -g @openai/codex`
  step is preserved as a commented swap-in for once a stable npm release
  containing `plugin add` lands.
- Installs the plugin via `codex plugin marketplace add ${{ github.action_path }}/..`
  + `codex plugin add tend-ci-runner@tend`. Drops the AGENTS.md skill-router
  step and `--skip-git-repo-check`. AGENTS.md is now strictly CI-environment
  guidance, not a fake skill router.

Adds the manifests this requires:

- `.agents/plugins/marketplace.json` — Codex marketplace pointing at the
  tend-ci-runner plugin (sibling to the existing `.claude-plugin/marketplace.json`,
  which Claude consumes). Both stay in lockstep when plugins are added.
- `plugins/tend-ci-runner/.codex-plugin/plugin.json` — Codex plugin
  manifest mirroring the Claude one.

Generator emits engine-native invocation syntax: `/tend-ci-runner:NAME ARGS`
for Claude, `$NAME ARGS` for Codex (Codex auto-namespaces from the plugin
prefix). Cross-skill references inside skill bodies still use Claude
slash-command syntax — verified that Codex interprets them correctly
without translation.

Locally verified end-to-end with the alpha.17 build: marketplace adds,
plugin installs, all 9 tend skills appear in `codex exec`'s skill list,
`$triage` invocation reads the right SKILL.md.

Open: cold cargo build is ~23 min on M-series; even with cache warming,
a cache miss re-pays it. Acceptable for testing now; revisit when alpha.17+
publishes binaries to npm or we cache the built binary itself.

Co-Authored-By: Claude <[email protected]>

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Engine routing is well-isolated and the byte-identical Claude path is verified by the existing snapshots. Two things worth checking before merge:

Fork-PR AGENTS.md is not pinned (security). See inline comment.

Hyphenated $skill-name parsing under Codex. The PR description's smoke test mentions $triage (no hyphen) reading the right SKILL.md. Several generated prompts use hyphens — $ci-fix, $review-runs, and the staged AGENTS.md instructs ALWAYS load $running-in-ci first. If Codex's mention parser stops at the hyphen (treating $ci as the mention and -fix as literal), ci-fix / review-runs / nightly would silently miss their target skill. Worth a quick codex exec smoke test against $ci-fix or grepping Codex's mention regex to confirm hyphens are word characters there.

Comment thread codex/action.yaml Resolved
Mirrors the existing CLAUDE.md fork-PR pin for AGENTS.md, Codex's
equivalent instruction file. Without this, a fork's AGENTS.md gets
loaded by Codex during tend-review and can override the trusted
$CODEX_HOME/AGENTS.md guidance — including the bot identity guard and
gh-token handling rules.

Renames the step to "Pin instruction files" since it's no longer
CLAUDE.md-only. Walks the working tree for every AGENTS.md (Codex reads
per-directory, not just root), pinning each from base or removing if
absent. Also re-creates any AGENTS.md the fork deleted from base, so a
fork can't silently strip tend-shipped guidance.

Co-Authored-By: Claude <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

Re: hyphenated $skill-name parsing — verified locally with the alpha.17 binary. Codex resolves both correctly:

$ci-fix          → /Users/.../skills/ci-fix/SKILL.md
$running-in-ci   → /Users/.../skills/running-in-ci/SKILL.md

Mention parser handles hyphens. No action needed.

🤖 Generated with Claude Code

**Models.** The codex engine defaulted to `gpt-5.1-codex` from the
initial bring-up; that model is gone from Codex's models_cache as of
0.131.0. Default flips to `gpt-5.5` (current top-tier per Codex's own
priority ordering). Effort values updated to the current set:
low/medium/high/xhigh (no more `minimal`).

Also drops the Codex model allowlist entirely — Codex's catalog churns
fast enough that any allowlist tend ships will quickly lock adopters
out of newer models. Pass-through; `codex exec` errors at runtime if
the string is bad. The Claude model set (opus/sonnet/haiku) stays
allowlisted — small and stable.

**Shared system prompt.** Both engines now consume the engine-neutral
conduct/scope/precedence rules from `shared/system-prompt.md` (with a
single `${BOT_NAME}` placeholder, substituted via `envsubst`). The
Claude action prepends a `/tend-ci-runner:running-in-ci` directive and
appends the `system_prompt_append` input. The Codex action appends
Codex-specific tail (skill enumeration + tooling) from
`codex/agents-tail.md`. Single source of truth for the rules; edits
land for both engines in one PR.

Eliminates the heredoc escape soup (`\$running-in-ci`, `\`...\``)
the AGENTS.md staging step previously needed — both templates are
plain markdown reviewable as prose.

Co-Authored-By: Claude <[email protected]>
`harness` is the canonical agent-world term for what tend's config field
selects (the system that runs the model in a loop with tools — Claude
Code via claude-code-action, or Codex via the codex CLI). `engine` was
the placeholder during bring-up; this swap is purely cosmetic but
clearer at the config site (`harness: codex`).

Done across config field, KNOWN_HARNESSES / DEFAULT_MODEL_BY_HARNESS /
KNOWN_MODELS_BY_HARNESS, error messages, every doc and SKILL.md, and
README/security-model/CLAUDE.md prose. Snapshots regenerate
byte-identically — the choice of name only appears at the config site,
never in generated workflow YAML.

Also reformats the verbose mention and ci-fix prompt builders from
piecewise `f"...\\n" f"...\\n"` concatenation to triple-quoted
f-strings — same output, much more readable source.

Co-Authored-By: Claude <[email protected]>

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The engine → harness rename is otherwise clean and consistent across config, generator, action wiring, and tests (snapshots verify byte-identical output for both harnesses; full suite green). Two small follow-ups inline.

One residual the inline comments don't cover: README still has a ## Engines section (README.md:182) and the prose still calls them "engines" (line 184). If the rename is meant to apply to user-facing terminology too, the section heading and prose should follow; if "engine" is intentionally kept as the prose noun, then the harness: config key reads as a small surface inconsistency. Worth a quick call either way.

Comment thread TODO.md Resolved
Comment thread docs/security-model.md Resolved
Three pieces tend-agent flagged on commit 6688cd2:

1. README's `## Engines` section heading and prose still said "engines"
   while the config field had become `harness:`. Heading → `## Harnesses`,
   prose → harness/harnesses.
2. TODO.md cutover step still showed `.config/tend.toml` with TOML
   assignment syntax (stale from before the YAML migration). Updated to
   `.config/tend.yaml` and YAML mapping form. Also bumped the model
   example from gpt-5.1-codex (gone from Codex's catalog) to gpt-5.5.
3. docs/security-model.md: `an harness` → `a harness` (article matters
   before the consonant-sounding word) and `.config/tend.toml` → `.yaml`.

Co-Authored-By: Claude <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

Re: README "Engines" section heading + prose — fixed in d11feac. Section is now ## Harnesses; prose follows.

🤖 Generated with Claude Code

@max-sixty
max-sixty merged commit 92aac27 into main May 15, 2026
4 of 5 checks passed
@max-sixty
max-sixty deleted the codex branch May 15, 2026 00:51
@max-sixty max-sixty mentioned this pull request May 15, 2026
2 of 6 tasks
max-sixty added a commit that referenced this pull request May 15, 2026
## Summary

Release 0.0.19. Headline change: **Codex harness support alongside
Claude** (#480).

- New `codex/action.yaml` composite action — invokable as
`max-sixty/tend/codex@v1`.
- `harness: claude | codex` field in `.config/tend.yaml` (default
`claude`); the generator picks the matching action ref and secret names
per harness.
- `shared/system-prompt.md` consumed by both actions.
- Codex plugin manifest at
`plugins/tend-ci-runner/.codex-plugin/plugin.json` and marketplace at
`.agents/plugins/marketplace.json`.

Tend's own config stays on `harness: claude` for now — flipping to Codex
is a separate follow-up PR after this release publishes.

Site polish + minor fixes round out the rest (#456, #462–#464,
#468–#472, #475, #476, #478, #481, #457, #459, #466, #482).

## Test plan

- [x] `wt test` passes
- [x] `pre-commit run --all-files` passes
- [ ] CI green on this PR
- [ ] After merge: `uvx [email protected] --help` resolves once PyPI release
workflow completes
- [ ] v1 branch auto-updated by `update-action-branch.yaml`
- [ ] Follow-up PR regenerates tend's own workflows with `uvx
tend@latest init`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants