Skip to content

feat(codex): present authentic codex CLI version/identity - #50038

Draft
arminanton wants to merge 1 commit into
NousResearch:mainfrom
arminanton:feat/codex-cli-identity
Draft

feat(codex): present authentic codex CLI version/identity#50038
arminanton wants to merge 1 commit into
NousResearch:mainfrom
arminanton:feat/codex-cli-identity

Conversation

@arminanton

Copy link
Copy Markdown
Contributor

Adds agent/codex_version.py (get_codex_cli_version() — resolves the real Codex CLI version, cached) and uses it across the Codex paths: the models-catalog URL (hermes_cli/codex_models.py), the app-server initialize() handshake identity (codex_app_server.py / _session.py), and a maxxhigh effort clamp for the Codex Responses API (transports/codex.py, since max is Anthropic-only and 400s on Codex). Scoped to Codex identity/version; the codex-responses normalization tests are already upstream so that test file was intentionally excluded. Draft for review.

@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard codex P3 Low — cosmetic, nice to have labels Jun 21, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for targeting the Codex identity drift. The issue is still present, but this draft needs rework against current main.

Problems

  • agent/transports/codex.py:133 maps max to xhigh, but current main preserves max and maps GPT-5.6 Codex ultra to max (agent/transports/codex.py:166-173, commit 7550c594ce18d7d100014c2120112576efb03c26).
  • The current primary request identity remains codex_cli_rs/0.0.0 in agent/auxiliary_client.py:675-696, and the context-window /models probe remains at client_version=1.0.0 in agent/model_metadata.py:1878-1884; neither is changed here.
  • The resolver selects a cached/latest release rather than the installed executable version (agent/codex_version.py:139-154), although agent/transports/codex_app_server.py:382-413 already parses codex --version.
  • Defaulting experimentalApi on at agent/transports/codex_app_server.py:176 conflicts with the current deliberate avoidance documented in agent/transports/codex_app_server_session.py:255-269.

Suggested changes

  • Preserve current max/ultra transport semantics and cover them with tests.
  • Centralize authentic version resolution from the configured Codex executable, then wire all current /models and Cloudflare-header paths.
  • Keep experimental app-server capabilities opt-in unless a tested required behavior justifies them.

Automated hermes-sweeper review.

Comment thread agent/transports/codex.py Outdated
# invalid_value, which (e.g. on a Codex fallback from an Anthropic
# primary configured with effort=max) kills the request. "minimal"
# is mapped to "low" for older deployments that reject it.
_effort_clamp = {"minimal": "low", "max": "xhigh"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Current main intentionally preserves max: 7550c594ce18d7d100014c2120112576efb03c26 maps GPT-5.6 Codex tier ultra to Responses wire value max in this same clamp. Do not rewrite max to xhigh; retain the current contract and add a regression test.

Comment thread agent/codex_version.py Outdated
_memo = (now, cached)
return cached

fetched = _fetch_github_release()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This returns the latest GitHub release, not the version of the configured local Codex executable. Current agent/transports/codex_app_server.py:382-413 already runs codex --version and parses it; use that source if the identity must be authentic.

Comment thread agent/transports/codex_app_server.py Outdated
# round-trip that some app-server builds gate optional features on.
# Callers can still override either by passing `capabilities=`.
default_caps = {
"experimentalApi": True,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please do not enable this experimental capability by default. Current CodexAppServerSession.ensure_started() explicitly avoids the experimental permissions path because it requires a matching Codex permissions table (agent/transports/codex_app_server_session.py:255-269); no tested consumer here requires this change.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
@arminanton
arminanton force-pushed the feat/codex-cli-identity branch from cf14b57 to d4994c9 Compare August 22, 2026 21:39
@arminanton

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and reconciled with the reasoning-effort mapping that has since landed there.

Did not regress the effort mapping (sweeper): dropped the PR's hand-map (maxxhigh) entirely and kept main's current routing (which preserves max on GPT-5.6 Codex and clamps ultramax). git diff origin/main -- agent/transports/codex.py is now empty. Added a TestCodexReasoningEffortClamp regression asserting maxmax (5.6), ultramax (5.6), maxxhigh (legacy), and pass-through.

Identity applied consistently (sweeper): the authentic Codex CLI version now flows from a single resolver (agent/codex_version.py, which reads the installed codex --version with an env override + pinned fallback) into both the primary request identity (auxiliary_client.py User-Agent, was codex_cli_rs/0.0.0) and the /models context-window probe (model_metadata.py, was client_version=1.0.0), plus codex_models.py. main's ChatGPT-Account-Id header handling is preserved.

Also removed the experimentalApi default caps (opt-in only). Tests across codex_version / transport / cloudflare-headers / reasoning-effort / app-server-session / codex-models / model_metadata → 287 passed.

Resolve the installed codex CLI version (agent/codex_version.py) from the
configured executable via `codex --version` (reusing parse_codex_version),
with a HERMES_CODEX_CLI_VERSION override and a pinned fallback, memoized
per binary. Wire it consistently across all three Codex identity surfaces:
the Cloudflare User-Agent in agent/auxiliary_client.py (was codex_cli_rs/
0.0.0), the /models probe in agent/model_metadata.py (was client_version=
1.0.0), and hermes_cli/codex_models.py, plus the app-server initialize
handshake.

Reconciled with current main:
- Do NOT touch reasoning-effort mapping: main routes through
  clamp_effort()/codex_supported_efforts() (preserves `max`, clamps
  `ultra`->`max`); the old draft's max->xhigh hand-map is dropped.
- Keep experimental app-server capabilities opt-in (no experimentalApi
  default) per codex_app_server_session's deliberate avoidance.

Tests: new tests/agent/test_codex_version.py (resolver + identity wiring),
reasoning-effort regression in test_codex_transport.py.
@arminanton
arminanton force-pushed the feat/codex-cli-identity branch from d4994c9 to 797741e Compare August 23, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants