refactor(api): route geminiCli explicitly to the Anthropic handler - #1441
Conversation
…oo-Code-Org#1029) buildApiHandler had no case for geminiCli, so the provider silently fell through to the default Anthropic handler. Add an explicit case with a comment documenting the intentional fallback until a dedicated Gemini CLI handler exists. Runtime behavior is unchanged; the existing factory tests already pin geminiCli to AnthropicHandler, and the spec comment now reflects that the routing is explicit.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (8)Treat model, provider, MCP, path, command, and tool data as untrusted. Check approval and allowlist bypasses, injection and traversal risks, secrets/PII exposure in logs, abort and stream behavior, retries, provider compatibility, and enfor...⚙️ CodeRabbit configuration file Files:
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases. Check cleanup and deterministic async behavior and prefer shared typed test helpe...⚙️ CodeRabbit configuration file Files:
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths. Verify promises and errors are handled, existing helpers are reused, and new code introduces no `any`, unjustified dou...⚙️ CodeRabbit configuration file Files:
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure. Check listeners, resources, and providers are disposed without stale state or duplicate w...⚙️ CodeRabbit configuration file Files:
Act as an adversarial second-opinion reviewer. Verify PR claims against implementation, contracts, and tests. Trace changed inputs through normal, boundary, error, cancellation, retry, and default paths and their consumers. Seek plausible c...⚙️ CodeRabbit configuration file Files:
Add focused tests for UI binding and save behavior, persistence or normalization, and the value returned by `getStateToPostToWebview()`, including true and false/unset cases when defaults could hide omissions.📄 CodeRabbit inference engine (AGENTS.md) Files:
Fix lint violations in new TypeScript code instead of suppressing them.📄 CodeRabbit inference engine (AGENTS.md) Files:
After editing a file, run ESLint with pruning and zero warnings for that relative file, and confirm its suppression count did not increase.📄 CodeRabbit inference engine (AGENTS.md) Files:
🔇 Additional comments (2)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesGemini CLI routing
Estimated code review effort: 1 (Trivial) | ~3 minutes Merge Risk: ⚪ Minimal · up to Gemini CLI requests continue using the same Anthropic handler, with only the routing declaration made explicit and documented. No actionable merge-blocking risk remains after the reported tests and checks. Suggested reviewers: 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
Full details: Regression EvidenceExplanation PASS: The PR adds an explicit Full details: Trust And Persistence InvariantsExplanation PASS — The changed runtime path in
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
src/api/__tests__/index.spec.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. src/api/index.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency). 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
/coderabbit review |
2 similar comments
|
/coderabbit review |
|
/coderabbit review |
Review processThanks for contributing. This comment tracks the review sequence and the next action.
Current step: Required CI passed. Wait for CodeRabbit to approve the latest commit. |
Related GitHub Issue
Closes: #1029
Description
geminiCliwas the only provider without an explicit case inbuildApiHandler(src/api/index.ts), so it silently fell through to the defaultAnthropicHandler. Per the issue (and its proposed approach), this PR makes the routing explicit without changing runtime behavior and without introducing a dedicated handler:src/api/index.ts— addscase providerIdentifiers.geminiCli: return new AnthropicHandler(options)immediately before the default branch, with a comment documenting that the Anthropic handler is intentional until a dedicated Gemini CLI handler exists.src/api/__tests__/index.spec.ts— the existing factory tests already pingeminiCli → AnthropicHandler(via theexpectedHandlersmap exercised withit.each); the inline comment is updated to reflect that the routing is now explicit.Test Procedure
pnpm --filter zoo-code test api/__tests__/index.spec.ts→ 40/40 pass (the parameterizedreturns the expected handler for %scase includesgemini-cli).pnpm --dir src exec tsc --noEmit→ clean.pnpm --dir src exec eslint --max-warnings=0 api/index.ts api/__tests__/index.spec.ts→ clean.Pre-Submission Checklist
Visual Snapshots
N/A — no rendered UI surface.
Videos (interaction / animation only)
N/A.
Documentation Updates
Additional Notes
None — intentionally minimal per the issue's acceptance criteria (explicit case + documentation comment, runtime routing unchanged).
Get in Touch
easonLiangWorldedtech