Skip to content

[BUG] OpenAiHandler doesn't support reasoning field for OpenAI-compatible providers #11495

@R-omk

Description

@R-omk

Problem (one or two sentences)

OpenAiHandler only checks for reasoning_content field in responses (both streaming and non-streaming), but some OpenAI-compatible providers return reasoning in the reasoning field instead (following OpenAI's recommendations). This causes reasoning/thinking content to not be displayed when using these providers.

Context (who is affected and when)

Who is affected:

  • Users using OpenAI-compatible providers that return reasoning in the reasoning field
  • Users using vLLM versions after 0.15.1 (which removed reasoning_content field)
  • Anyone using models that return reasoning in the reasoning field instead of reasoning_content

When this happens:

  • When streaming responses from OpenAI-compatible providers that use reasoning field
  • When using any provider that returns reasoning instead of reasoning_content

Background:
OpenAI recommends using the reasoning field for chain-of-thought content in Chat Completions API. Some providers (like vLLM) have transitioned from reasoning_content to reasoning to align with these recommendations. vLLM project RFC #27755 documents this transition.

Reproduction steps

  1. Set up an OpenAI-compatible provider that returns reasoning in the reasoning field (e.g., vLLM after version 0.15.1 )
  2. Configure Roo Code to use the provider:
    {
      "apiProvider": "openai",
      "openAiBaseUrl": "http://your-vllm-server:port/v1",
      "openAiModelId": "your-model  like  glm 4.7 or minimax 2.5"
    }
  3. Send a message to a reasoning-capable model
  4. Observe that the "Thinking" section does not appear in the UI

Expected result

The "Thinking" section should display the reasoning content from the reasoning field, just as it does with the reasoning_content field.

Actual result

The "Thinking" section does not appear at all. The reasoning content is silently ignored because OpenAiHandler only checks for reasoning_content field, not reasoning. This affects both streaming and non-streaming responses.

Variations tried (optional)

No response

App Version

v3.47.3

API Provider (optional)

OpenAI Compatible

Model Used (optional)

glm 4.7

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions