镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix #1880: codex lane runs a current Codex CLI, names it, and accepts consult.codexPath - #1889

Merged
waleedkadous merged 9 commits into
mainfrom
builder/bugfix-1880
Nov 10, 2026
Merged

waleedkadous merged 9 commits into
mainfrom
builder/bugfix-1880

Conversation

@waleedkadous

@waleedkadous waleedkadous commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

consult -m codex --model-id gpt-6-astra failed with a provider 400 ("requires a newer version of Codex") because the codex lane runs the Codex CLI bundled inside @openai/codex-sdk, which was stuck at 0.146.x. This bumps the SDK to 0.167.0, prints which Codex binary and version ran, and adds an opt-in consult.codexPath so a lagging bundle can't block a new model again.

Fixes #1880

Root Cause

packages/codev/package.json declared "@openai/codex-sdk": "^0.146.0". On a 0.x package a caret pins the minor (>=0.146.0 <0.147.0), so no install could get past 0.146.x. The SDK pins its @openai/codex binary to its own exact version and resolves it from its own install location, never PATH, so upgrading the user's codex changed nothing. And nothing in consult's output said which binary ran, so the error read like a CLI upgrade the user had already done.

Fix

  • Bump @openai/codex-sdk ^0.146.0 → ^0.167.0 (bundled codex-cli 0.167.0). The API diff is additive (configOverrides, threadSource, cyberAccessProgram). ModelReasoningEffort widens to add max | ultra | persistent; the Spec 1286 exhaustiveness guard requires REASONING_EFFORTS to accept them, so that list, its test and both consult.md copies grow to match.
  • Name the binary. Every codex run prints [CODEX] binary: … (bundled version, or override path + its --version), and every codex-lane error annotation ends with The codex lane ran …. That includes failures on the shipped default model, which the annotation used to leave bare.
  • consult.codexPath (off by default): an absolute path, passed to the SDK as codexPathOverride. The lane runs <path> --version before consulting. A missing or non-executable path fails the consultation, naming the config file, with no fallback to the bundled CLI. Documented in codev/ and codev-skeleton/ resources/commands/consult.md.
  • The binary preflight runs inside the guarded lifecycle, so a failure still discards a stale review file and records failure metrics. Found by codex at CMAP.
  • Never passes apiKey (owner constraint: stay on the ChatGPT subscription). Unchanged, now pinned by a test.

~130 LOC of production code + docs; ~180 LOC of tests.

Subscription check on the new bundled binary (requested by the architect)

The .env is loaded exactly as consult's loadDotenv does it. The binary is the one the SDK itself resolves (new Codex(...) with no apiKey), run with the env the SDK hands its subprocess. Key values are never printed.

===== NEW (this branch)
.env keys loaded (OpenAI/Codex only): OPENAI_API_KEY
OPENAI_API_KEY set: true   CODEX_API_KEY set: false
SDK 0.167.0 resolves binary: ~/Development/cluesmith/codev/.builders/bugfix-1880/node_modules/.pnpm/@openai+codex@0.167.0-darwin-arm64/node_modules/@openai/codex/vendor/aarch64-apple-darwin/bin/codex
subprocess env has CODEX_API_KEY: false
$ codex --version
codex-cli 0.167.0
$ codex login status
Logged in using ChatGPT (exit 0)

===== OLD (global codev 3.3.7)
.env keys loaded (OpenAI/Codex only): OPENAI_API_KEY
OPENAI_API_KEY set: true   CODEX_API_KEY set: false
SDK 0.146.1 resolves binary: /opt/homebrew/lib/node_modules/@cluesmith/codev/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin/codex
subprocess env has CODEX_API_KEY: false
$ codex --version
codex-cli 0.146.1
$ codex login status
Logged in using ChatGPT (exit 0)

The SDK's credential code is byte-identical between 0.146.1 and 0.167.0: CODEX_API_KEY is set only from the apiKey option, and the subprocess env is a copy of process.env plus the originator tag.

Test Plan

  • Regression test added: consult/__tests__/bugfix-1880-codex-binary.test.ts (9 tests). Without the fix, 7 of the original 8 fail; the 8th ("never passes apiKey") guards the billing constraint, which was already true. The 9th, added at CMAP, checks that a failed codexPath preflight still discards a stale review file; it fails without the preflight-inside-try move.
    • The version floor resolves the bundled CLI the way the SDK does: 0.146.1 on the shipped 3.3.7 install fails it, 0.167.0 on this branch passes.
  • One existing test updated, not deleted: lane-models.test.ts's "default-model failure is left unannotated" now expects the binary line, and still expects no model provenance.
  • Build passes (porch build check).
  • All tests pass: full codev suite, 7237 passed / 49 skipped.
  • E2E with this branch's built consult, from the worktree:
    • consult -m codex --model-id gpt-6-astra --prompt "Reply with the single word OK." → [CODEX] binary: Codex CLI 0.167.0 bundled with codev … then OK. The released 3.3.7 gives the 400 on the same command.
    • With consult.codexPath = /opt/homebrew/bin/codex → [CODEX] binary: /opt/homebrew/bin/codex, codex-cli 0.167.0 (from \consult.codexPath` in …/.codev/config.local.json)thenOK`.
    • With consult.codexPath set to a path that doesn't exist → exit 1: Cannot run the codex binary … ENOENT … Codev does not fall back to the bundled CLI.

Not done

  • No CODEX_PATH env var: one config surface, and the global ~/.codev/config.json layer already covers "all my projects".
  • The caret still pins the minor on 0.x, so the bundle will lag again as OpenAI ships. consult.codexPath plus the [CODEX] binary: line make that visible and self-serviceable. Bumping the SDK at release time remains a manual step.

CMAP

gemini APPROVE · codex REQUEST_CHANGES → APPROVE (stale-review-file gap, fixed in 84af4e1a0) · claude APPROVE

…t, and allow an override

`consult -m codex --model-id gpt-6-astra` failed with "requires a newer version of
Codex" because the lane runs the Codex CLI bundled inside @openai/codex-sdk, and
`^0.146.0` on a 0.x package pins the minor, so no install could get past 0.146.x.
Upgrading the user's own codex changed nothing, and nothing said which binary ran.

- Bump @openai/codex-sdk to ^0.167.0 (bundled codex-cli 0.167.0). The SDK API change
  is additive; credential handling is byte-identical (CODEX_API_KEY only from apiKey,
  which consult never passes). The widened ModelReasoningEffort union adds max, ultra
  and persistent, which the Spec 1286 exhaustiveness guard requires us to accept.
- Print `[CODEX] binary:` (bundled version, or override path + its --version) on every
  run, and name the binary in every codex-lane error annotation.
- Add consult.codexPath (absolute path, off by default), passed to the SDK as
  codexPathOverride. A path that does not run fails loudly; no fallback to the bundle.
…cycle

A missing or non-executable consult.codexPath threw before the try block, so it
skipped discardStaleOutput and the failure metrics: a review file from an earlier
run could survive and be read as the current result. Found by codex at CMAP.
@waleedkadous

Copy link
Copy Markdown
Contributor Author

Clean and well-scoped, thank you. The bump, the binary-and-version line, the error annotation naming the client, and consult.codexPath with a fail-loud preflight all match what was asked, and the subscription check on the new bundled binary is in the body where it belongs. Both doc trees are updated. One observation, no change needed: ^0.167.0 pins the minor again on a 0.x package, so the bundled CLI will go stale the same way; consult.codexPath is the standing escape and the docs say so. Merge waits on green CI and the owner's word.

@waleedkadous
waleedkadous merged commit 4291dab into main Nov 10, 2026
8 checks passed
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.

consult -m codex: bundled @openai/codex-sdk 0.146.1 rejects gpt-6-astra ("requires a newer version of Codex"); --model-id cannot reach current models

1 participant