Conversation
Greptile SummaryThis PR fixes the missing Confidence Score: 5/5Safe to merge — all findings are P2 or lower, production logic is correct and well-tested. The core bug fix (disabled thinking not propagated to upstream) is correctly implemented with matching test coverage in both the Anthropic and ZAI transformers. The only finding is a P2 test-quality issue where the ZAI thinking tests assert an inline copy of the logic rather than invoking TransformRequest; this does not affect production behaviour. llm/transformer/zai/thinking_test.go — tests replicate production logic inline instead of calling TransformRequest. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Inbound: thinking.type=disabled"] --> B["inbound_convert.go\nSet TransformerMetadata\nthinking_type=disabled\nReasoningEffort=none"]
B --> C["llm.Request"]
C --> D{"buildBaseRequest\noutbound_convert.go"}
D --> E{"TransformerMetadata\nthinking_type=disabled?"}
E -- yes --> F["req.Thinking =\nThinking{Type:disabled}"]
E -- no --> G{"ReasoningEffort\n== none?"}
G -- yes --> F
G -- no --> H{"ReasoningEffort non-empty\nOR ReasoningBudget set?"}
H -- yes --> I["buildThinking()\nenabled/budget"]
H -- no --> J["No thinking"]
F --> K["Upstream Anthropic API\nthinking: disabled"]
I --> K
J --> K
C --> L{"ZAI outbound.go"}
L --> M{"ReasoningEffort == none?"}
M -- yes --> N["Thinking{Type:disabled}"]
M -- no --> O["Thinking{Type:enabled}"]
Reviews (5): Last reviewed commit: "fix(llm): missing anthropic thinking dis..." | Re-trigger Greptile |
There was a problem hiding this comment.
Devin Review found 1 potential issue.
🐛 1 issue in files not directly in the diff
🐛 Zai outbound transformer enables thinking when ReasoningEffort is "none" (disabled) (llm/transformer/zai/outbound.go:147-151)
The PR introduces ReasoningEffort = "none" in the Anthropic inbound path when thinking: {type: "disabled"} is received (llm/transformer/anthropic/inbound_convert.go:321). However, the Zai outbound transformer at llm/transformer/zai/outbound.go:147 checks if llmReq.ReasoningEffort != "" and unconditionally sets Thinking.Type = "enabled". Since "none" != "", any request that goes through the Anthropic inbound with disabled thinking and then routes to a Zai-backed channel (TypeZai, TypeZhipu, or the newly-added TypeXiaomi) will have thinking incorrectly enabled instead of disabled. The DeepSeek outbound correctly handles this by checking ReasoningEffort == "none" explicitly (llm/transformer/deepseek/outbound.go:109).
View 5 additional findings in Devin Review.
There was a problem hiding this comment.
Code Review
This pull request refactors endpoint management by moving logic to channel_endpoint.go, updates the Xiaomi channel to utilize the zai transformer, and refines credential validation for Codex and Claudecode types. Additionally, it introduces support for a disabled thinking state within Anthropic transformers. Feedback was provided regarding an optimization in the mergeEndpoints function to improve efficiency by avoiding a redundant iteration over user endpoints.
| for _, ep := range userEndpoints { | ||
| if ep.APIFormat == "" { | ||
| continue | ||
| } | ||
|
|
||
| if _, ok := overrides[ep.APIFormat]; !ok { | ||
| continue | ||
| } | ||
|
|
||
| merged = append(merged, ep) | ||
|
|
||
| delete(overrides, ep.APIFormat) | ||
| } |
There was a problem hiding this comment.
The second loop over userEndpoints to append non-overriding endpoints can be made more efficient and concise. After the first loop, the overrides map contains only the user-defined endpoints that are not overrides. You can directly iterate over this map to append the remaining endpoints.
This simplifies the logic and avoids a second full iteration over userEndpoints.
Note: This change might alter the order of the appended non-overriding endpoints, as map iteration order is not guaranteed. If the order is not critical, this is a good simplification.
for _, ep := range overrides {
merged = append(merged, ep)
}b729aa5 to
c0ce718
Compare
Uh oh!
There was an error while loading. Please reload this page.