Skip to content

chore(llm): change openai default reasoning_field to content#1656

Merged
looplj merged 1 commit into
unstablefrom
dev-tmp
May 13, 2026
Merged

chore(llm): change openai default reasoning_field to content#1656
looplj merged 1 commit into
unstablefrom
dev-tmp

Conversation

@looplj

@looplj looplj commented May 13, 2026

Copy link
Copy Markdown
Owner

No description provided.

@greptile-apps

greptile-apps Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR changes the default ReasoningField in the OpenAI outbound transformer from ReasoningFieldNone (strip all reasoning) to ReasoningFieldContent (preserve reasoning_content), fixing a regression for providers like Mimo that require the field echoed back in assistant messages (issue #1654). The test covering the old default behavior is replaced with a proper end-to-end test via TransformRequest that verifies the new default.

  • Default changed in outbound.go: When config.ReasoningField is empty, reasoningField now resolves to ReasoningFieldContent instead of ReasoningFieldNone; channels wanting to strip reasoning must now set ReasoningFieldNone explicitly.
  • Test updated in outbound_reasoning_test.go: TestRequestFromLLM_DefaultNone is replaced by TestOutboundTransformer_TransformRequest_DefaultReasoningFieldContent, which constructs a full OutboundTransformer without a ReasoningField config and exercises the new default through TransformRequest.

Confidence Score: 4/5

The default change is intentional and well-documented, but it is a breaking behavioral change for any channel using Fireworks or bailian without an explicit reasoning_field: none config.

The new test uses assert.NoError where require.NoError is needed — if TransformRequest returns an error, req is nil and req.Body immediately panics, masking the root failure message.

llm/transformer/openai/outbound_reasoning_test.go — the assert.NoError / require.NoError mismatch at lines 262 and 266

Important Files Changed

Filename Overview
llm/transformer/openai/outbound.go Changes default ReasoningField from ReasoningFieldNone to ReasoningFieldContent and updates the doc comment; the behavioral intent is clearly explained in the code comment referencing issue #1654.
llm/transformer/openai/outbound_reasoning_test.go Replaces the stale DefaultNone test with a new end-to-end test via TransformRequest that correctly exercises the new default, but uses assert.NoError instead of require.NoError, which would panic rather than fail cleanly if TransformRequest errors.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[TransformRequest called] --> B{config.ReasoningField == empty?}
    B -- "Yes (before PR)" --> C[reasoningField = ReasoningFieldNone\nstrip all reasoning fields]
    B -- "Yes (after PR)" --> D[reasoningField = ReasoningFieldContent\npreserve reasoning_content]
    B -- No --> E[reasoningField = config.ReasoningField]
    C --> F[RequestFromLLM with ReasoningFieldNone\nFireworks / bailian safe]
    D --> G[RequestFromLLM with ReasoningFieldContent\nMimo / DeepSeek / Gemini safe]
    E --> H{Which field?}
    H -- ReasoningFieldContent --> G
    H -- ReasoningFieldReasoning --> I[RequestFromLLM with ReasoningFieldReasoning\nNanoGPT / OpenRouter]
    H -- ReasoningFieldNone --> F
    H -- ReasoningFieldAll --> J[RequestFromLLM with ReasoningFieldAll\nboth fields preserved]
Loading

Reviews (2): Last reviewed commit: "chore(llm): change openai default reason..." | Re-trigger Greptile

Comment thread llm/transformer/openai/outbound.go

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the OpenAI outbound transformer to change the default reasoning field from ReasoningFieldNone to ReasoningFieldContent. This change ensures compatibility with providers like Mimo that require reasoning content to be echoed back in assistant messages. The documentation was also updated to reflect this new default and include Mimo in the list of supported providers. Feedback was provided to include 'OpenAI o-series' in the documentation for consistency with other comments in the codebase.

// ReasoningField specifies which reasoning field to use in outbound messages.
// Use ReasoningFieldContent for DeepSeek/Gemini, ReasoningFieldReasoning for NanoGPT/OpenRouter,
// or ReasoningFieldNone (default) to strip all reasoning fields.
// Use ReasoningFieldContent (default) for DeepSeek/Mimo/Gemini, ReasoningFieldReasoning for NanoGPT/OpenRouter,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the more detailed comment added in TransformRequest, it would be beneficial to also include OpenAI o-series in this list of providers that use ReasoningFieldContent.

Suggested change
// Use ReasoningFieldContent (default) for DeepSeek/Mimo/Gemini, ReasoningFieldReasoning for NanoGPT/OpenRouter,
// Use ReasoningFieldContent (default) for OpenAI o-series/DeepSeek/Mimo/Gemini, ReasoningFieldReasoning for NanoGPT/OpenRouter,

Comment on lines 252 to +266
@@ -246,14 +258,17 @@ func TestRequestFromLLM_DefaultNone(t *testing.T) {
Reasoning: lo.ToPtr("Another reasoning"),
},
},
}
})
assert.NoError(t, err)

req := RequestFromLLM(llmReq, ReasoningFieldNone)
var oaiReq Request
err = json.Unmarshal(req.Body, &oaiReq)
assert.NoError(t, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Use require.NoError for both error checks so the test stops immediately with the real failure message instead of panicking on req.Body when the first call errors.

Suggested change
req, err := transformer.TransformRequest(t.Context(), &llm.Request{
Model: "test-model",
Messages: []llm.Message{
{
Role: "assistant",
ReasoningContent: &reasoningText,
Reasoning: lo.ToPtr("Another reasoning"),
},
},
})
require.NoError(t, err)
var oaiReq Request
err = json.Unmarshal(req.Body, &oaiReq)
require.NoError(t, err)

@looplj looplj merged commit 8a9666a into unstable May 13, 2026
4 checks passed
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.

1 participant