Skip to content

refactor(webview): migrate provider identifiers in UI hooks - #1148

Merged
edelauna merged 3 commits into
Zoo-Code-Org:mainfrom
WebMad:refactor/944-webview-ui-hooks-provider-migration
Aug 10, 2026
Merged

refactor(webview): migrate provider identifiers in UI hooks#1148
edelauna merged 3 commits into
Zoo-Code-Org:mainfrom
WebMad:refactor/944-webview-ui-hooks-provider-migration

Conversation

@WebMad

@WebMad WebMad commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Extracts the webview-ui/src/components/ui/hooks portion of #1141 into a focused pull request:

  • canonicalizes provider checks and router-model keys in useSelectedModel
  • canonicalizes Zoo Gateway router-model synchronization
  • adds focused useSelectedModel coverage for dynamic, retired, local, and router-backed providers

These changes have been removed from #1141.

Related to #944.

Validation

  • repository pre-commit lint passed
  • repository pre-push type checks passed

Summary by CodeRabbit

  • Bug Fixes
    • Improved model selection across supported providers, including DeepSeek, LM Studio, Ollama, OpenCode Go, Requesty, Unbound, Vercel AI Gateway, Zoo Gateway, and others.
    • Preserved configured model choices and improved fallback behavior when provider or router data is unavailable.
    • Corrected Kimi Code model resolution and default-model behavior while router information is loading.
    • Improved handling of local model metadata and retired provider configurations.

@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: 10d1125f-c9f5-41ef-8a1d-4c2a686e9d4f

📥 Commits

Reviewing files that changed from the base of the PR and between 3868c4e and 6610f9c.

📒 Files selected for processing (1)
  • webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • webview-ui/src/components/ui/hooks/tests/useSelectedModel.spec.ts

📝 Walkthrough

Walkthrough

useSelectedModel and Zoo Gateway synchronization now use shared provider identifiers. Tests cover router-backed providers, local models, default metadata, loading states, and retired-provider fallbacks.

Changes

Provider model resolution

Layer / File(s) Summary
Canonical model lookup
webview-ui/src/components/ui/hooks/useSelectedModel.ts
Provider-specific router and local-model lookups use providerIdentifiers across supported providers. Existing validation and fallback behavior remains unchanged.
Model resolution regression coverage
webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
Tests cover dynamic router providers, local metadata and context overrides, configured local models, provider precedence, loading behavior, defaults, and retired-provider fallbacks.
Zoo Gateway router synchronization
webview-ui/src/components/ui/hooks/useZooGatewayRouterModelsSync.ts
Zoo Gateway router fetching and cache updates use providerIdentifiers.zooGateway.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: taltas, navedmerchant, hannesrudolph

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the changes and validation, but it omits the required issue format, test procedure details, checklist, and documentation sections. Add the required template sections, use an explicit issue closure or linkage entry, document reproducible test steps, and complete the checklist and documentation assessment.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the migration of provider identifiers in webview UI hooks.
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.

webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.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 5, 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 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts`:
- Around line 64-258: Replace every as any mock return in
webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts lines
64-258 for the router, OpenRouter, LM Studio, and Ollama query mocks with shared
typed mock-result helpers that satisfy their hook contracts; apply the same
router-model helper at lines 1290-1316. If an exact return-type assertion
remains necessary, document its reason beside the helper.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0abd3a28-6bb0-44bb-ac3b-0c69a398e01f

📥 Commits

Reviewing files that changed from the base of the PR and between 0ae9217 and 3868c4e.

📒 Files selected for processing (3)
  • webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
  • webview-ui/src/components/ui/hooks/useSelectedModel.ts
  • webview-ui/src/components/ui/hooks/useZooGatewayRouterModelsSync.ts

@edelauna edelauna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Updated some test coverage, but looks good.

@edelauna
edelauna enabled auto-merge August 10, 2026 01:43
@edelauna
edelauna added this pull request to the merge queue Aug 10, 2026
Merged via the queue into Zoo-Code-Org:main with commit 854010b Aug 10, 2026
16 checks passed
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.

2 participants