fix(codex): honor OAuth contextTokens in native harness#77861
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. As a source-level reproduction, configure Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the revised consistency fix once exact-head checks are green or the unrelated gateway-test failures are resolved outside this PR. Do we have a high-confidence way to reproduce the issue? Yes. As a source-level reproduction, configure Is this the best way to solve the issue? Yes. The PR keeps the public What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c5fcfa1b56e1. |
a129bd6 to
850369b
Compare
850369b to
36e3527
Compare
36e3527 to
c9f158e
Compare
Summary
Fixes #77858.
Native Codex runs use
openai/gpt-*as the model ref, but Codex OAuth runtime context metadata and user overrides live under theopenai-codexprovider. Before this PR, the native harness resolved context limits againstopenai, so an override likemodels.providers.openai-codex.models[].contextTokenscould be ignored and the run would keep the default Codex runtime cap, for example272000.This PR aligns the run and status paths:
contextConfigProviderto effective runtime model resolution.openai/*running on thecodexharness toopenai-codexfor context config lookup./status, so rendered context andagentMeta.contextTokensagree./statuscontext lookup lightweight by using config/cache lookup only, avoiding full model catalog discovery during status rendering.contextTokensin model catalog entries so runtime/catalog consumers and plugin boundary types stay consistent.contextTokensas a cap over known model/runtime windows instead of letting it inflate reporting above the effective model window.Real behavior proof
openai/gpt-5.5withagentRuntime.id: codexshould honor theopenai-codex/gpt-5.5context override instead of staying at the default 272k-ish runtime cap.openclaw 2026.5.4 (325df3e), native Codex route, main agent configured withopenai/gpt-5.5,agentRuntime.id: codex, andmodels.providers.openai-codex.models[].contextTokens: 1000000.openclaw agent --agent main --session-id codex-context-cap-smoke-20260505f --message "/status" --json --timeout 120/statusreportedContext: 0/1.0m, and the response metadata reportedcontextTokens: 1000000, confirming the native Codex run used the Codex OAuth context override while keeping the canonicalopenai/gpt-5.5model ref.Tests