Skip to content

refactor(providers): canonicalize model-router calls - #1165

Open
WebMad wants to merge 4 commits into
Zoo-Code-Org:mainfrom
WebMad:refactor/944-canonicalize-model-router-calls
Open

refactor(providers): canonicalize model-router calls#1165
WebMad wants to merge 4 commits into
Zoo-Code-Org:mainfrom
WebMad:refactor/944-canonicalize-model-router-calls

Conversation

@WebMad

@WebMad WebMad commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • use the shared providerIdentifiers registry for model-router provider options and cache calls
  • canonicalize OpenRouter endpoint routing, LM Studio/Kimi Code/Requesty/Unbound/Poe cache access, and webview router candidates and filters
  • preserve all existing serialized and wire provider values

Validation

  • npx vitest run api/providers/__tests__/poe.spec.ts api/providers/fetchers/__tests__/modelEndpointCache.spec.ts core/webview/__tests__/webviewMessageHandler.routerModels.spec.ts — 28 tests passed
  • pnpm run check-types in src — passed
  • repository pre-commit lint — passed
  • repository pre-push type checks — passed

Related to #944 (remaining-work item 4).

Summary by CodeRabbit

  • Bug Fixes

    • Improved model discovery, caching, and provider selection across supported services, including LM Studio, OpenRouter, Kimi Code, Poe, Requesty, and Unbound.
    • Standardized provider handling in model requests and settings to improve consistency for provider-specific workflows.
    • Corrected Gemini model information display to show the appropriate billing estimate.
  • Tests

    • Added coverage confirming billing estimates appear correctly for supported Gemini models.

@coderabbitai

coderabbitai Bot commented Aug 5, 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cc6db751-6933-4b64-a5c2-c810434bf76b

📥 Commits

Reviewing files that changed from the base of the PR and between d0af4c0 and ac0b8f2.

📒 Files selected for processing (13)
  • src/api/providers/fetchers/lmstudio.ts
  • src/api/providers/fetchers/modelEndpointCache.ts
  • src/api/providers/kimi-code.ts
  • src/api/providers/lm-studio.ts
  • src/api/providers/openrouter.ts
  • src/api/providers/poe.ts
  • src/api/providers/requesty.ts
  • src/api/providers/unbound.ts
  • src/core/webview/webviewMessageHandler.ts
  • webview-ui/src/components/settings/ModelInfoView.tsx
  • webview-ui/src/components/settings/ModelPicker.tsx
  • webview-ui/src/components/settings/__tests__/ModelInfoView.spec.tsx
  • webview-ui/src/components/settings/constants.ts

📝 Walkthrough

Walkthrough

Provider model fetching, cache handling, webview routing, and settings now use shared providerIdentifiers constants. Provider maps use computed identifier keys, and a Gemini billing-message test was added.

Changes

Provider identifier centralization

Layer / File(s) Summary
Centralize settings provider values
webview-ui/src/components/settings/constants.ts, webview-ui/src/components/settings/ModelInfoView.tsx, webview-ui/src/components/settings/ModelPicker.tsx, webview-ui/src/components/settings/__tests__/ModelInfoView.spec.tsx
Provider maps, provider values, Gemini checks, and Mimo hints now use shared identifiers. The Gemini billing message has a rendering test.
Update provider fetcher lookups
src/api/providers/fetchers/*, src/api/providers/kimi-code.ts, src/api/providers/lm-studio.ts, src/api/providers/openrouter.ts, src/api/providers/poe.ts, src/api/providers/requesty.ts, src/api/providers/unbound.ts
Model discovery and cache operations now use shared identifiers for supported providers.
Canonicalize webview provider routing
src/core/webview/webviewMessageHandler.ts
Model initialization, candidate construction, cache flushing, filtering, and Ollama or LM Studio request options now use shared identifiers.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: awaiting-review

Suggested reviewers: edelauna, navedmerchant

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: canonicalizing provider model-router calls.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 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/providers/fetchers/lmstudio.ts

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

src/api/providers/fetchers/modelEndpointCache.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

src/api/providers/kimi-code.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

  • 10 others

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 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.48148% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/core/webview/webviewMessageHandler.ts 77.77% 4 Missing ⚠️
src/api/providers/fetchers/lmstudio.ts 0.00% 1 Missing ⚠️

📢 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 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant