[codex] fix chat completions reasoning compatibility#255
Merged
KilimiaoSix merged 1 commit intoMay 21, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes an OpenAI-compatible Chat Completions bridge issue where CodeXManager can successfully proxy a
/v1/chat/completionsrequest through/v1/responsesbut return an apparently empty assistant message to compatible clients such as Hermes.The visible symptom is a successful response with empty
contentwhen the upstream Responses result is reasoning-only. Hermes already understandsreasoningandreasoning_content, but CodeXManager was not mapping Responses reasoning summaries back into those Chat Completions extension fields.Root Cause
The Chat Completions compatibility path rewrites non-native OpenAI-compatible
/v1/chat/completionsrequests to/v1/responses. The request rewrite only preserved caller-provided reasoning fields and did not request reasoning summaries by default. On the way back, the Responses-to-Chat-Completions conversion only extracted normal answer text, tools, and images, sotype: "reasoning"output items and reasoning summary stream events were dropped from the Chat Completions payload.That made reasoning-only upstream results look like empty assistant responses to clients that rely on Chat Completions semantics.
Changes
reasoning: { effort: "medium", summary: "auto" }when the caller did not provide reasoning settings.reasoning_effortwhile addingsummary: "auto".reasoningobjects while adding a missingsummary: "auto".type: "reasoning"output itemssummary[].textchoices[].delta.reasoningandchoices[].delta.reasoning_contentchoices[].message.reasoningandchoices[].message.reasoning_contentcontent, so user-visible answer text is not polluted.Validation
cargo test -p codexmanager-service gateway::http_bridge::testscargo test -p codexmanager-service gateway::local_validation::request::testscargo test -p codexmanager-servicecargo build -p codexmanager-serviceThe branch is based directly on
upstream/mainand contains only this reasoning compatibility fix.