fix: normalize nullable Chat Completions token counts - #5238
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
markstuart-oai
left a comment
There was a problem hiding this comment.
Reviewed the complete diff at d6b52f9. No actionable findings. The two adapters normalize null token counts at their existing usage-conversion boundary, matching streaming while preserving supplied counts, token details, request accounting, and unmodified raw usage. The Runner-level regressions cover each null count, all-null counts, valid counts, and absent usage.
Verified all 23 hosted checks succeeded on this commit. This was a source and hosted-CI review; I did not run local tests.
Summary
This pull request fixes valid non-streaming answers failing when an OpenAI-compatible provider returns null token counts. The OpenAI and AnyLLM Chat Completions adapters now normalize those counts to zero, matching streaming behavior while preserving supplied counts, token details, request accounting, and raw usage.
The change is limited to Chat Completions usage conversion; AnyLLM mapping validation and Responses handling are unchanged.
Test plan
Issue number
Closes #5229
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PR