Skip to content

Cut tend's CI over to the Codex harness - #520

Merged
max-sixty merged 13 commits into
mainfrom
cutover-to-codex
May 16, 2026
Merged

max-sixty merged 13 commits into
mainfrom
cutover-to-codex

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

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:

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.

max-sixty and others added 8 commits May 14, 2026 18:13
Set `harness: codex` in `.config/tend.yaml` and regenerate all eight
`tend-*.yaml` workflows with `uvx [email protected] init`. Workflows now invoke
`max-sixty/tend/codex@v1`, authenticate with `OPENAI_API_KEY`, default to
`gpt-5.5`, and emit `$skill-name` prompts.

`CLAUDE_CODE_OAUTH_TOKEN` stays in repo secrets for the first cycle in
case rollback is needed.

Co-Authored-By: Claude <[email protected]>
Refreshes CODEX_AUTH_JSON outside the consumer workflows so concurrent
mention/review/triage/ci-fix runs never trigger a rotation. Each night
the workflow POSTs the current refresh_token to OpenAI's OAuth endpoint,
reconstructs auth.json, and pushes it back via a dedicated PAT
(CODEX_REFRESH_PAT, secrets:write only).

Decoupling refresh from runtime is what makes the static-secret pattern
safe for tend's concurrency model — see
https://developers.openai.com/codex/auth/ci-cd-auth which warns "Do not
share the same file across concurrent jobs or multiple machines."

Co-Authored-By: Claude <[email protected]>
The previous framing said "rotate every ~7 days" without explaining
why or what fails. The reality: Codex rotates the refresh token on
use, the rotated value lands in an ephemeral runner, and the GitHub
secret holds the invalidated value. OpenAI's guide explicitly warns
against sharing auth.json across concurrent jobs.

Rewrite SKILL.md §7b step 3 to list both paths (manual rotation,
automated refresher workflow) and add an operational-rotation section
to security-model.md walking through the day-8 rotation race.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	plugins/install-tend/skills/install-tend/SKILL.md
These three files were edited locally while drafting #510. The
landed version on main has a small review-fix improvement to
SKILL.md ("Have the user paste the PAT back").

Committing so /gmm can merge main cleanly; main's version takes
precedence on conflict.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	plugins/install-tend/skills/install-tend/SKILL.md
# Conflicts:
#	.config/tend.yaml
#	.github/workflows/tend-ci-fix.yaml
#	.github/workflows/tend-mention.yaml
#	.github/workflows/tend-nightly.yaml
#	.github/workflows/tend-notifications.yaml
#	.github/workflows/tend-review-runs.yaml
#	.github/workflows/tend-review.yaml
#	.github/workflows/tend-triage.yaml
#	.github/workflows/tend-weekly.yaml
max-sixty and others added 2 commits May 15, 2026 21:09
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
`codex exec --output-last-message` writes the final-message file
**without a trailing newline**. The previous `$GITHUB_OUTPUT` heredoc
did `cat "$OUTPUT_FILE"` then `echo "$DELIM"`, gluing the closing
delimiter onto the last content line. The runner never saw
`ghadelimiter_…` alone on a line and failed the step with `Invalid
value. Matching delimiter not found` — turning **every** Codex run red
even though the agent completed its work correctly. PR #521 randomized
the delimiter (collision-proofing) but didn't fix this framing failure.

The fix replaces the heredoc with `echo "final_message=$(base64 -w0
"$OUTPUT_FILE")" >> "$GITHUB_OUTPUT"` — a single-line `key=value`
assignment, no heredoc, no delimiter. Immune to both the missing
trailing newline and to agent content that happens to contain the
delimiter. `base64 -w0` (GNU coreutils, present on Ubuntu runners)
guarantees no line wrapping.

Scope is internal to `codex/action.yaml`. `final_message` is set there
and exposed as an action output, but consumed nowhere — verified
exhaustively: not in the generator, generated workflows, the Claude
`action.yaml` (no analogous output), plugins, or skills. The output
description now documents the base64 encoding (`base64 -d` to decode)
for any future consumer.

This is the last known blocker for the Codex CI cutover (#520). A
release + workflow regen is required before that re-test — follow-on,
not part of this PR.

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

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
max-sixty and others added 3 commits May 16, 2026 09:06
# Conflicts:
#	.github/workflows/tend-ci-fix.yaml
#	.github/workflows/tend-mention.yaml
#	.github/workflows/tend-nightly.yaml
#	.github/workflows/tend-notifications.yaml
#	.github/workflows/tend-review-runs.yaml
#	.github/workflows/tend-review.yaml
#	.github/workflows/tend-triage.yaml
#	.github/workflows/tend-weekly.yaml
0.0.22 carries #525 (base64-encoded final_message) which fixes the
$GITHUB_OUTPUT framing bug that turned every Codex run red after the
agent succeeded. Last known cutover blocker.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	.github/workflows/tend-ci-fix.yaml
#	.github/workflows/tend-mention.yaml
#	.github/workflows/tend-nightly.yaml
#	.github/workflows/tend-notifications.yaml
#	.github/workflows/tend-review-runs.yaml
#	.github/workflows/tend-review.yaml
#	.github/workflows/tend-triage.yaml
#	.github/workflows/tend-weekly.yaml
@max-sixty
max-sixty merged commit b12ec0b into main May 16, 2026
4 checks passed
@max-sixty
max-sixty deleted the cutover-to-codex branch May 16, 2026 18:42
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Release 0.0.23. 6 commits since 0.0.22:

- #520 Cut tend's CI over to the Codex harness — tend now dogfoods Codex
- #531 fix(nightly-survey-files): print bucket/count to stderr — keep
JSON output uncontaminated
- #536 docs(claude-auth): correct June 15 2026 framing; recommend OAuth
for subscribers
- #538 **breaking:** rename default bot-token secret `BOT_TOKEN` →
`TEND_BOT_TOKEN`. Adopters using the default must add a `TEND_BOT_TOKEN`
repo secret before their next regen (or set `secrets.bot_token` in
`.config/tend.yaml` to keep using the old name)
- #539 fix(codex-action): export `CLAUDE_PLUGIN_ROOT` so plugin-bundled
scripts resolve under Codex
- #533 chore: regenerate workflows with tend 0.0.22

## Test plan

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

Co-authored-by: Claude <[email protected]>

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

Release 0.0.23 — unblocks the review-reviewers Codex migration.

Since 0.0.22:
- #539 — codex-action exports `CLAUDE_PLUGIN_ROOT` so skills using
`${CLAUDE_PLUGIN_ROOT}/scripts/...` work unchanged under Codex (the
blocker on PR #537)
- #538 — `TEND_BOT_TOKEN` as the default bot-token secret name
- #540 — `install-tend --with-install-test` for pre-merge verification
- #536 — docs(claude-auth) framing for 2026-06-15
- #531 — nightly-survey-files prints bucket/count to stderr
- #520 — tend's own CI flipped to the Codex harness (live; consumer
regen moves it forward)

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: tag `0.0.23`, PyPI publish, `uvx [email protected] --help`
works
- [ ] Regenerate main's workflows to `@0.0.23`
- [ ] Regenerate #537's codex workflows to `@0.0.23` and unblock the
review-reviewers migration

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

`review-reviewers` is the only custom (non-generated) tend workflow and
was the last one still on the Claude harness — every generated
`tend-*.yaml` flipped to Codex in #520. This also retires the last `@v1`
floating-ref consumer in this repo; everything else now pins immutable
`@X.Y.Z` after #515.

Once this lands, `CLAUDE_CODE_OAUTH_TOKEN` is no longer referenced by
any workflow on `main` and can be removed (separate decision — flagged
below).

## Workflow changes

- `max-sixty/tend@v1` → `max-sixty/tend/[email protected]`
- `claude_code_oauth_token` → `codex_auth_json: ${{
secrets.CODEX_AUTH_JSON }}`
- Added `model: gpt-5.5`; prompt switched to `$review-reviewers ${{
matrix.repo }}`
- Matrix now mirrors `data/consumers.json` (5 repos: `PRQL/prql`,
`max-sixty/cargo-affected`, `max-sixty/tend`, `max-sixty/worktrunk`,
`numbagg/numbagg`). The previous hand-list was missing `cargo-affected`
and `numbagg`.

The existing `# TODO: Move repo list to a config file` is still live —
`consumers.json` is that file; a follow-up could have the workflow
generate the matrix dynamically via `fromJSON` and a setup job, retiring
the TODO. Out of scope here.

## Skill changes

`plugins/tend-ci-runner/skills/review-reviewers/SKILL.md` generalizes
the cost-discipline section so the same prose works under either
harness:

- "Haiku subagents" → "cheap subagent (e.g. Haiku / gpt-mini)"
- "main Opus agent" → "main agent"

The concrete subagent call is left to each harness's native mechanism
(Claude: `Agent` tool with `model: "haiku"`; Codex: subagent spawn with
a gpt-mini-class model). Pattern, gates, and outputs are unchanged.

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: trigger `review-reviewers.yaml` via
`workflow_dispatch` and watch all 5 matrix entries (`fail-fast: false`)
- [ ] Eyeball token usage on the first run — openai/codex#16548 reports
the subagent model selection being ignored at codex 0.118.0; the action
installs 0.128.0 and we want to confirm the cheap subagent actually runs
on the requested model, not silently on gpt-5.5
- [ ] After a clean run, decide whether to drop
`CLAUDE_CODE_OAUTH_TOKEN` from repo secrets (now unreferenced)

---------

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

Release 0.0.23. 6 commits since 0.0.22:

- #520 Cut tend's CI over to the Codex harness — tend now dogfoods Codex
- #531 fix(nightly-survey-files): print bucket/count to stderr — keep
JSON output uncontaminated
- #536 docs(claude-auth): correct June 15 2026 framing; recommend OAuth
for subscribers
- #538 **breaking:** rename default bot-token secret `BOT_TOKEN` →
`TEND_BOT_TOKEN`. Adopters using the default must add a `TEND_BOT_TOKEN`
repo secret before their next regen (or set `secrets.bot_token` in
`.config/tend.yaml` to keep using the old name)
- #539 fix(codex-action): export `CLAUDE_PLUGIN_ROOT` so plugin-bundled
scripts resolve under Codex
- #533 chore: regenerate workflows with tend 0.0.22

## Test plan

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

Co-authored-by: Claude <[email protected]>

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

Release 0.0.23 — unblocks the review-reviewers Codex migration.

Since 0.0.22:
- #539 — codex-action exports `CLAUDE_PLUGIN_ROOT` so skills using
`${CLAUDE_PLUGIN_ROOT}/scripts/...` work unchanged under Codex (the
blocker on PR #537)
- #538 — `TEND_BOT_TOKEN` as the default bot-token secret name
- #540 — `install-tend --with-install-test` for pre-merge verification
- #536 — docs(claude-auth) framing for 2026-06-15
- #531 — nightly-survey-files prints bucket/count to stderr
- #520 — tend's own CI flipped to the Codex harness (live; consumer
regen moves it forward)

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: tag `0.0.23`, PyPI publish, `uvx [email protected] --help`
works
- [ ] Regenerate main's workflows to `@0.0.23`
- [ ] Regenerate #537's codex workflows to `@0.0.23` and unblock the
review-reviewers migration

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