hermes - ✅(Solved) Fix [Bug]: _CODEX_AUX_MODEL = "gpt-5.2-codex" is the only 5.x model rejected by ChatGPT-account Codex backend, breaking all auxiliary fallback [2 pull requests, 4 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#17533Fetched 2026-04-30 06:47:00
View on GitHub
Comments
4
Participants
2
Timeline
14
Reactions
0
Author
Participants
Timeline (top)
commented ×4labeled ×4cross-referenced ×2closed ×1

agent/auxiliary_client.py:269 hardcodes _CODEX_AUX_MODEL = "gpt-5.2-codex" as the Codex fallback for ChatGPT-account users. As of 2026-04-29 this is the only model in the gpt-5.x family that the ChatGPT-account Codex backend rejects, meaning every auxiliary fallback (compression, vision, title generation, etc.) on a ChatGPT-account install silently fails with HTTP 400 "model is not supported".

Error Message

When a ChatGPT-account user's main model (e.g. `gpt-5.5`) hits a transient network error, the auxiliary fallback in `_try_payment_fallback` reaches the Codex branch, instantiates `CodexAuxiliaryClient(real_client, _CODEX_AUX_MODEL)`, and the call fails with the rejection above. Real-world log: 2026-04-29 21:18:22 INFO Auxiliary compression: connection error on auto — falling back to openai-codex (gpt-5.2-codex) 2026-04-29 21:18:23 WARNING root: Failed to generate context summary: Error code: 400 - {'detail': "The 'gpt-5.2-codex' model is not supported when using Codex with a ChatGPT account."}. Further summary attempts paused for 60 seconds.

Root Cause

agent/auxiliary_client.py:269 hardcodes _CODEX_AUX_MODEL = "gpt-5.2-codex" as the Codex fallback for ChatGPT-account users. As of 2026-04-29 this is the only model in the gpt-5.x family that the ChatGPT-account Codex backend rejects, meaning every auxiliary fallback (compression, vision, title generation, etc.) on a ChatGPT-account install silently fails with HTTP 400 "model is not supported".

Fix Action

Workaround

Local patch `_CODEX_AUX_MODEL = "gpt-5.4"`. Verified working in compression and auxiliary flows.

PR fix notes

PR #17544: Fix Codex auxiliary fallback model drift (gpt-5.2-codexgpt-5.4)

Description (problem / solution / changelog)

What does this PR do?

This PR updates Hermes-Agent’s Codex auxiliary fallback model to a currently supported Codex model so ChatGPT-account users can continue to use auxiliary features (compression, vision extraction, etc.) when payment/credit fallbacks are triggered.

Problem resolved:

  • _CODEX_AUX_MODEL was still pinned to gpt-5.2-codex, which is rejected by ChatGPT-account Codex backends.
  • This caused auxiliary calls routed through _try_payment_fallback to fail with HTTP 400 “model is not supported” and pause retry logic in long sessions.

This update also removes brittle test coupling by asserting against _CODEX_AUX_MODEL instead of hardcoded strings.

Related Issue

Fixes #17533

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • agent/auxiliary_client.py
    • Update _CODEX_AUX_MODEL from "gpt-5.2-codex" to "gpt-5.4".
    • Refresh nearby inline comments describing current Codex fallback model behavior.
    • Keep selection logic intact (_try_codex and auxiliary provider chain unchanged).
  • tests/agent/test_auxiliary_client.py
    • Import _CODEX_AUX_MODEL in tests.
    • Replace hardcoded "gpt-5.2-codex" assertions with _CODEX_AUX_MODEL for resilient assertions.

How to Test

  1. Run focused tests:
    • scripts/run_tests.sh tests/agent/test_auxiliary_client.py -k codex
  2. Add temporary logging/trace in a ChatGPT-account Codex environment and trigger an auxiliary fallback path (for example: force payment-fallback path and call compression/vision auxiliary task).
  3. Confirm no "model is not supported" errors for Codex auxiliary calls and that fallback returns a successful response.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: <!-- e.g. Ubuntu 24.04, macOS 15.2, Windows 11 -->

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

  • Please include auxiliary fallback logs showing successful Codex responses with gpt-5.4 if CI/manual verification is run in a ChatGPT-account Codex environment.

Changed files

  • agent/auxiliary_client.py (modified, +5/-6)
  • tests/agent/test_auxiliary_client.py (modified, +12/-11)

PR #17765: fix(aux): remove hardcoded Codex fallback model, drop Codex from auto chain

Description (problem / solution / changelog)

Summary

Deletes _CODEX_AUX_MODEL and removes _try_codex from the auxiliary fallback chain. Codex-OAuth is no longer a second-order fallback that guesses a model ID — if the user's main provider fails, the chain tries OpenRouter / Nous / custom / api-key and stops, instead of rolling through a hardcoded Codex model that OpenAI silently rotates out of its ChatGPT-account allow-list.

Closes #17533. Supersedes #17544 (which reset the stale-constant clock rather than removing it).

Why not the one-line constant bump (#17544)

That constant has already drifted twice in 6 weeks:

DateValueStatus
pre-Mar 2026gpt-5.3-codexrejected by ChatGPT-account Codex
735a6e76 (Mar 2026)gpt-5.2-codexworked briefly
#17533 (Apr 29 2026)gpt-5.2-codexrejected; only gpt-5.x model that's rejected per @pokibao's test matrix
#17544 proposalgpt-5.4works today, will drift again

ChatGPT-account Codex allow-list is undocumented and OpenAI publishes no changelog. Any pinned default rots — the question is just "how soon."

Changes

FileChange
agent/auxiliary_client.pyDelete _CODEX_AUX_MODEL; rename _try_codex -> _build_codex_client(model) requiring explicit model; drop Codex from _get_provider_chain (5 rungs -> 4); drop Codex from provider=custom fallback ladder; route _resolve_strict_vision_backend("openai-codex") through resolve_provider_client so caller's model is honored; update module docstring
tests/agent/test_auxiliary_client.pyUpdate chain-length test (4 entries, asserts Codex is NOT in chain); replace test_skips_to_codex_when_or_and_nous_fail with test_codex_not_in_fallback_chain; update _try_codex -> _build_codex_client tests; refresh test model strings gpt-5.2-codex -> gpt-5.4
tests/agent/test_codex_cloudflare_headers.py_try_codex -> _build_codex_client("gpt-5.4"); raw_codex test now passes explicit model=
tests/run_agent/test_provider_parity.pytest_codex_fallback_last_resort -> test_codex_not_in_auto_fallback (inverted assertion — verifies (None, None) is returned)

Behavior

User setupBeforeAfter
main=openai-codex, any modelUses user's configured model via Step 1Unchanged
main=openrouter, has codex auth, OR has payment errorFallback chain hits Codex, tries gpt-5.2-codex, fails with "not supported"Fallback chain stops at api-key; 60s pause with cleaner logs
auxiliary.<task>.provider: openai-codex with model setWorks (user specifies model)Unchanged
auxiliary.<task>.provider: openai-codex with NO modelSilently uses gpt-5.2-codexWarns "pass model explicitly" and returns None

Validation

tests/agent/                                 2220 passed
tests/run_agent/test_provider_parity.py       113 passed
tests/run_agent/test_provider_fallback.py       9 passed
tests/run_agent/test_compressor_fallback_update.py   passed
E2E: removed symbols gone                    PASS
E2E: chain is 4 rungs, no openai-codex       PASS
E2E: payment fallback returns (None, None)   PASS
E2E: Step 1 Codex-main user path unaffected  PASS (gpt-5.4, gpt-5.5 both honored)
E2E: explicit model=None warns, returns None PASS

Credit: @pokibao (#17533) for the test matrix + root-cause analysis, @afurm (#17544) for the constant-bump proposal that surfaced this as worth a proper fix.

Changed files

  • agent/auxiliary_client.py (modified, +65/-26)
  • tests/agent/test_auxiliary_client.py (modified, +39/-25)
  • tests/agent/test_codex_cloudflare_headers.py (modified, +7/-6)
  • tests/run_agent/test_provider_parity.py (modified, +12/-4)
RAW_BUFFERClick to expand / collapse

Summary

agent/auxiliary_client.py:269 hardcodes _CODEX_AUX_MODEL = "gpt-5.2-codex" as the Codex fallback for ChatGPT-account users. As of 2026-04-29 this is the only model in the gpt-5.x family that the ChatGPT-account Codex backend rejects, meaning every auxiliary fallback (compression, vision, title generation, etc.) on a ChatGPT-account install silently fails with HTTP 400 "model is not supported".

Reproduction

  • hermes-agent commit: a1921c43 (current main)
  • Account type: ChatGPT subscription Codex auth (`~/.hermes/auth.json`)
  • Verified on two independent installs (MBA + Mac mini), same ChatGPT account

I tested every gpt-5.x model directly against `https://chatgpt.com/backend-api/codex/responses\` with the same OAuth token + `originator: codex_cli_rs` headers Hermes uses:

ModelResult
`gpt-5.5`400 "Instructions are required" → accepted, just missing my body field
`gpt-5.4`400 "Instructions are required" → accepted
`gpt-5.4-mini`400 "Instructions are required" → accepted
`gpt-5.3-codex`400 "Instructions are required" → accepted
`gpt-5.2-codex`400 "The 'gpt-5.2-codex' model is not supported when using Codex with a ChatGPT account."
`gpt-5`400 "model is not supported" (rejected, but unused as fallback anyway)

So `_CODEX_AUX_MODEL = "gpt-5.2-codex"` is the worst possible choice — it is the only rejected option among supported alternatives.

Observed user impact

When a ChatGPT-account user's main model (e.g. `gpt-5.5`) hits a transient network error, the auxiliary fallback in `_try_payment_fallback` reaches the Codex branch, instantiates `CodexAuxiliaryClient(real_client, _CODEX_AUX_MODEL)`, and the call fails with the rejection above. Real-world log:

``` 2026-04-29 21:18:22 INFO Auxiliary compression: connection error on auto — falling back to openai-codex (gpt-5.2-codex) 2026-04-29 21:18:23 WARNING root: Failed to generate context summary: Error code: 400 - {'detail': "The 'gpt-5.2-codex' model is not supported when using Codex with a ChatGPT account."}. Further summary attempts paused for 60 seconds. ```

The 60s pause repeats each compression cycle, degrading long sessions on Telegram / web UI.

Inline comment in source is also out of date

`auxiliary_client.py:264-268` says:

ChatGPT-backed Codex accounts currently reject gpt-5.3-codex for these auxiliary flows, while gpt-5.2-codex remains broadly available

Per the test table above the situation has reversed: 5.3-codex is accepted today, 5.2-codex is rejected.

Proposed fix

Short-term: change the hardcoded constant to a model that is currently accepted, e.g.

```python _CODEX_AUX_MODEL = "gpt-5.4" # or "gpt-5.3-codex" ```

Long-term: probe-and-cache the accepted model list once per install via the Codex auth, similar in spirit to #16173 for main models. A static constant for an externally-controlled model list will keep going stale.

Workaround

Local patch `_CODEX_AUX_MODEL = "gpt-5.4"`. Verified working in compression and auxiliary flows.

Why some installs don't hit this

Mac mini install with default `_CODEX_AUX_MODEL = "gpt-5.2-codex"` shows zero "model not supported" errors despite the same Codex backend rejection. Reason: that install runs short cron tasks only — it never triggers compression and never reaches `_try_payment_fallback`. The bug is real on every ChatGPT-account install but only surfaces under long-session usage that triggers auxiliary fallback. Worth flagging in case other users see "works for me" without realizing they just don't trigger the path.

Environment

  • macOS 25.4.0 (Darwin)
  • Python 3.11.15
  • hermes-agent commit `a1921c43`
  • Codex auth: ChatGPT subscription

extent analysis

TL;DR

Change the hardcoded _CODEX_AUX_MODEL constant to a currently accepted model, such as "gpt-5.4" or "gpt-5.3-codex", to resolve the auxiliary fallback issue for ChatGPT-account users.

Guidance

  • Update the _CODEX_AUX_MODEL constant in auxiliary_client.py to a supported model, as shown in the proposed fix.
  • Verify the change by testing auxiliary fallbacks, such as compression, and checking for successful responses.
  • Consider implementing a long-term solution to probe and cache the accepted model list via Codex auth to prevent similar issues in the future.
  • Be aware that some installs may not exhibit the issue due to differences in usage patterns, but the bug is present on all ChatGPT-account installs.

Example

_CODEX_AUX_MODEL = "gpt-5.4"  # or "gpt-5.3-codex"

Notes

The current hardcoded model, "gpt-5.2-codex", is the only rejected option among supported alternatives, causing auxiliary fallbacks to fail with a 400 error.

Recommendation

Apply the workaround by changing the _CODEX_AUX_MODEL constant to a supported model, such as "gpt-5.4", to immediately resolve the issue. This change will allow auxiliary fallbacks to succeed, improving the overall user experience.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: _CODEX_AUX_MODEL = "gpt-5.2-codex" is the only 5.x model rejected by ChatGPT-account Codex backend, breaking all auxiliary fallback [2 pull requests, 4 comments, 2 participants]