Skip to content

Cut Tend's own workflows over to Codex - #1397

Merged
max-sixty merged 10 commits into
mainfrom
codex/tend-gpt6-default
Oct 3, 2026
Merged

max-sixty merged 10 commits into
mainfrom
codex/tend-gpt6-default

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Switch Tend's own generated agent workflows and the hand-maintained reviewer-analysis workflow from Claude to Codex, using gpt-6-sol and published Tend 0.3.5 actions. The model-default and token-reporting implementations already landed; this PR contains the operational cutover and rollout instructions. The reviewer-analysis prompt uses Codex's native skill mention, and the workflow invariant test now resolves both repository-local and installed plugin skills. Tend's local overlay now identifies Codex artifacts and rollout paths while retaining the historical Claude paths for reports spanning the cutover.

A fresh device login and Tend-scoped refresh PAT are installed. Concurrent agent jobs receive access-only CODEX_AUTH_JSON in tend; the full refresh bundle and PAT are isolated in the default-branch-only tend-codex-refresh environment. The old misplaced refresh secrets are removed, and all 11 live tend checks pass. After merge, observe the serialized hosted refresh and an agent run with nonzero token usage. Secret names and local tests do not prove hosted authentication or refresh-chain independence.

Validation: all 51 repository-invariant tests and applicable pre-commit hooks pass. The workflow test rejects the old wrong-harness prompt. Published 0.3.5 generation is idempotent and generated action inputs match that release. Earlier full validation passed 1,369 Python tests, 32 worker tests, worker typecheck, two deterministic eval-capture tests, and all pre-commit hooks; CI will validate the final head.

This was written by Codex on behalf of max-sixty

@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.

This is draft feedback, not a merge verdict. Mark the PR ready when you want the full review.

Token reporting won't see Tend's own runs after the cutover. plugins/tend-ci-runner/scripts/token_report.py downloads only --pattern "claude-session-logs*". Its own footer lists "codex-harness runs" among the runs it skips. Once these workflows switch to max-sixty/tend/codex, every Tend run uploads codex-session-logs*. So the new TODO step ("confirm token-usage parsing reports non-zero values") can't pass, and review-runs' spend section and the Usage analysis recipe in running-tend both come back empty. review-reviewers/SKILL.md already handles this by passing both patterns. Adding --pattern "codex-session-logs*" to the gh run download call would fix the collection side. Codex records cost_usd: 0, so the report's cost line and its "Cost at API list prices" footer would also need adjusting for Codex rows. That file is outside this diff; I can push the change if you'd like.

Comment thread .claude/skills/running-tend/SKILL.md Resolved

@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.

This is draft feedback on the new ownership commit, not a merge verdict. Mark the PR ready when you want the full review. The two earlier points (Codex runs missing from token_report.py's artifact pattern, and the plural in running-tend) still apply to this head.

Comment thread generator/src/tend/checks.py Resolved

@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.

This is draft feedback on the latest commit, not a merge verdict. Mark the PR ready when you want the full review.

The shipped security reference still offers the rotator bridge as a setup, but tend check now fails it. This commit restores check_codex_auth to requiring OPENAI_API_KEY or the full subscription trio, whether or not codex-auth-refresh is enabled. The install-tend skill now tells users to remove enabled: false. The new bullet in install-tend/references/security-model.md still describes repos with a disabled refresher that receive only access-only CODEX_AUTH_JSON. A consumer following that bullet gets a failing codex-auth check. The bullet also names "a Mac rotator", which is this maintainer's own tool and means nothing to a consumer reading shipped text. The same sentence is in README's Codex section. docs/security-model.md is Tend's own document, so it can keep the note.

max-sixty added a commit that referenced this pull request Sep 23, 2026
Clarify the Codex Plus/Pro subscription setup for unattended CI: each
consumer repository needs its own full refresh-token chain and a GitHub
PAT scoped to that repository. Copying a full Codex login across
repositories lets their weekly refresh jobs invalidate one another.
Sharing only access tokens through an external rotator depends on that
rotator staying online before expiry.

Update the README, security model, install-tend guidance, and mirrored
example config. The guide calls out that separate device logins on one
ChatGPT account have not been verified to remain independent.

This documentation can land before the Tend Codex cutover in #1397,
which remains draft. Pre-commit passes on all files; no runtime code
changes.

> _This was written by Codex on behalf of max-sixty_

@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.

This is draft feedback on the merge commit, not a merge verdict. Mark the PR ready when you want the full review.

After the cutover, token_report.py's tables will order by a cost that is always zero. Every Tend run will be Codex, so each rollup's .cost is 0. by_cost then falls back to the reverse-alphabetical order from group_by(.subject). The SUBJECT table's .[:20] keeps 20 arbitrary subjects under a footer calling them "the 20 costliest", and the WORKFLOW table ordering carries no meaning. review-runs' Step 2 escalates outliers from these tables, so it would be reading noise. Breaking ties on cache-read restores a meaningful order when cost is unknown and leaves Claude-only reports unchanged.

max-sixty pushed a commit that referenced this pull request Sep 25, 2026
Moves `codex_version` from 0.156.0 to 0.157.0 in both
`codex/action.yaml` and `codex/refresh/action.yaml`, npm's current
`latest` dist-tag. The window also crosses
[0.156.1](https://github.com/openai/codex/releases/tag/rust-v0.156.1), a
single hotfix that adds GPT-6 Sol and Luna to the model picker;
[0.157.0](https://github.com/openai/codex/releases/tag/rust-v0.157.0)
carries the same catalog change plus the rest. No test pins the version
(the one `0.156.0` hit in `generator/tests/test_repo_pins.py` is a
comment about when a warning was removed, and stays accurate).

**Both refresh properties the refresh action depends on hold at
0.157.0.** `codex-rs/login` changed in 18 blobs, and every change on the
ChatGPT refresh path adds handling for a new "application network
policy" denial without altering the request or the refresh decision:

- `should_refresh_proactively` in
[`auth/manager.rs`](https://github.com/openai/codex/blob/00c972ed5d6ff6499317fd41b7f23605b8e6850d/codex-rs/login/src/auth/manager.rs#L3004)
is byte-identical across the two tags. An access token
`parse_jwt_expiration` can't read still falls through to `last_refresh <
now - TOKEN_REFRESH_INTERVAL`, which is what `stage_refresh`'s
`tend-forces-refresh` / `1970-01-01` staging relies on.
- The exchange at
[`manager.rs#L1643`](https://github.com/openai/codex/blob/00c972ed5d6ff6499317fd41b7f23605b8e6850d/codex-rs/login/src/auth/manager.rs#L1643)
is still `OAuthClient::refresh(RefreshTokenGrant { refresh_token,
resource: None })`, and
[`oauth/client.rs`](https://github.com/openai/codex/blob/00c972ed5d6ff6499317fd41b7f23605b8e6850d/codex-rs/login/src/oauth/client.rs#L76-L89)
sends only `grant_type=refresh_token`, `client_id`, and `refresh_token`;
the old access token is not a parameter. Error classification (401 /
`invalid_grant` 400 → permanent, transport → transient) is unchanged
apart from a new `Policy` variant that keeps the cached auth instead of
failing.

The new policy is inert for tend: it is `Restricted` only when admin
requirements (`requirements.toml` or a workspace cloud-config bundle)
set `network.enabled`, and tend configures neither.

**Nothing in the release changes the headless surfaces tend drives.**
Automatic background-server startup
([openai/codex#47179](openai/codex#47179)) and
model-migration prompts are TUI features; `codex-rs/exec` has no
`daemon` references and the `migration_markdown` / `retirement_at`
fields are read only by the TUI and app-server. `cli/src/plugin_cmd.rs`
still prints `Installed plugin root: {}`, and
`TokenUsageInfo.total_token_usage` keeps the `input_tokens` /
`cached_input_tokens` / `output_tokens` fields `token_usage.py` reads
from rollouts. The sandbox changes (network policy across redirects and
WebSockets, Windows object access) sit behind
`--dangerously-bypass-approvals-and-sandbox`, which tend passes because
the systemd unit is the sandbox. CI's `test-codex-surface` job installs
the new pin and asserts the exec flags, access-only auth, and
plugin-install output directly.

**Model catalog: no move in this PR.** The 0.157.0 catalog lists
`gpt-6-astra`, `gpt-6-sol`, and `gpt-6-luna`, and marks `gpt-5.6-sol`
(the `DEFAULT_MODEL_BY_HARNESS["codex"]` value; `.config/tend.yaml` pins
no Codex model) with `upgrade: gpt-6-sol`, `retirement_at: null`. That
is the Sol-tier successor, and #1397 already proposes making it the
default, so this PR leaves the default alone. Separately,
[openai/codex#47130](openai/codex#47130) removes
the `ultrafast` service tier from `gpt-5.6-sol`; tend sets no service
tier.

**Not verified here: the isolated Plus/Pro end-to-end refresh.** This
session had no Plus/Pro login, so it did not drive the refresh action
against the live endpoint to confirm that both the full and the
access-only credentials rotate. The refresh claims above rest on reading
the source.

Local checks: `uv run pytest -q` (1,334 passed; the two
`test_refresh_consumers.py` failures are the sandbox's missing DNS) and
`uv tool run pre-commit run --all-files`.

<details><summary>How the login surface was diffed</summary>

Blob listing per tag rather than the compare endpoint, which caps
`files` at 300:

```bash
login_blobs() { gh api "repos/openai/codex/git/trees/$1?recursive=1" \
  --jq 'if .truncated then error("tree truncated") else .tree[] | select(.type == "blob" and (.path | startswith("codex-rs/login/"))) | "\(.path) \(.sha)" end' | sort; }
diff <(login_blobs rust-v0.156.0) <(login_blobs rust-v0.157.0)
```

Every changed blob was fetched at both tags and diffed:

- On the ChatGPT refresh path: `auth/manager.rs` (the `Policy` error
variant, the `HttpError` conversion, the per-account
`http_client_factory`, invalidating the policy on owner change),
`oauth/client.rs` (a policy error while reading the response body
becomes `Transport` rather than `InvalidResponse`),
`auth/default_client.rs` and `outbound_proxy.rs` (a managed policy
routes through `RouteAwareClientPool`; auth endpoints resolve through an
optional local-bootstrap factory, which is absent unless one is
installed).
- Other login flows: `server.rs` and `device_code_auth.rs` (per-endpoint
auth factories for browser and device-code login),
`auth/workload_identity.rs` (policy classification), `gateway_auth.rs`,
`gateway_auth_token.rs`, and the new `gateway_auth_login.rs`.
`manager.rs` has no gateway references, so that grant path is separate
from the ChatGPT one.
- Tests and build: `auth/change_state_tests.rs`,
`oauth/client_tests.rs`, `gateway_auth_tests.rs`, the new
`gateway_auth_login_tests.rs` and `gateway_auth_storage_tests.rs`,
`tests/suite/login_server_e2e.rs`, `lib.rs` (re-exports), and
`BUILD.bazel` (test sharding).

</details>

Co-authored-by: tend-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 27, 2026
`token_report.py` listed workflows with `gh workflow list` and no
`--limit`. gh then returns at most 50 workflows and gives no sign that
it stopped. On a repo with more than 50 workflows, any `tend-*` workflow
past the 50th silently drops out of `review-runs`' Step 2 spend report.
Step 1's census still counts that workflow's runs, because
`list_recent_runs.py` already passes `--limit 200` and warns at that
limit (#1293). So the two steps disagree about which workflows make up
the fleet.

This PR gives `token_report.py` the same `WORKFLOW_LIMIT = 200`, and the
same warning when the listing reaches it. The new test
`test_the_workflow_listing_asks_past_gh_s_default_and_warns_at_the_limit`
failed before the fix: the recorded call was `workflow list --json
name`. The `token_report` and `list_recent_runs` suites pass (43 tests).

The listing lines don't overlap with #1397's edits to `token_report.py`.

Co-authored-by: tend-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 27, 2026
Moves `codex_version` from 0.157.0 to 0.157.1 in both
`codex/action.yaml` and `codex/refresh/action.yaml`, npm's current
`latest` dist-tag. The [0.157.1 release
notes](https://github.com/openai/codex/releases/tag/rust-v0.157.1) are
empty, so I diffed the full trees of the two tags
([`00c972e`](https://github.com/openai/codex/tree/00c972ed5d6ff6499317fd41b7f23605b8e6850d)
→
[`3665039`](https://github.com/openai/codex/tree/36650394c5b38c2990ccf2a3457165ca3e9d9726))
instead. Only ten files changed. Apart from the version bump in
`codex-rs/Cargo.toml`, each change is either Windows-only process
spawning (stdio inheritance in the app-server daemon, plus
`CREATE_NO_WINDOW` for child processes, all under `cfg(windows)`) or
test code.

**The refresh path is unchanged.** The blob-level diff of
`codex-rs/login/` between the two tags is empty, so the
unparsable-access-token fall-through to `last_refresh` and the
refresh-token-only grant that `codex/refresh` relies on behave as they
did at 0.157.0. #1432 verified those against the 0.157.0 source. As with
that bump, I didn't run the isolated Plus/Pro end-to-end refresh,
because this session has no such login.

**Headless surfaces are unchanged.** `plugin_cmd.rs` is the same blob
and still [prints `Installed plugin
root:`](https://github.com/openai/codex/blob/36650394c5b38c2990ccf2a3457165ca3e9d9726/codex-rs/cli/src/plugin_cmd.rs#L215).
The model catalog (`codex-rs/models-manager/models.json`) is also
byte-identical, so the default `gpt-5.6-sol` doesn't move here. #1397
still carries the proposed move to `gpt-6-sol`. CI's
`test-codex-surface` job installs the new pin and asserts the CLI
surface.

Local checks: `uv run pytest generator/tests` passes except the two
`test_refresh_consumers.py` tests, which need network that the sandbox
doesn't have (DNS).

Co-authored-by: tend-agent <[email protected]>
max-sixty added a commit that referenced this pull request Sep 29, 2026
… read every page of the repo's notifications (#1457)

Replaces hand-rolled mechanisms with features the tools and APIs tend
already uses provide natively, and fixes two bugs the sweep found. Net
−204 lines across 55 files.

### Bugs

- **`mark_notification_read` only saw the first 50 threads of the bot's
whole inbox.** It read `gh api notifications` unpaginated — every repo's
threads, first page only — so a bot with more than 50 unread threads
never marked this repo's thread. It now reads
`repos/{repo}/notifications` across every page and marks this event's
thread only when its `updated_at` is strictly before the run's start.
The comparison stays client-side because the API's `before=` filter has
returned threads bumped after its cutoff.
- **review-reviewers couldn't read the verify job log or all of a PR's
reviews.** `gh api .../jobs/<id>/logs` exits 1 on gh 2.101 when the log
carries terminal escapes, and `pulls/<n>/reviews` unpaginated drops the
newest past 30. Now `gh run view --log` and `gh pr view` / `gh issue
view --json`.

### Simplifications

- **Pagination:** `gh api --paginate --slurp` replaces four hand-written
decoders of concatenated pages (`github_cli`, the inlined mention and
notifications checks); gh's GraphQL `--paginate` with `$endCursor`
replaces `poll_pr_checks.fetch_rollup`'s cursor loop.
- **CODEOWNERS preflight:** one GraphQL query reads each candidate
directory's entry mode and blob text, replacing up to three Contents
probes (404s detected by matching `HTTP 404` in stderr), a base64
decode, and a separate mode query. Precedence (`.github/`, root,
`docs/`) and the refusals — symlink, submodule, binary, truncated — are
kept.
- **Codex:** `codex plugin add --json`'s `installedPath` replaces
scraping `Installed plugin root:` from its text output. Codex's warnings
go to stderr, which both the runner and the surface probe keep out of
the parsed JSON.
- **Nightly:** `git diff --cached --quiet -I '<stamp line>'` decides
whether only the version stamp changed, instead of regexing a diff.
- **`checks.py`:** environments are read from the listing already
fetched (it carries `protection_rules` and `deployment_branch_policy`);
one rulesets listing and one login lookup instead of three and two.
- **Duplicates:** `Cancelled` / `raise_on_cancel` live once in
`_common`; `gist_memory` uses `require_env`; `mark_notification_read`
uses `subject_number`. The proxy pid file nothing read is gone.
- **Skills:** `gh api`'s `{owner}/{repo}` placeholders replace seven
`REPO=$(gh repo view …)` round trips. The yolo merge gate is the `PUT`
with `sha` alone — GitHub refuses a moved head (409) and a closed or
unmergeable PR (405) itself. run-tend states the real hazard of `gh run
watch` / `gh pr checks --watch`.

### Left as is

A search-based count in `rate_limit_preflight` (the search index lags
creation by seconds, weakening the burst guard); `gh run watch` anywhere
(it treats one failed read as a finished run); `token_report` /
`list_recent_runs` (#1397 edits them).

#1171 will conflict in `mark_notification_read.py` on rebase: its early
return sat after the event-parsing line this removes. Read the event
name from `env` and the action from `_common.event_payload()` instead.

> _This was written by Claude Code on behalf of max-sixty_

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty max-sixty changed the title Make gpt-6-sol Tend's Codex default and prepare Tend cutover Cut Tend's own workflows over to Codex Oct 2, 2026

@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.

This is draft feedback on the latest merge and ranking commit, not a merge verdict. Mark the PR ready when you want the full review.

The merge put Claude syntax back into the review-reviewers prompt. The PR had changed this line to $review-reviewers. Merge 4835297 resolved the conflict by taking main's /review-reviewers, while keeping the PR's max-sixty/tend/codex action and gpt-6-sol model on the same step. Config.default_prompt documents the split: Claude resolves /NAME as a slash command, and Codex resolves $NAME as a skill mention. codex/agents-tail.md likewise tells Codex that skills are invoked with $<skill-name>. Every generated Codex workflow uses that form, for example $review in tend-review.yaml. Under Codex, /review-reviewers is plain text, so the daily sweep relies on the model guessing the skill from the prompt's wording.

Comment thread .github/workflows/review-reviewers.yaml Resolved
@max-sixty
max-sixty marked this pull request as ready for review October 3, 2026 01:25

@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.

.claude/skills/running-tend/SKILL.md still describes Claude's session-log layout, which no Tend run here will produce after this cutover. Under "Non-standard workflows" it says review-reviewers produces "claude-session-logs* artifacts". "Session Log Paths" gives the Claude project-dir layout, -var-tmp-tend-agent-workspace-*-checkout/<session-id>.jsonl. codex/action.yaml uploads codex-session-logs* instead, and token_usage.py copies the rollouts there as sessions/**/rollout-*.jsonl. Every bot session in this repo loads that overlay, and review-runs and debugging sessions use it to find logs, so they would start out looking for files that aren't there. The file is outside this diff. I can push the two-line update if you'd like.

@max-sixty
max-sixty merged commit afad88e into main Oct 3, 2026
13 checks passed
@max-sixty
max-sixty deleted the codex/tend-gpt6-default branch October 3, 2026 01:39
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