Skip to content

codex: install CLI from npm prebuilt instead of building from source - #522

Merged
max-sixty merged 1 commit into
mainfrom
codex-install-speedup
May 16, 2026
Merged

max-sixty merged 1 commit into
mainfrom
codex-install-speedup

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Tend's Codex action built the CLI from source via cargo install --git at a pinned tag — ~22 min on a cache miss, plus a Rust toolchain and a binary-cache layer to make hits fast. We did this because the codex plugin add subcommand tend needs (PR #21396, merged 2026-05-14) postdated every npm release.

That PR is now on npm. PR #21396 first appears in release tag rust-v0.131.0-alpha.17 (verified via merge-commit ancestry: alpha.16 diverged from it, alpha.17+ contain it). On npm it's published on the alpha dist-tag — latest/stable is still 0.130.0 and lacks it. I installed @openai/[email protected] from npm into a scratch dir and confirmed directly: prebuilt per-platform binary, ~3 s install, codex plugin --help lists add / marketplace / list / remove.

This performs the cut-over the old comment documented: the four build steps (Cache codex / Set up Rust / Build / Verify) and the commented swap-in block are gone, replaced by a single npm install -g "@openai/codex@${codex_version}". codex_version becomes an npm version string (default 0.131.0-alpha.22); since npm latest predates #21396, the default pins an explicit alpha rather than tracking latest. The empty-string fallback from the old commented block is dropped — its else resolved to latest (0.130.0), which silently lacks the subcommand; one canonical pinned path is correct and lower-cardinality. The explanatory comment is rewritten and date-stamped (the npm version-state note drifts).

Net: ~22 min cold build (and the toolchain + cache machinery) gone; install is ~3 s prebuilt, works without the GitHub release path.

Scope is the codex install region + the codex_version input only. Not touched: the final_message/TEND_EOF heredoc (handled separately on codex-final-message-delimiter), the sandbox default (#519), the generator. pre-commit run --all-files (incl. actionlint) and wt test (230 passed, 0 regtest changes — action-internal) both green.

🤖 Generated with Claude Code

PR #21396 (the `codex plugin add` subcommand tend needs) is now
available on npm via the `alpha` dist-tag — verified that
`@openai/[email protected]` ships a prebuilt binary with
`codex plugin add`, installing in ~3 s with no Rust toolchain.

Replace the four build steps (Cache codex / Set up Rust / Build /
Verify) and the cargo-from-source path (~22 min cold) with a single
`npm install -g` of a pinned alpha. `codex_version` becomes an npm
version string (default `0.131.0-alpha.22`); npm `latest` (0.130.0)
still predates #21396, so the default pins an explicit alpha rather
than tracking `latest`. Comment date-stamped since that state drifts.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 28412cb into main May 16, 2026
6 checks passed
@max-sixty
max-sixty deleted the codex-install-speedup branch May 16, 2026 03:20
@max-sixty max-sixty mentioned this pull request May 16, 2026
3 tasks
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Release 0.0.21 — makes the Codex harness functional on GitHub Actions
runners.

3 commits since 0.0.20:
- #519 — codex sandbox defaults to `danger-full-access` for CI (the
runner VM is the isolation boundary; `bwrap` isn't on the runner image)
- #521 — random heredoc delimiter for `final_message` output (static
`TEND_EOF` broke on awkward agent output)
- #522 — codex CLI installed from npm prebuilt instead of ~45min source
build

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: tag `0.0.21`, PyPI publish succeeds, `uvx [email protected]
--help` works
- [ ] Regenerate tend's own workflows to pin `@0.0.21`

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
Routine post-release regen. Pins the eight `tend-*.yaml` workflows to
`max-sixty/[email protected]`. Until this merges, tend's deployed workflows
lag the just-released generator.

0.0.21 makes the Codex harness functional on GHA (#519/#521/#522); tend
itself stays on the Claude harness — only the pinned action version
changes here.

## Test plan

- [ ] CI green (test, test-worker, lint)

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
0.0.21 carries the three fixes that make the Codex harness work on
GHA: sandbox defaults to danger-full-access (#519), npm prebuilt
install (#522), random heredoc delimiter for output (#521).

Co-Authored-By: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Flips tend's own CI from the Claude harness to the Codex harness by
setting `harness: codex` in `.config/tend.yaml` and regenerating the
eight `tend-*.yaml` workflows. Each now invokes
`max-sixty/tend/[email protected]` with `CODEX_AUTH_JSON` instead of
`max-sixty/tend@<v>` with `CLAUDE_CODE_OAUTH_TOKEN`.

Motivation is cost: API billing scales per token; a flat-rate ChatGPT
subscription funds unlimited runs. tend dogfoods its own setup, so it
should run the harness we recommend for cost-sensitive adopters.

The net diff is small — config (+ `harness: codex`, + `secrets.allowed:
[CODEX_AUTH_JSON]`) and the regenerated workflow files (action ref, auth
secret, model, skill-invocation syntax). Supporting infrastructure
landed separately on main:

- `codex-auth-refresh.yaml` + env-scoped `CODEX_REFRESH_PAT` rotation
(#500, #510)
- `CODEX_AUTH_JSON` as a repo secret, refresher writes it back at repo
scope (#514)
- Codex-on-GHA fixes, all in release 0.0.22: sandbox
`danger-full-access` (#519), npm prebuilt install (#522), base64
`final_message` capture (#525)

## Validation

The original "do not merge until…" prerequisite is **satisfied**:

- `tend-review-runs` `workflow_dispatch` on this branch (pinned
`[email protected]`) ran **green end-to-end** — codex authenticated,
installed via npm, ran without the `bwrap` block, executed the full
agent (real review-runs work: posted evidence to the tracking issue,
commented on the outage issue), and the action exited 0.
- Deterministic CI (`test`, `test-worker`, `lint`) green; `tend-review`
(Claude harness via `pull_request_target`) approved.

Each codex blocker found during stabilization was fixed and released:
auth scoping → sandbox → install → output framing. The smoke test going
green on 0.0.22 confirms convergence.

## Post-merge follow-up

Watch the first unattended nightly `codex-auth-refresh` cron (`17 3 * *
*`) succeed. Manual dispatches (incl. the post-#514 recovery) have all
succeeded; this just confirms the scheduled path runs without a human.
Failure degrades gracefully over the ~8-day refresh window, with manual
rotation as fallback.

---------

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Flips tend's own CI from the Claude harness to the Codex harness by
setting `harness: codex` in `.config/tend.yaml` and regenerating the
eight `tend-*.yaml` workflows. Each now invokes
`max-sixty/tend/[email protected]` with `CODEX_AUTH_JSON` instead of
`max-sixty/tend@<v>` with `CLAUDE_CODE_OAUTH_TOKEN`.

Motivation is cost: API billing scales per token; a flat-rate ChatGPT
subscription funds unlimited runs. tend dogfoods its own setup, so it
should run the harness we recommend for cost-sensitive adopters.

The net diff is small — config (+ `harness: codex`, + `secrets.allowed:
[CODEX_AUTH_JSON]`) and the regenerated workflow files (action ref, auth
secret, model, skill-invocation syntax). Supporting infrastructure
landed separately on main:

- `codex-auth-refresh.yaml` + env-scoped `CODEX_REFRESH_PAT` rotation
(#500, #510)
- `CODEX_AUTH_JSON` as a repo secret, refresher writes it back at repo
scope (#514)
- Codex-on-GHA fixes, all in release 0.0.22: sandbox
`danger-full-access` (#519), npm prebuilt install (#522), base64
`final_message` capture (#525)

## Validation

The original "do not merge until…" prerequisite is **satisfied**:

- `tend-review-runs` `workflow_dispatch` on this branch (pinned
`[email protected]`) ran **green end-to-end** — codex authenticated,
installed via npm, ran without the `bwrap` block, executed the full
agent (real review-runs work: posted evidence to the tracking issue,
commented on the outage issue), and the action exited 0.
- Deterministic CI (`test`, `test-worker`, `lint`) green; `tend-review`
(Claude harness via `pull_request_target`) approved.

Each codex blocker found during stabilization was fixed and released:
auth scoping → sandbox → install → output framing. The smoke test going
green on 0.0.22 confirms convergence.

## Post-merge follow-up

Watch the first unattended nightly `codex-auth-refresh` cron (`17 3 * *
*`) succeed. Manual dispatches (incl. the post-#514 recovery) have all
succeeded; this just confirms the scheduled path runs without a human.
Failure degrades gracefully over the ~8-day refresh window, with manual
rotation as fallback.

---------

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