feat: implement issue #382 — Enhance dev-lead and pr-review engines for Gemini 3.5 models - #580
Conversation
…or Gemini 3.5 models
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 33 minutes and 58 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR upgrades engine configuration to support Gemini 3.5 models with per-tier fallback chains that automatically retry rate-limited requests using configured model fallbacks. It integrates chain-aware invocation across all tier execution paths, adds comprehensive test coverage with per-model test fixture overrides, and updates the billing validation probe. ChangesGemini 3.5 Model Support with Chain Fallback
Sequence DiagramsequenceDiagram
participant TierExec as Tier Executor<br/>(run_triage/agentic/writer)
participant ChainInvoke as _gemini_chain_invoke
participant GeminiInvoke as _gemini_invoke
participant RateCheck as is_rate_limited_files
TierExec->>ChainInvoke: invoke chain (e.g., flash,flash-backup)
loop For each model in chain
ChainInvoke->>GeminiInvoke: invoke model, capture stdout/stderr
GeminiInvoke-->>ChainInvoke: model response or error
ChainInvoke->>RateCheck: check temp files for rate-limit
alt Rate-limited
ChainInvoke->>ChainInvoke: warn, try next model
else Non-rate-limit error
ChainInvoke-->>TierExec: return error code (immediate)
else Success
ChainInvoke->>ChainInvoke: set _GEMINI_CHAIN_MODEL_USED
ChainInvoke-->>TierExec: return success
end
end
alt All models rate-limited
ChainInvoke->>ChainInvoke: parse reset time from output
ChainInvoke-->>TierExec: return exit code 2 (all-rate-limited)
end
TierExec->>TierExec: record _GEMINI_CHAIN_MODEL_USED for logging
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
🚥 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 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 |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
There was a problem hiding this comment.
Code Review
This pull request introduces Gemini model fallback chains and updates default Gemini models to Gemini 3.5 Flash, adding the _gemini_chain_invoke helper to handle rate-limiting and graceful degradation. Feedback on the changes includes ensuring REVIEW_ENGINE is checked before attributing the triage model to prevent incorrect attribution from dirty environment variables, mapping each agentic tier to its specific default model to avoid disabling fallback chains on custom configurations, and declaring the models array as local in _gemini_chain_invoke to prevent global scope pollution.
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #580 |
|
Note @don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
|
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: d3a9c5f49bbd20497cb7cceb43206601da62408e
Review mode: triage-approved (single reviewer)
Summary
Wires gemini-3.5-flash into the speed tiers (triage + action) and keeps gemini-2.5-pro on the quality tiers (deep/audit/single) for the gemini engine, adds in-engine rate-limit fallback chains (_gemini_chain_invoke) mirroring the existing _claude_chain_invoke semantics, env-overridable model + chain config, a provisional pricing row, and an updated copilot duck model. Backed by a new 290-line bats suite plus an updated stub-gemini fixture. 506/-25 across 6 files, all non-test changes confined to engine config/orchestration.
Linked issue analysis
Closes #382. The issue is broad (configurable registry, capability-aware routing, SDK modernization, observability metrics, staged rollout flags). This PR delivers the core, testable subset: configurable per-tier models with env overrides (GEMINI_FLASH_MODEL / GEMINI_PRO_MODEL), capability-aware chain selection (flash chain for speed tiers, pro chain for quality tiers), explicit + tested fallback behavior, and pricing. The pr-review output contract is untouched, so no schema regression. Softer deliverables (Google GenAI SDK migration, per-agent observability metrics, phased rollout flags) are not in this PR but the acceptance criteria around configurable model selection and explicit, controllable fallback are met. Reasonable incremental scope.
Findings
All three prior gemini-code-assist advisory comments (dated 2026-06-11, against the initial commit) are already resolved in the reviewed head d3a9c5f:
- HIGH (engine.sh:882) — run_triage now guards on REVIEW_ENGINE before reading _CLAUDE_CHAIN_MODEL_USED, with a parallel _GEMINI_CHAIN_MODEL_USED branch; correct attribution.
- MEDIUM (engine.sh:977) — run_agentic maps each tier to its own default (ENGINE_DEEP/AUDIT/SINGLE_MODEL) rather than reusing ENGINE_DEEP_MODEL, so the explicit-pin check no longer mis-fires.
- LOW (engine.sh:510) — models array is declared 'local -a' with saved/restored IFS.
Pricing: the new 'gemini-3.5-flash*' row is self-flagged provisional (VERIFY); lookup in model-pricing.sh selects the most-specific glob by literal length (16 vs 11 for 'geminiflash*'), so it prices correctly regardless of row order. _gemini_chain_invoke handling of mktemp failure, all-rate-limited (rc=2), and non-rate-limit fast-fail is covered by tests. No blocking issues.
CI status
Green. unit-tests, bats, shellcheck/ShellCheck/Lint, validate-fixtures, validate-agent-profiles, CodeQL (actions+python), SonarCloud (quality gate passed, 0 new issues), agent-shield, gitleaks, and all permission/structure gates pass. Two CANCELLED checks (dev-lead / dispatch, dev-lead / ci-relay) are concurrency cancellations, treated as non-blocking per the recently merged #609 fix — not real failures. Codex review comment is a usage-limit notice, not a finding.
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.



Closes #382
Implemented by dev-lead agent. Please review.
Summary by CodeRabbit
Release Notes
Updates
New Features
Tests