Repository navigation
fix(go-models): normalize Qwen reasoning families - #15735
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughNormalizeModelFamily tightens qwen3-family detection to exact ChangesThinking extraction & normalization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/entity/models/common_test.go (1)
5-38: ⚡ Quick winAdd tests for nil-input and qwen3-boundary behavior introduced by this PR.
Please add cases for
(nil, &content),(&modelType, nil), and a non-target prefix like"qwen30-foo"to lock in the intended normalization contract and prevent regressions.🤖 Prompt for 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. In `@internal/entity/models/common_test.go` around lines 5 - 38, Add tests to cover nil-input and qwen3-boundary behavior for GetThinkingAndAnswer: add test cases for (nil, &content) and (&modelType, nil) verifying they return expected nil/unchanged behavior, and add a case with a non-target prefix like "qwen30-foo" to ensure it is not normalized to qwen3; reference the existing TestGetThinkingAndAnswerNormalizesQwenModelFamilies and TestGetThinkingAndAnswerLeavesUnknownModelFamiliesUnchanged tests and extend them (or add a new test) to assert the correct pointers/values when modelType is nil, content is nil, and when modelType is "qwen30-foo".
🤖 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 `@internal/entity/models/common.go`:
- Around line 38-40: The current prefix check for modelFamily ("qwen3") is too
broad and can misclassify other families; update the condition in the function
that returns the family (the code using the modelFamily variable) to match only
exact "qwen3" or bounded forms by checking modelFamily == "qwen3" ||
strings.HasPrefix(modelFamily, "qwen3-") || strings.HasPrefix(modelFamily,
"qwen3.") so only exact or hyphen/dot-suffixed variants are classified as qwen3.
---
Nitpick comments:
In `@internal/entity/models/common_test.go`:
- Around line 5-38: Add tests to cover nil-input and qwen3-boundary behavior for
GetThinkingAndAnswer: add test cases for (nil, &content) and (&modelType, nil)
verifying they return expected nil/unchanged behavior, and add a case with a
non-target prefix like "qwen30-foo" to ensure it is not normalized to qwen3;
reference the existing TestGetThinkingAndAnswerNormalizesQwenModelFamilies and
TestGetThinkingAndAnswerLeavesUnknownModelFamiliesUnchanged tests and extend
them (or add a new test) to assert the correct pointers/values when modelType is
nil, content is nil, and when modelType is "qwen30-foo".
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a1019f23-b91e-4fe3-95fa-b634f6de566c
📒 Files selected for processing (2)
internal/entity/models/common.gointernal/entity/models/common_test.go
0038c9b to
5ab5efb
Compare
|
Hi @Haruko386 @JinHai-CN this is ready for review 👍 |
5ab5efb to
3f8e609
Compare
Rebased/fixed merge conflicts, still useful improvements in this PR worth merging. Thanks! |
Haruko386
left a comment
There was a problem hiding this comment.
Hi @oktofeesh1
I just never see this model before, for real.
At least I never saw any model start wit qwen30
I will be happy if you could tell me where i can find it
3f8e609 to
f72431d
Compare
|
Thanks, you are right. I removed those Validation passed with |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15735 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Normalizes Qwen model-family names before reasoning extraction so provider-prefixed Qwen models use the existing
<think>...</think>fallback.What changed
qwen3-*andqwen3.*variants as theqwen3reasoning family.Why
Provider-prefixed models such as
qwen/qwen3-8bandqwen/qwen3.5-4bpreviously did not match the exactqwen3family check, so reasoning content embedded in<think>...</think>stayed in the answer text.Fixes #15611
Validation
go test ./internal/entity/models -run 'TestGetThinkingAndAnswer'go test ./internal/entity/models -run '^$'go vet ./internal/entity/modelsgit diff --checkNotes
go test ./internal/entity/modelsis currently limited by pre-existing API-key validation expectation failures in unrelated model-driver tests.