fix: add GLM-5.2 to models supporting max reasoning effort - #4467
Conversation
GLM-5.2 (Z.ai) natively supports reasoning_effort "max" (alongside "high"), but normalizeOpenAIReasoningEffort() silently downgraded "max" to "high" because GLM-5.2 was not in supportsMaxReasoningEffort(). This is the same normalization gap that previously affected DeepSeek V4 (issue maximhq#4320, PR maximhq#4330). Affected packages: core/providers/openai/ Closes maximhq#4460
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesGLM-5.2 max reasoning effort support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: is911 <archilles92@gmail.com>
Signed-off-by: is911 <archilles92@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@core/changelog.md`:
- Around line 8-9: Remove lines 8-9 from the changelog.md file as these entries
document fixes for ChatAssistantMessageToolCall.extra_content preservation and
Anthropic prompt-cache diagnostics, which are out of scope for this PR focused
on GLM-5.2 support for max reasoning effort. If these changes are part of other
features, they should be committed to their respective feature branches with
their own changelog entries. Additionally, line 8 uses excessive exclamation
marks (3 total) which deviates from standard changelog style — ensure any
retained changelog entries follow consistent punctuation conventions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 401e1cc1-3850-4589-9f21-ef92be3924ab
📒 Files selected for processing (1)
core/changelog.md
fa15f50 to
ca190fc
Compare
Signed-off-by: Akshay Deo <akshay@akshaydeo.com>
…aximhq#4467) GLM-5.2 (Z.ai) natively supports reasoning_effort "max" (alongside "high"), but normalizeOpenAIReasoningEffort() silently downgraded "max" to "high" because GLM-5.2 was not in supportsMaxReasoningEffort(). This is the same normalization gap that previously affected DeepSeek V4 (issue maximhq#4320, PR maximhq#4330). Affected packages: core/providers/openai/ Closes maximhq#4460 Signed-off-by: is911 <archilles92@gmail.com> Signed-off-by: Akshay Deo <akshay@akshaydeo.com> Co-authored-by: Akshay Deo <akshay@akshaydeo.com>
…aximhq#4467) GLM-5.2 (Z.ai) natively supports reasoning_effort "max" (alongside "high"), but normalizeOpenAIReasoningEffort() silently downgraded "max" to "high" because GLM-5.2 was not in supportsMaxReasoningEffort(). This is the same normalization gap that previously affected DeepSeek V4 (issue maximhq#4320, PR maximhq#4330). Affected packages: core/providers/openai/ Closes maximhq#4460 Signed-off-by: is911 <archilles92@gmail.com> Signed-off-by: Akshay Deo <akshay@akshaydeo.com> Co-authored-by: Akshay Deo <akshay@akshaydeo.com>
Description
GLM-5.2 (Z.ai) natively supports
reasoning_effort: "max"alongside"high"(Z.ai docs). However,normalizeOpenAIReasoningEffort()silently downgraded"max"to"high"for GLM-5.2 because it was not listed insupportsMaxReasoningEffort(). This is the same normalization gap that previously affected DeepSeek V4 (#4320, fixed in #4330).Evidence: a direct probe through a Bifrost gateway (v1.5.13) routing to Z.ai GLM-5.2 confirmed that
reasoning_effort: "max"sent to Bifrost was forwarded to Z.ai asreasoning_effort: "high"(verified viaextra_fields.raw_request).Type of Change
Affected Packages
core/providers/openai/Changes Made
core/providers/openai/utils.go: Addedglm-5.2tosupportsMaxReasoningEffort()sonormalizeOpenAIReasoningEffort()returns"max"unchanged for GLM-5.2 models (both bareglm-5.2and provider-prefixedzai/glm-5.2).core/providers/openai/chat_test.go: ExtendedTestToOpenAIChatRequest_NormalizesReasoningEffortandTestOpenAIChatRequest_FilterOpenAISpecificParameters_NormalizesReasoningEffortwith GLM-5.2 test cases (bare and provider-prefixed).core/providers/openai/responses_test.go: ExtendedTestToOpenAIResponsesRequest_NormalizesReasoningEffortwith GLM-5.2 test cases (bare and provider-prefixed).core/changelog.md: Added changelog entry.Testing
All tests pass, including the new GLM-5.2 cases:
preserves max for glm-5.2✓preserves max for provider-prefixed glm-5.2✓Regression cases for existing models remain unchanged:
preserves max for deepseek-v4-pro/flash✓maps max to xhigh for gpt-5.4✓maps max to high for gpt-5.1✓Code formatted with
gofmt. No new lint issues introduced.Checklist
make fmt)go test ./core/providers/openai/...)Related Issues
Closes #4460