Skip to content

Fix gpt-5.4 context length resolution for Codex#5174

Open
zaycruz wants to merge 1 commit into
NousResearch:mainfrom
zaycruz:fix/gpt54-context-window
Open

Fix gpt-5.4 context length resolution for Codex#5174
zaycruz wants to merge 1 commit into
NousResearch:mainfrom
zaycruz:fix/gpt54-context-window

Conversation

@zaycruz

@zaycruz zaycruz commented Apr 5, 2026

Copy link
Copy Markdown

Summary

  • map openai-codex and inferred OpenAI endpoints to the models.dev openai registry
  • ignore suspicious small cached context values for OpenAI/Codex models when provider-aware metadata says the true context is much larger
  • add regression tests for the stale gpt-5.4@https://chatgpt.com/backend-api/codex = 32000 cache case

Problem

Hermes can show gpt-5.4 with a 32k context window in Codex-backed setups.

I reproduced a bad persisted cache entry locally:
gpt-5.4@https://chatgpt.com/backend-api/codex: 32000

OpenAI's current model docs list gpt-5.4 at 1,050,000 context and 128,000 max output tokens, so the cached 32000 value is incorrect.

Testing

  • pytest -q -o addopts='' tests/agent/test_models_dev.py tests/agent/test_model_metadata.py

@zaycruz zaycruz marked this pull request as ready for review April 5, 2026 19:27
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder provider/openai OpenAI / Codex Responses API labels May 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Fixes #5173 — stale gpt-5.4 context cache entry. Related to merged #15661 and #14935 (similar Codex context resolution bugs).

1 similar comment
@alt-glitch

Copy link
Copy Markdown
Collaborator

Fixes #5173 — stale gpt-5.4 context cache entry. Related to merged #15661 and #14935 (similar Codex context resolution bugs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder 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.

2 participants