Skip to content

fix: decode OpenRouter reasoning in chat responses - #206

Open
jihtsan wants to merge 1 commit into
jamesrochabrun:mainfrom
jihtsan:codex/168-decode-openrouter-reasoning
Open

jihtsan wants to merge 1 commit into
jamesrochabrun:mainfrom
jihtsan:codex/168-decode-openrouter-reasoning

Conversation

@jihtsan

@jihtsan jihtsan commented Nov 5, 2026

Copy link
Copy Markdown

Decode OpenRouter's reasoning response field into the existing reasoningContent property for streamed deltas and nonstreaming chat messages. Keep reasoning_content precedence when both keys are present, including empty strings, and preserve the other response fields and synthesized memberwise initializers. Closes #168.

This handles the documented Chat Completions reasoning field; it does not change provider request settings. Related #175 changes request parameters/audio and leaves these response models unchanged.

Validation on macOS arm64 / Swift 6.4:

  • Both OpenRouter response fixtures fail before the fix (reasoningContent == nil), then pass.
  • Seven regression tests cover stream/nonstream text, legacy precedence, null/missing/empty values, UTF-8, existing tool/refusal/audio fields and invalid types.
  • swift test --disable-automatic-resolution: 116 XCTest tests passed, 0 failures.
  • swiftformat --lint --config rules.swiftformat <three changed files>: 0 files need formatting; git diff --check: passed.
  • Independent Standards and Spec reviews: no findings, tied to this commit's source blobs.

No live OpenRouter/Gemini call was made; these fixtures verify decoding of reasoning when the provider returns it. iOS/Linux/Windows were not run locally.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T06:39:03.737858Z 6971e17 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reasoning does not work on OpenRouter

1 participant