Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion dto/gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,38 @@ type GeminiThinkingConfig struct {
IncludeThoughts bool `json:"includeThoughts,omitempty"`
ThinkingBudget *int `json:"thinkingBudget,omitempty"`
// TODO Conflict with thinkingbudget.
// ThinkingLevel json.RawMessage `json:"thinkingLevel,omitempty"`
ThinkingLevel json.RawMessage `json:"thinkingLevel,omitempty"`
Comment on lines 144 to +145

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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Clarify or resolve the TODO comment.

The TODO comment mentions a "conflict with thinkingbudget" but doesn't explain what the conflict is or how it should be resolved. Since you're exposing the ThinkingLevel field in this PR, please clarify:

  • What is the nature of the conflict?
  • Are both fields meant to coexist?
  • Should this TODO be addressed before merging?

Can you provide more context about this conflict and whether it impacts the functionality?



---

🏁 Script executed:

```shell
#!/bin/bash
# Examine the file structure and context around the TODO comment
echo "=== Lines 140-180 of dto/gemini.go ==="
sed -n '140,180p' dto/gemini.go

echo -e "\n=== Search for 'Thinking' field references ==="
rg -n -i 'thinking' dto/gemini.go | head -20

Length of output: 2231


🏁 Script executed:

#!/bin/bash
# Search for ThinkingBudget field definition
echo "=== All 'ThinkingBudget' occurrences ==="
rg -n 'ThinkingBudget' dto/gemini.go

echo -e "\n=== All 'thinking_budget' occurrences ==="
rg -n 'thinking_budget' dto/gemini.go

Length of output: 488


🏁 Script executed:

#!/bin/bash
# Check the GeminiThinkingConfig struct definition
echo "=== GeminiThinkingConfig struct ==="
ast-grep --pattern 'type GeminiThinkingConfig struct { $$$ }'

Length of output: 396


🏁 Script executed:

#!/bin/bash
# Search for TODO comments in the file to understand context
echo "=== All TODO comments in dto/gemini.go ==="
rg -n 'TODO' dto/gemini.go

Length of output: 85


Clarify the TODO comment on line 144.

The TODO "Conflict with thinkingbudget" is vague and creates ambiguity about whether ThinkingLevel is safe to use. The UnmarshalJSON method shows both fields are intentionally supported, but the comment doesn't explain:

  • What the conflict is
  • Whether it's already resolved
  • Any limitations or considerations for this field

Either resolve the conflict or replace the TODO with a clear comment explaining the design decision and how both fields coexist.

🤖 Prompt for AI Agents
In dto/gemini.go around lines 144 to 145, replace the vague TODO "Conflict with
thinkingbudget" with a clear explanatory comment stating the nature of the
conflict and the chosen design: note that UnmarshalJSON intentionally supports
both ThinkingLevel and ThinkingBudget, specify which field takes precedence when
both are present (or that this is undefined), document any compatibility or
migration behavior (e.g., ThinkingBudget is preferred/legacy, ThinkingLevel
added for new API), and list any limitations (format differences, validation
rules, or future deprecation plans). Update the comment to explain how callers
should set these fields and remove the TODO so future readers understand the
resolved behavior and constraints.

}

// UnmarshalJSON allows GeminiThinkingConfig to accept both snake_case and camelCase fields.
func (c *GeminiThinkingConfig) UnmarshalJSON(data []byte) error {
type Alias GeminiThinkingConfig
var aux struct {
Alias
IncludeThoughtsSnake *bool `json:"include_thoughts,omitempty"`
ThinkingBudgetSnake *int `json:"thinking_budget,omitempty"`
ThinkingLevelSnake json.RawMessage `json:"thinking_level,omitempty"`
}

if err := common.Unmarshal(data, &aux); err != nil {
return err
}

*c = GeminiThinkingConfig(aux.Alias)

if aux.IncludeThoughtsSnake != nil {
c.IncludeThoughts = *aux.IncludeThoughtsSnake
}

if aux.ThinkingBudgetSnake != nil {
c.ThinkingBudget = aux.ThinkingBudgetSnake
}

if len(aux.ThinkingLevelSnake) > 0 {
c.ThinkingLevel = aux.ThinkingLevelSnake
}

return nil
}

func (c *GeminiThinkingConfig) SetThinkingBudget(budget int) {
Expand Down