Skip to content

fix(model_switch): use live API discovery for openai-codex in gateway/Telegram picker#17320

Closed
DRuiCHEN wants to merge 1 commit into
NousResearch:mainfrom
DRuiCHEN:fix/openai-codex-telegram-model-list
Closed

fix(model_switch): use live API discovery for openai-codex in gateway/Telegram picker#17320
DRuiCHEN wants to merge 1 commit into
NousResearch:mainfrom
DRuiCHEN:fix/openai-codex-telegram-model-list

Conversation

@DRuiCHEN

Copy link
Copy Markdown

Problem

Models available to a user's OpenAI Codex account (e.g. gpt-5.5) appear in the CLI model picker but not in the Telegram/gateway picker.

Root Cause

list_authenticated_providers() — used by the gateway/Telegram model picker — falls through to the static curated list for openai-codex:

# model_switch.py (before)
if hermes_slug in {"copilot", "copilot-acp"}:
    model_ids = provider_model_ids(hermes_slug)
else:
    model_ids = curated.get(hermes_slug, [])  # ← openai-codex lands here

The CLI path calls provider_model_ids("openai-codex") which performs a live OAuth-authenticated fetch via get_codex_model_ids(access_token=...), so new models appear there immediately. The gateway never makes that call.

The comment in models.py line ~1903 even states the intention:

"Pass the live OAuth access token so the picker matches whatever ChatGPT lists for this account right now"

…but this was only wired up for the CLI path.

Fix

Add "openai-codex" to the set of providers that use provider_model_ids() for live discovery — consistent with how copilot and copilot-acp are already handled:

if hermes_slug in {"copilot", "copilot-acp", "openai-codex"}:
    model_ids = provider_model_ids(hermes_slug)

provider_model_ids("openai-codex") already falls back to the hardcoded catalog if no token is available or the endpoint is unreachable, so this is safe.

Testing

  • With a Codex account that has access to gpt-5.5: confirm the model appears in the Telegram picker after this change
  • With no Codex credentials: confirm the static fallback list is still returned

`list_authenticated_providers()` (used by the Telegram/gateway model
picker) was falling through to the static curated list for openai-codex,
while the CLI path called `provider_model_ids("openai-codex")` which
does a live OAuth-authenticated fetch via `get_codex_model_ids`.

This caused models available to the user's account (e.g. gpt-5.5) to
appear in the CLI picker but not in Telegram.

Fix: add "openai-codex" to the set of providers that call
`provider_model_ids()` for live discovery, consistent with how copilot
and copilot-acp are already handled. The underlying `provider_model_ids`
implementation already falls back to the hardcoded catalog if no token
is available or the endpoint is unreachable.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard provider/openai OpenAI / Codex Responses API labels Apr 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #7211 — same fix: wire openai-codex into live model discovery for the gateway/Telegram picker.

@DRuiCHEN

DRuiCHEN commented May 1, 2026

Copy link
Copy Markdown
Author

To clarify the duplicate concern: our change is correct and intentional.

provider_model_ids() already has a full openai-codex branch in models.py (line 1898–1913) — it resolves the live OAuth access token and calls get_codex_model_ids(), with a clean fallback to the static catalog if the token or endpoint is unavailable. The CLI picker calls this path. Our one-line change simply makes the gateway/Telegram picker call the same function, closing the parity gap.

Regarding #7211: it takes a broader approach (new abstraction layer, 128 lines, new test file) which is a reasonable long-term refactor. However, it has been open for 19 days without forward progress. This fix is self-contained and risk-free — the fallback behavior means no regression if the live endpoint is unreachable. Happy to close in favour of #7211 if that PR is actively moving toward merge, but if it is stalled, merging this one-liner now would unblock users immediately.

@teknium1

Copy link
Copy Markdown
Contributor

Closing as already fixed on main.

Triage notes (high confidence):
On origin/main hermes_cli/model_switch.py:1349 already reads if hermes_slug in {"openai-codex", "copilot", "copilot-acp"} — openai-codex live discovery is exactly the change this PR proposes.

If you still see this on the latest version, please reopen with reproduction steps.

(Bulk-closed during a CLI triage sweep.)

@teknium1 teknium1 closed this May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants