Skip to content

refactor(api): route geminiCli explicitly to the Anthropic handler - #1441

Open
easonLiangWorldedtech wants to merge 3 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:fix/issue-1029-geminicli-explicit-routing
Open

easonLiangWorldedtech wants to merge 3 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:fix/issue-1029-geminicli-explicit-routing

Conversation

@easonLiangWorldedtech

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Closes: #1029

Description

geminiCli was the only provider without an explicit case in buildApiHandler (src/api/index.ts), so it silently fell through to the default AnthropicHandler. 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 — adds case 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 pin geminiCli → AnthropicHandler (via the expectedHandlers map exercised with it.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 parameterized returns the expected handler for %s case includes gemini-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.
  • Behavior check: the new case returns the exact same constructor as the previous fall-through, so routing output is unchanged.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): N/A — no UI change.
  • Documentation Impact: No user-facing documentation changes required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Visual Snapshots

N/A — no rendered UI surface.

Videos (interaction / animation only)

N/A.

Documentation Updates

  • No documentation updates are required.

Additional Notes

None — intentionally minimal per the issue's acceptance criteria (explicit case + documentation comment, runtime routing unchanged).

Get in Touch

easonLiangWorldedtech

…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.
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: a17a60ba-d2c7-415c-b54e-c30e507af4c1

📥 Commits

Reviewing files that changed from the base of the PR and between a5f263b and effdc77.

📒 Files selected for processing (1)
  • src/api/index.ts

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 (6)
Treat model, provider, MCP, path, command, and tool data as untrusted.

⚙️ CodeRabbit configuration file

Files:

  • src/api/index.ts
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

⚙️ CodeRabbit configuration file

Files:

  • src/api/index.ts
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure.

⚙️ CodeRabbit configuration file

Files:

  • src/api/index.ts
Act as an adversarial second-opinion reviewer.

⚙️ CodeRabbit configuration file

Files:

  • src/api/index.ts
Fix lint violations in new TypeScript code instead of suppressing them.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • src/api/index.ts
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:

  • src/api/index.ts
🔇 Additional comments (1)
src/api/index.ts (1)

239-239: LGTM!


📝 Summary

Summary by CodeRabbit

  • Documentation

    • Clarified internal documentation describing how Gemini CLI requests are routed.
  • Tests

    • Updated test documentation to match the documented routing behavior.
  • Impact

    • No user-facing functionality or behavior changed.

Walkthrough

buildApiHandler now documents explicit geminiCli routing to AnthropicHandler. The test comment reflects this routing. Runtime behavior remains unchanged.

Changes

Gemini CLI routing

Layer / File(s) Summary
Explicit handler routing
src/api/index.ts, src/api/__tests__/index.spec.ts
The routing comment is placed on the geminiCli case. The test comment documents the same mapping.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to effdc

This change documents the existing Gemini CLI routing to the Anthropic handler without changing runtime behavior. No current merge-readiness risk remains.

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #1029 by adding an explicit geminiCli case, documenting the intentional AnthropicHandler fallback, preserving runtime behavior, and avoiding a dedicated handler.
Out of Scope Changes check ✅ Passed The changes are limited to the requested routing clarification and its test comment. No unrelated code or public API changes are present.
Regression Evidence ✅ Passed PASS — The PR adds only an explicit geminiCli switch label and a comment. The case still reaches the existing new AnthropicHandler(options) default, so runtime behavior is unchanged. The focused f…
Trust And Persistence Invariants ✅ Passed PASS. The pull request adds only provider-switch routing and comments. The original changed path returns new AnthropicHandler(options) for providerIdentifiers.geminiCli, with the same options pr…
Description check ✅ Passed The description is complete and follows the repository template. It links issue #1029, explains the explicit Gemini CLI routing, documents testing, completes the checklist, and identifies that no runt…
Title check ✅ Passed The title clearly and concisely describes the main change: explicitly routing geminiCli to AnthropicHandler.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@easonLiangWorldedtech

Copy link
Copy Markdown
Contributor Author

/coderabbit review

2 similar comments
@easonLiangWorldedtech

Copy link
Copy Markdown
Contributor Author

/coderabbit review

@easonLiangWorldedtech

Copy link
Copy Markdown
Contributor Author

/coderabbit review

@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Aug 29, 2026
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Awaiting fresh human maintainer or CODEOWNER approval.

Automated review is complete for the latest commit but does not replace human approval.

Review-state labels are managed by this workflow; do not edit them manually.

@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit awaiting-review PR changes are ready and waiting for maintainer re-review and removed awaiting-review PR changes are ready and waiting for maintainer re-review labels Aug 29, 2026
@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active and removed coderabbit-review-active Required CI passed; CodeRabbit review is active labels Sep 1, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 1, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer has-conflicts PR has merge conflicts with the base branch and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit awaiting-maintainer CodeRabbit approved; waiting for a human maintainer labels Sep 1, 2026
…nicli-explicit-routing

# Conflicts:
#	src/api/index.ts
@github-actions github-actions Bot removed the has-conflicts PR has merge conflicts with the base branch label Sep 3, 2026
@easonLiangWorldedtech

Copy link
Copy Markdown
Contributor Author

Conflict resolved: merged upstream/main into this branch (now at effdc77). The conflict was in src/api/index.ts because #1442 landed the same explicit geminiCli routing into main first. The merge adopts the upstream version (identical behavior, same case, #1442 comment), so src/api/index.ts now matches main exactly. The only remaining diff is a one-line comment update in src/api/tests/index.spec.ts. Verified: api factory test suite passes (40/40), eslint clean. Happy to close this as a duplicate of #1442 if maintainers prefer, otherwise the leftover spec-comment change is ready to merge.

@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Sep 3, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit awaiting-maintainer CodeRabbit approved; waiting for a human maintainer labels Sep 3, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed awaiting-maintainer CodeRabbit approved; waiting for a human maintainer labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-maintainer CodeRabbit approved; waiting for a human maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Make Gemini CLI handler routing explicit

2 participants