fix(renderer): honor provider-db budget sentinels#1726
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughRemoves Gemini-specific provider checks, extends thinking-budget types with sentinel fields (auto/off/unit), consolidates capability fetching into a single getCapabilities payload with budget merging, and updates validation, wiring, and tests to use range-driven sentinel logic. ChangesThinking Budget Type System and Capabilities Consolidation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
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. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/composables/useChatConfigFields.ts (1)
130-144:⚠️ Potential issue | 🟠 Major | ⚡ Quick winMake the thinking-budget input sentinel-aware.
Line 130-144 still clamp the native number input to
budgetRange.min/max, so valid provider-db sentinels likeoff: 0orauto: -1remain invalid at the UI layer even thoughuseThinkingBudgetnow accepts them. That means this PR can still block users from entering the very sentinel values it added support for.Please widen/override the input bounds when sentinels fall outside the numeric range, or omit native
min/maxfor this field in those cases.🤖 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 `@src/renderer/src/composables/useChatConfigFields.ts` around lines 130 - 144, The thinking-budget input is currently constrained by min/max using options.budgetRange.value which prevents entering sentinel values (e.g., off:0, auto:-1); update the field config around min/max so that when options.thinkingBudget.value is a sentinel or when known sentinel values lie outside options.budgetRange.value you either omit the native min/max or expand them to include those sentinel values before rendering (adjust the object where min: options.budgetRange.value?.min and max: options.budgetRange.value?.max are set), keeping getValue/setValue (options.thinkingBudget and options.emit('update:thinkingBudget')) unchanged.
🤖 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 `@src/renderer/src/composables/useModelCapabilities.ts`:
- Around line 91-94: capabilityBudgetRange currently prefers
normalizeBudgetRange(capabilities.reasoningPortrait?.budget) over
normalizeBudgetRange(capabilities.thinkingBudgetRange), which discards legacy
min/max when portrait only provides sentinel metadata; instead create a shallow
merge using capabilities.thinkingBudgetRange as the base and overlay
capabilities.reasoningPortrait?.budget on top, then pass the merged object into
normalizeBudgetRange and assign the result to capabilityBudgetRange.value (fall
back to {} if normalize returns null/undefined). Ensure you reference
capabilityBudgetRange, normalizeBudgetRange,
capabilities.reasoningPortrait?.budget and capabilities.thinkingBudgetRange when
implementing the merge.
---
Outside diff comments:
In `@src/renderer/src/composables/useChatConfigFields.ts`:
- Around line 130-144: The thinking-budget input is currently constrained by
min/max using options.budgetRange.value which prevents entering sentinel values
(e.g., off:0, auto:-1); update the field config around min/max so that when
options.thinkingBudget.value is a sentinel or when known sentinel values lie
outside options.budgetRange.value you either omit the native min/max or expand
them to include those sentinel values before rendering (adjust the object where
min: options.budgetRange.value?.min and max: options.budgetRange.value?.max are
set), keeping getValue/setValue (options.thinkingBudget and
options.emit('update:thinkingBudget')) unchanged.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8bbfaa84-60c8-4d81-ab6b-eba93a5003f3
📒 Files selected for processing (8)
src/renderer/src/components/ChatConfig.vuesrc/renderer/src/composables/useChatConfigFields.tssrc/renderer/src/composables/useModelCapabilities.tssrc/renderer/src/composables/useModelTypeDetection.tssrc/renderer/src/composables/useThinkingBudget.tstest/renderer/composables/useModelCapabilities.test.tstest/renderer/composables/useModelTypeDetection.test.tstest/renderer/composables/useThinkingBudget.test.ts
💤 Files with no reviewable changes (2)
- test/renderer/composables/useModelTypeDetection.test.ts
- src/renderer/src/composables/useModelTypeDetection.ts
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 `@src/renderer/src/composables/useModelCapabilities.ts`:
- Around line 105-109: The assignment to capabilityBudgetRange.value overrides
mergeBudgetRanges(...)'s null sentinel by using "?? {}", which causes empty
budget ranges to become {} and misleads truthiness checks (e.g.,
!!budgetRange.value in useThinkingBudget.ts); change the assignment to preserve
null from mergeBudgetRanges (remove the "?? {}" fallback) so
capabilityBudgetRange.value stays null when mergeBudgetRanges returns null,
keeping consumers that rely on truthiness correct.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: ba3884f6-20de-4db5-a170-337f23397d24
📒 Files selected for processing (4)
src/renderer/src/composables/useChatConfigFields.tssrc/renderer/src/composables/useModelCapabilities.tstest/renderer/composables/useChatConfigFields.test.tstest/renderer/composables/useModelCapabilities.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- test/renderer/composables/useModelCapabilities.test.ts
Use reasoningPortrait.budget auto/off values for thinking budget validation instead of checking the Gemini provider id.
Preserve auto/off/unit in renderer capability state and update composable tests.
Summary by CodeRabbit
Refactor
Tests