Skip to content

Conversation

@tomerqodo
Copy link

Benchmark PR from qodo-benchmark#261

@greptile-apps
Copy link

greptile-apps bot commented Jan 15, 2026

Greptile Summary

This PR adds i18n translations for model provider quota UI across 20 languages and updates the quota-panel.tsx component. However, the TypeScript changes introduce three critical bugs:

  • i18n parameter mismatch: Code passes resetDate but all translation files expect {{date}}, breaking reset date display across all languages
  • Swapped tooltip logic: Custom providers now show quota messages while system providers show API key messages (reversed from correct behavior)
  • Removed safety guard: Eliminated Math.max(..., 0) allowing negative credit values to display

The i18n translation additions appear correct and properly formatted across all 20 language files.

Confidence Score: 0/5

  • This PR is unsafe to merge due to critical runtime bugs
  • Score reflects three critical logic errors in quota-panel.tsx that will cause visible UI bugs: reset date won't display (i18n parameter name mismatch across all 20+ languages), tooltips will show incorrect messages (swapped logic), and negative credits may appear (removed Math.max guard)
  • Pay critical attention to web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx - contains three logic errors that must be fixed

Important Files Changed

Filename Overview
web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx Critical issues: i18n parameter mismatch will break date display, swapped tooltip logic shows wrong messages, removed Math.max may cause negative credit display
web/i18n/ar-TN/common.json Added 4 new translation keys for model provider UI - translations appear correct
web/i18n/de-DE/common.json Added 4 new translation keys for model provider UI - translations appear correct
web/i18n/es-ES/common.json Added 4 new translation keys for model provider UI - translations appear correct

Sequence Diagram

sequenceDiagram
    participant User
    participant QuotaPanel
    participant i18n
    participant Workspace
    
    User->>QuotaPanel: View model provider quota
    QuotaPanel->>Workspace: Get trial_credits & trial_credits_used
    Workspace-->>QuotaPanel: Return credit values
    QuotaPanel->>QuotaPanel: Calculate credits (removed Math.max)
    Note over QuotaPanel: May return negative if used > total
    
    QuotaPanel->>Workspace: Get next_credit_reset_date
    Workspace-->>QuotaPanel: Return reset date
    QuotaPanel->>i18n: t('modelProvider.resetDate', {resetDate: formatted})
    Note over i18n: BUG: expects {date} not {resetDate}
    i18n-->>QuotaPanel: Return empty/broken string
    
    User->>QuotaPanel: Hover over provider icon
    QuotaPanel->>QuotaPanel: getTooltipKey() (swapped logic)
    Note over QuotaPanel: BUG: custom shows quota msg, system shows API msg
    QuotaPanel->>i18n: t(getTooltipKey(), {modelName})
    i18n-->>QuotaPanel: Return wrong tooltip message
    QuotaPanel-->>User: Display incorrect tooltip
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

{t('modelProvider.resetDate', {
ns: 'common',
date: formatTime(currentWorkspace.next_credit_reset_date, t('dateFormat', { ns: 'appLog' })),
resetDate: formatTime(currentWorkspace.next_credit_reset_date, t('dateFormat', { ns: 'appLog' })),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Parameter name mismatch: code passes resetDate but all i18n files expect date as placeholder (e.g., "Reset on {{date}}"). This will cause the date to not display.

Suggested change
resetDate: formatTime(currentWorkspace.next_credit_reset_date, t('dateFormat', { ns: 'appLog' })),
date: formatTime(currentWorkspace.next_credit_reset_date, t('dateFormat', { ns: 'appLog' })),
Prompt To Fix With AI
This is a comment left during a code review.
Path: web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
Line: 113:113

Comment:
**logic:** Parameter name mismatch: code passes `resetDate` but all i18n files expect `date` as placeholder (e.g., `"Reset on {{date}}"`). This will cause the date to not display.

```suggestion
                      date: formatTime(currentWorkspace.next_credit_reset_date, t('dateFormat', { ns: 'appLog' })),
```

How can I resolve this? If you propose a fix, please make it concise.

const { t } = useTranslation()
const { currentWorkspace } = useAppContext()
const credits = Math.max((currentWorkspace.trial_credits - currentWorkspace.trial_credits_used) || 0, 0)
const credits = (currentWorkspace.trial_credits - currentWorkspace.trial_credits_used) || 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Removed Math.max(..., 0) wrapper. If trial_credits_used > trial_credits, credits will now be negative, potentially causing UI issues where negative credit values display. Is it expected behavior to show negative credits, or should this remain clamped to 0?

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
Line: 50:50

Comment:
**logic:** Removed `Math.max(..., 0)` wrapper. If `trial_credits_used > trial_credits`, credits will now be negative, potentially causing UI issues where negative credit values display. Is it expected behavior to show negative credits, or should this remain clamped to 0?

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 126 to 130
if (providerType === PreferredProviderTypeEnum.custom)
return 'modelProvider.card.modelSupported'
if (usingQuota)
return 'modelProvider.card.modelAPI'
return 'modelProvider.card.modelNotSupported'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Swapped tooltip logic: PreferredProviderTypeEnum.custom now shows "modelSupported" (quota message) when it should show "modelAPI" (API key message), and vice versa for system providers. This reverses the intended tooltip messages.

Suggested change
if (providerType === PreferredProviderTypeEnum.custom)
return 'modelProvider.card.modelSupported'
if (usingQuota)
return 'modelProvider.card.modelAPI'
return 'modelProvider.card.modelNotSupported'
if (usingQuota)
return 'modelProvider.card.modelSupported'
if (providerType === PreferredProviderTypeEnum.custom)
return 'modelProvider.card.modelAPI'
Prompt To Fix With AI
This is a comment left during a code review.
Path: web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
Line: 126:130

Comment:
**logic:** Swapped tooltip logic: `PreferredProviderTypeEnum.custom` now shows "modelSupported" (quota message) when it should show "modelAPI" (API key message), and vice versa for system providers. This reverses the intended tooltip messages.

```suggestion
              if (usingQuota)
                return 'modelProvider.card.modelSupported'
              if (providerType === PreferredProviderTypeEnum.custom)
                return 'modelProvider.card.modelAPI'
```

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants