Skip to content

refactor(api): make Gemini CLI handler routing explicit - #1442

Open
enestunc10 wants to merge 1 commit into
Zoo-Code-Org:mainfrom
enestunc10:feature/explicit-gemini-cli-routing
Open

refactor(api): make Gemini CLI handler routing explicit#1442
enestunc10 wants to merge 1 commit into
Zoo-Code-Org:mainfrom
enestunc10:feature/explicit-gemini-cli-routing

Conversation

@enestunc10

Copy link
Copy Markdown

Fixes #1029

Makes the routing for geminiCli explicit within buildApiHandler in src/api/index.ts. Previously, geminiCli was the
only provider without an explicit case statement, causing it to silently fall through to the default Anthropic
handler.

This adds an explicit case providerIdentifiers.geminiCli: with an explanatory comment documenting that falling
through to the Anthropic handler is intentional pending a dedicated Gemini CLI handler implementation.

Checklist

[✓] Tested changes locally
[✓] Followed repository contributing guidelines
[✓] No breaking runtime changes

@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: Pro Plus

Run ID: 7d224719-51d3-49ab-8d6e-d68d7960518a

📥 Commits

Reviewing files that changed from the base of the PR and between b55ff87 and baadfd0.

📒 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
⏰ Context from checks skipped due to timeout. (7)
  • GitHub Check: CodeQL
  • GitHub Check: e2e-mock
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: platform-unit-test (ubuntu-latest)
  • GitHub Check: Build test VSIX
  • GitHub Check: compile
  • GitHub Check: platform-unit-test (windows-latest)
🧰 Additional context used
📓 Path-based instructions (6)
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:

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

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

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

  • 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)

238-239: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Added support for requests identified through the Gemini CLI provider, ensuring they are routed and handled correctly.

Walkthrough

buildApiHandler now includes an explicit geminiCli case. The case falls through to the existing default branch, which constructs an AnthropicHandler.

Changes

Provider routing

Layer / File(s) Summary
Explicit Gemini CLI handler routing
src/api/index.ts
buildApiHandler now recognizes providerIdentifiers.geminiCli and uses the existing default AnthropicHandler path through intentional switch fallthrough.

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

Merge Risk: ⚪ Minimal · up to baadf

Gemini CLI continues using the existing Anthropic handler, while the routing decision is now explicit and tested. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: taltas

🚥 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 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: explicit Gemini CLI handler routing in the API.
Description check ✅ Passed The description identifies issue #1029, explains the implementation, states that runtime behavior remains unchanged, and records local testing. It omits detailed reproduction steps and several templat…
Linked Issues check ✅ Passed The changes satisfy issue #1029 by adding an explicit geminiCli case, documenting the intentional Anthropic handler fallback, and preserving existing runtime behavior.
Out of Scope Changes check ✅ Passed The PR changes only the provider routing logic in src/api/index.ts and directly support the linked issue. No unrelated changes are present.
Regression Evidence ✅ Passed PASS. The only pull-request change adds case providerIdentifiers.geminiCli before the existing default, with no return or other behavior change. geminiCli still returns `new AnthropicHandler(opt…
Trust And Persistence Invariants ✅ Passed PASS. The only changed path is buildApiHandler in src/api/index.ts. It adds case providerIdentifiers.geminiCli and preserves the existing fallthrough to new AnthropicHandler(options). The diff…
Full details: Description check

Explanation

The description identifies issue #1029, explains the implementation, states that runtime behavior remains unchanged, and records local testing. It omits detailed reproduction steps and several template sections, but it contains the core required information.

Full details: Regression Evidence

Explanation

PASS. The only pull-request change adds case providerIdentifiers.geminiCli before the existing default, with no return or other behavior change. geminiCli still returns new AnthropicHandler(options). The focused src/api/__tests__/index.spec.ts test already covered this routing before the pull request and asserts geminiCli uses AnthropicHandler. No durable UI change exists.

Full details: Trust And Persistence Invariants

Explanation

PASS. The only changed path is buildApiHandler in src/api/index.ts. It adds case providerIdentifiers.geminiCli and preserves the existing fallthrough to new AnthropicHandler(options). The diff adds no secret or PII handling, input execution, approval or allowlist bypass, persistence operation, or resource lifecycle operation. Existing routing tests also expect geminiCli to use AnthropicHandler.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/api/index.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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!

@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

Copy link
Copy Markdown
Contributor

Review process

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

  1. Required CI checks pass.
  2. The workflow starts CodeRabbit automatically.
  3. CodeRabbit reviews and approves the latest commit.
  4. A human maintainer reviews and approves after CodeRabbit.

Current step: CodeRabbit approved the latest commit. A maintainer must now review and approve it.

@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer 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
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 awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Make Gemini CLI handler routing explicit

1 participant