Conversation
Greptile SummaryThis PR fixes a bug where the auto-reasoning-effort middleware incorrectly parsed Qwen model names ending in
Confidence Score: 4/5Safe to merge — the change is a narrowly scoped guard that only activates for Qwen model names ending in The fix is correct and well-tested for the reported cases. The only notable issue is a redundant No files require special attention; both changed files are straightforward and the logic is easy to follow. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[OnInboundLlmRequest] --> B{AutoReasoningEffort\nenabled?}
B -- No --> Z[Return request unchanged]
B -- Yes --> C[splitAutoReasoningEffortModel]
C --> D{last dash exists\n& not trailing?}
D -- No --> Z
D -- Yes --> E{effort in\nsupportedEfforts?}
E -- No --> Z
E -- Yes --> F{effort == max &&\nisQwenMaxModel?}
F -- Yes --> Z
F -- No --> G{base model\nnot empty?}
G -- No --> Z
G -- Yes --> H[Set Model = base\nSet ReasoningEffort = effort]
H --> I[Return modified request]
subgraph isQwenMaxModel
J[Lowercase + trim full string] --> K[Strip namespace prefix\nafter last slash]
K --> L{HasPrefix qwen?}
L -- Yes --> M[return true]
L -- No --> N[return false]
end
Reviews (1): Last reviewed commit: "fix: auto reasoning effort for qwen max,..." | Re-trigger Greptile |
| func isQwenMaxModel(model string) bool { | ||
| normalized := strings.ToLower(strings.TrimSpace(model)) | ||
| if !strings.HasSuffix(normalized, "-max") { | ||
| return false | ||
| } | ||
|
|
||
| if lastSlash := strings.LastIndex(normalized, "/"); lastSlash >= 0 { | ||
| normalized = normalized[lastSlash+1:] | ||
| } | ||
|
|
||
| return strings.HasPrefix(normalized, "qwen") | ||
| } |
There was a problem hiding this comment.
The
HasSuffix(normalized, "-max") check is always true at this point: isQwenMaxModel is only called when effort == "max", which was extracted from the last --delimited segment, meaning the original (and lowercased) model string already ends with -max. The guard can be dropped without changing behaviour.
| func isQwenMaxModel(model string) bool { | |
| normalized := strings.ToLower(strings.TrimSpace(model)) | |
| if !strings.HasSuffix(normalized, "-max") { | |
| return false | |
| } | |
| if lastSlash := strings.LastIndex(normalized, "/"); lastSlash >= 0 { | |
| normalized = normalized[lastSlash+1:] | |
| } | |
| return strings.HasPrefix(normalized, "qwen") | |
| } | |
| func isQwenMaxModel(model string) bool { | |
| normalized := strings.ToLower(strings.TrimSpace(model)) | |
| if lastSlash := strings.LastIndex(normalized, "/"); lastSlash >= 0 { | |
| normalized = normalized[lastSlash+1:] | |
| } | |
| return strings.HasPrefix(normalized, "qwen") | |
| } |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Uh oh!
There was an error while loading. Please reload this page.