Skip to content

Comments

Add support for Gemini 3 Pro Preview and Sonnet 4.5#991

Merged
elie222 merged 2 commits intomainfrom
chore/new-models
Nov 19, 2025
Merged

Add support for Gemini 3 Pro Preview and Sonnet 4.5#991
elie222 merged 2 commits intomainfrom
chore/new-models

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Nov 19, 2025

Summary by CodeRabbit

Release Notes

  • New Features
    • Added Claude 4.5 Sonnet and Gemini 3 Pro Preview as available AI model options
    • Improved bulk rules processing with clearer result messaging, including a notification when no unread emails exist in the selected date range

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Nov 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
inbox-zero Ready Ready Preview Nov 19, 2025 8:32pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

The PR refactors bulk email processing to track processed emails by ID instead of count, adds UI messaging for empty results, and introduces two new LLM models (Claude 4.5 Sonnet and Gemini 3 Pro Preview) with corresponding cost configurations. Version updated to v2.20.10.

Changes

Cohort / File(s) Summary
Bulk Rule Processing Refactor
apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx
Replaced totalThreads counter with processedThreadIds Set for precise email tracking. Updated onRun callback to pass thread IDs array and completion count. Added runResult state to display "No unread emails found" message when no emails match criteria. Reset handlers updated to clear run state on date changes.
New LLM Model Additions
apps/web/utils/llms/config.ts, apps/web/utils/llms/model.ts, apps/web/utils/usage.ts
Added CLAUDE_4_5_SONNET_OPENROUTER and GEMINI_3_PRO_PREVIEW_OPENROUTER model entries to config. Updated default OpenRouter model selection from Claude 4 Sonnet to Claude 4.5 Sonnet. Added cost definitions for both new models in usage tracking.
Version Bump
version.txt
Incremented version from v2.20.9 to v2.20.10.

Sequence Diagram

sequenceDiagram
    participant UI as BulkRunRules UI
    participant Handler as onRun Handler
    participant Queue as Thread Queue
    participant Callback as Parent Component

    Note over UI,Callback: Old Flow (Count-based)
    UI->>Handler: Click Run
    loop Process batches
        Handler->>Queue: Process threads
        Handler->>Callback: incrementThreadsQueued(count)
    end
    Handler->>Callback: onComplete()

    Note over UI,Callback: New Flow (ID-based)
    UI->>Handler: Click Run
    Handler->>Handler: Initialize runResult=null
    loop Process batches
        Handler->>Handler: Accumulate threadIds
        Handler->>Callback: onThreadsQueued(threadIds[])
        Handler->>Handler: Update processedThreadIds Set
    end
    Handler->>Handler: Compute final count
    Handler->>Callback: onComplete(totalProcessed)
    Handler->>UI: Display runResult (count or empty message)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • BulkRunRules.tsx: State management refactoring from counter to Set-based tracking requires verification of edge cases (duplicate handling, reset logic), but changes follow straightforward patterns.
  • LLM configuration files: Additive changes (new model entries and pricing) are low-risk; verify cost values are correct and model identifiers match OpenRouter conventions.

Possibly related PRs

Poem

🐰 With IDs now tracked in a set so fine,
And Claude's new sonnet version online,
Gemini three joins the model parade,
No emails lost—just elegantly weighed,
From 2.20.9, we hop to point ten! 🚀

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding support for two new LLM models (Gemini 3 Pro Preview and Sonnet 4.5) across multiple files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/new-models

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c7cf27 and 95c333c.

📒 Files selected for processing (5)
  • apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx (10 hunks)
  • apps/web/utils/llms/config.ts (1 hunks)
  • apps/web/utils/llms/model.ts (1 hunks)
  • apps/web/utils/usage.ts (2 hunks)
  • version.txt (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/web/utils/llms/model.ts (1)
apps/web/utils/llms/config.ts (1)
  • Model (17-37)
apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx (1)
apps/web/components/Typography.tsx (1)
  • SectionDescription (127-127)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: test
🔇 Additional comments (7)
apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx (4)

31-33: LGTM! Clean refactor to ID-based tracking.

The shift from count-based to Set-based tracking enables accurate progress monitoring even when threads complete out of order or when processing is interrupted and resumed.

Also applies to: 45-47, 51-54


90-94: LGTM! Proper state reset on date changes.

Resetting both runResult and processedThreadIds when the date range changes ensures the UI accurately reflects the new query parameters.

Also applies to: 100-104


135-150: LGTM! Well-structured callback pattern.

The callback design enables real-time progress updates (onThreadsQueued) while preserving final state (onComplete). The conditional runResult assignment correctly targets the empty-results case for display in the UI below.


184-265: LGTM! Robust batch processing with proper callback integration.

The batch fetching loop correctly:

  • Paginates through threads using nextPageToken
  • Filters threads without plans to avoid reprocessing
  • Notifies the UI via onThreadsQueued before queuing work
  • Reports final count via onComplete
  • Handles errors and respects abort signals
apps/web/utils/llms/config.ts (1)

26-26: LGTM! Model constants follow existing conventions.

The new entries align with the established naming pattern and are properly integrated with model.ts (default selection) and usage.ts (cost tracking).

Also applies to: 33-33

apps/web/utils/usage.ts (1)

89-89: Pricing verified as correct.

Claude Sonnet 4.5 on OpenRouter is priced at $3.00 per 1M input tokens and $15.00 per 1M output tokens, which matches the constants defined in the code. No updates needed.

apps/web/utils/llms/model.ts (1)

101-101: Model verified as available and correctly configured.

Claude Sonnet 4.5 is available on OpenRouter with the model ID anthropic/claude-sonnet-4.5 (or anthropic/claude-sonnet-4-5—both formats are accepted). The code uses the correct format and the model is production-ready.

Comment on lines +124 to +127
"google/gemini-3-pro-preview": {
input: 2 / 1_000_000,
output: 12 / 1_000_000,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Verify Gemini 3 Pro Preview pricing.

Confirm the pricing for google/gemini-3-pro-preview ($2/$12 per 1M tokens) matches the current OpenRouter rates before deployment.


🌐 Web query:

What is the pricing for Gemini 3 Pro Preview on OpenRouter?

💡 Result:

OpenRouter charges the Google (Gemini 3 Pro Preview) pass‑through rates — Gemini 3 Pro Preview is billed at $2 per 1M input tokens and $12 per 1M output tokens for contexts ≤200k tokens, and $4 per 1M input / $18 per 1M output for contexts >200k tokens. OpenRouter typically applies a small platform/processing fee on top of provider costs (≈5%) and credit‑purchase fees. [1][2]

Sources:

  • Google Gemini 3 Pro Preview model docs (pricing). [1]
  • OpenRouter / aggregator notes on pass‑through pricing and platform fee. [2]

Pricing structure is incomplete — missing higher tier for contexts >200k tokens.

The pricing $2/$12 per 1M tokens is correct for contexts ≤200k, but OpenRouter charges $4 per 1M input / $18 per 1M output for contexts >200k tokens. Update the pricing to handle both tiers based on context length.

🤖 Prompt for AI Agents
In apps/web/utils/usage.ts around lines 124 to 127, the pricing entry for
"google/gemini-3-pro-preview" only lists the lower-tier rates (2/12 per 1M
tokens) for contexts ≤200k; update it to include both tiers so consumers can
select rates based on context length — add a structure or tiered object with
keys for "standard" (≤200k: input 2/1_000_000, output 12/1_000_000) and
"large_context" (>200k: input 4/1_000_000, output 18/1_000_000), and ensure any
place that reads this value selects the correct tier based on the context length
(e.g., check contextTokens > 200_000 to use large_context rates).

@elie222 elie222 merged commit e6b3344 into main Nov 19, 2025
17 checks passed
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai 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 issues found across 5 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx">

<violation number="1" location="apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx:146">
`runResult` is set whenever the queue reports a total of 0 threads, but `onComplete(totalProcessed)` is called for cancellations and fetch errors as well. If the user aborts immediately (or the API fails before any threads queue), the UI still shows “No unread emails found in the selected date range,” which is misleading because nothing actually completed. Guard this message behind a successful completion flag or pass abort/error state through `onComplete` before showing it.</violation>
</file>

<file name="apps/web/utils/usage.ts">

<violation number="1" location="apps/web/utils/usage.ts:125">
Gemini 3 Pro Preview on OpenRouter uses tiered pricing; contexts over 200k tokens are billed at higher rates. Using a single-tier rate here will underreport costs for large contexts. Add tiered rates or select the correct rate based on context length.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

},
(count) => {
setRunning(false);
if (count === 0) {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 19, 2025

Choose a reason for hiding this comment

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

runResult is set whenever the queue reports a total of 0 threads, but onComplete(totalProcessed) is called for cancellations and fetch errors as well. If the user aborts immediately (or the API fails before any threads queue), the UI still shows “No unread emails found in the selected date range,” which is misleading because nothing actually completed. Guard this message behind a successful completion flag or pass abort/error state through onComplete before showing it.

Prompt for AI agents
Address the following comment on apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx at line 146:

<comment>`runResult` is set whenever the queue reports a total of 0 threads, but `onComplete(totalProcessed)` is called for cancellations and fetch errors as well. If the user aborts immediately (or the API fails before any threads queue), the UI still shows “No unread emails found in the selected date range,” which is misleading because nothing actually completed. Guard this message behind a successful completion flag or pass abort/error state through `onComplete` before showing it.</comment>

<file context>
@@ -111,9 +132,21 @@ export function BulkRunRules() {
+                            },
+                            (count) =&gt; {
+                              setRunning(false);
+                              if (count === 0) {
+                                setRunResult({ count });
+                              }
</file context>
Fix with Cubic

"google/gemini-2.5-pro-preview": gemini2_5pro,
"google/gemini-2.5-pro": gemini2_5pro,
"google/gemini-3-pro-preview": {
input: 2 / 1_000_000,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 19, 2025

Choose a reason for hiding this comment

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

Gemini 3 Pro Preview on OpenRouter uses tiered pricing; contexts over 200k tokens are billed at higher rates. Using a single-tier rate here will underreport costs for large contexts. Add tiered rates or select the correct rate based on context length.

Prompt for AI agents
Address the following comment on apps/web/utils/usage.ts at line 125:

<comment>Gemini 3 Pro Preview on OpenRouter uses tiered pricing; contexts over 200k tokens are billed at higher rates. Using a single-tier rate here will underreport costs for large contexts. Add tiered rates or select the correct rate based on context length.</comment>

<file context>
@@ -120,6 +121,10 @@ const costs: Record&lt;
   &quot;google/gemini-2.5-pro-preview&quot;: gemini2_5pro,
   &quot;google/gemini-2.5-pro&quot;: gemini2_5pro,
+  &quot;google/gemini-3-pro-preview&quot;: {
+    input: 2 / 1_000_000,
+    output: 12 / 1_000_000,
+  },
</file context>
Fix with Cubic

This was referenced Nov 25, 2025
@elie222 elie222 deleted the chore/new-models branch December 18, 2025 23:00
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.

1 participant