Repository navigation
Conversation
The webview replaced a configured Zoo Gateway model ID with the provider default whenever the fetched catalog lacked the entry, and the settings panel overwrote the stored ID on the same condition, while API requests kept using the configured model. Zoo Gateway now joins LiteLLM and IO Intelligence in the readiness-gate exception group, the configured ID is preserved in the picker, and the settings auto-init only fills an empty value. Mirrors the LiteLLM fix in Zoo-Code-Org#1368 and the IO Intelligence fix in Zoo-Code-Org#1758. The catalog info lookup uses an own-property guard like the friendli case so an inherited member cannot resolve as model info. Fixes Zoo-Code-Org#2490
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
| Check name | Status | Explanation |
|---|---|---|
| Title check | The title "fix(webview): preserve configured Zoo Gateway model ID in model picker" matches the main change. The PR keeps a configured Zoo Gateway model ID when it is absent from the fetched catalog or… | |
| Description check | The description covers the template's main content. It links the issue (Fixes #2490), explains the description's how and root causes, lists key implementation details and trade-offs, and gives a detai… |
|
| Linked Issues check | Issue #2490 has three coding requirements. Each is implemented in the reviewed head diff.1. Preserve the configured ID in the zooGateway case of getSelectedModel (useSelectedModel.ts). The head code… |
|
| Out of Scope Changes check | The whole-PR diff (merge base 75a93a9 to head ce438d7) touches three source files and two test files. All changes map to #2490:- useSelectedModel.ts: the zooGateway selection case, the hasValidRouter… |
|
| Regression Evidence | Changed behavior and focused coverage, from the diff (base..head): 1. useSelectedModel.ts zooGateway case now keeps zooGatewayModelId || defaultModelId. Own-property Object.hasOwn lookup gives `… |
|
| Security Boundaries | The Security boundaries check fails only for a changed path that leaks secrets or PII, trusts or executes unvalidated input, or bypasses approval or allowlist controls. The PR diff (4 files, verified … | |
| Persistence Integrity | The check fails only for a changed persistence path that can lose or corrupt state through an un-awaited operation, a non-atomic write, missing rollback or partial-failure handling, or a persisted def… | |
| Lifecycle Resource Cleanup | The check fails only for a changed lifecycle path that can leak a listener, watcher, provider, timer, task, or other resource, or that can duplicate work after cancellation, disposal, or restart. The … |
Full details: Title check
-
Explanation
The title "fix(webview): preserve configured Zoo Gateway model ID in model picker" matches the main change. The PR keeps a configured Zoo Gateway model ID when it is absent from the fetched catalog or when catalog loading fails. The changes to useSelectedModel.ts, ZooGateway.tsx, and their tests all support this behavior. The title is short and specific, and it uses a conventional commit prefix. It does not cover the settings auto-init change, but that is a secondary part of the same fix.
Full details: Description check
-
Explanation
The description covers the template's main content. It links the issue (Fixes
#2490), explains the description's how and root causes, lists key implementation details and trade-offs, and gives a detailed test procedure with verification results. The Test Plan section gives manual reproduction steps. Several template items are not addressed: the Visual Snapshots and Videos sections are not discussed (the change is a logic fix, so a *.visual.tsx snapshot may still be needed if the picker display counts as a visible UI change), the Documentation Updates section is not marked, the Pre-Submission Checklist is not ticked, and the Get in Touch section (Discord username) is missing. The description also uses some non-STE terms and contractions-free prose, though it is largely compliant. Overall the description is mostly complete.Resolution
Consider these additions: (1) state whether a *.visual.tsx snapshot applies to the model picker display change, or explain why it does not; (2) mark the Documentation Updates checkbox; (3) add a Discord username in the Get in Touch section; (4) tick the Pre-Submission Checklist items that apply.
Full details: Linked Issues check
-
Explanation
Issue
#2490has three coding requirements. Each is implemented in the reviewed head diff.- Preserve the configured ID in the zooGateway case of getSelectedModel (useSelectedModel.ts). The head code uses
apiConfiguration.zooGatewayModelId || defaultModelIdin place of getValidatedModelId. A configured ID absent from the catalog is kept. - Let selection run after a failed or empty fetch. zooGateway is added to the
dynamicProvider === litellm || ioIntelligenceexception group, which uses!routerModels.isLoading(useSelectedModel.ts, hasValidRouterData). - Limit the settings auto-init overwrite to the empty case (ZooGateway.tsx). The condition changes from
!current || !modelIds.includes(current)to!current.
The issue also requires that
infostay undefined for unlisted IDs. The head code returnsinfoonly from an own property of the fetched catalog (Object.hasOwn), so unlisted IDs getundefined. The issue requires the provider default when nothing is configured. The||fallback covers that case.The issue asks for tests. The diff changes ZooGateway.spec.tsx and useSelectedModel.spec.ts, as the summary describes. I did not run these tests. The PASS rests on the source diff, which matches the stated requirements.
- Preserve the configured ID in the zooGateway case of getSelectedModel (useSelectedModel.ts). The head code uses
Full details: Out of Scope Changes check
-
Explanation
The whole-PR diff (merge base 75a93a9 to head ce438d7) touches three source files and two test files. All changes map to
#2490:- useSelectedModel.ts: the zooGateway selection case, the hasValidRouterData gate, and the related comments.
- ZooGateway.tsx: the auto-init condition.
- ZooGateway.spec.tsx and useSelectedModel.spec.ts: tests for the changed behavior.
The Object.hasOwn guard is a small defensive change inside the zooGateway case. It directly supports the requirement that unlisted IDs keep undefined
info. The PR does not change backend code, and the PR description excludes backend work. The PR description lists other sibling provider lookups and the timeout mismatch as follow-ups and leaves them untouched. No unrelated change is visible in the reviewed diff.
Full details: Regression Evidence
-
Explanation
Changed behavior and focused coverage, from the diff (base..head): 1.
useSelectedModel.tszooGateway case now keepszooGatewayModelId || defaultModelId. Own-propertyObject.hasOwnlookup givesinfoundefined for unlisted IDs. Covered at the hook layer inuseSelectedModel.spec.tsby newzoo-gateway providerrows: absent-from-populated-catalog (preserve ID, info undefined), unset ID (default plus catalog info), inherited key"toString"(no inherited info), and a settled error branch (isError: true, ID preserved). The author reports the new rows failed on head. 2.hasValidRouterDatagate adds zooGateway to the!isLoadingexception group. Covered by the empty-router-payload row (createRouterModelsResult({})), which exercises the gate directly. 3.ZooGateway.tsxauto-init now overwrites only an empty value. Covered inZooGateway.spec.tsx: the stale-ID test is inverted to assert preservation (not.toHaveBeenCalled). The existing tests cover the unset case ("auto-selects ... when the profile has no model id"), the valid-ID case ("does not overwrite a model id that is already valid"), and the loading-empty case. Unit tests at the hook and component layers are the lowest valid layers for this pure selection and settings-effect logic. Error, empty, unset, and inherited-key branches are all present. Playwright: the repo has*.visual.tsxcomponent snapshot tests (webview-ui/playwright-ct.config.ts). I found no ZooGateway or model-picker visual test and no repo rule requiring a snapshot for this change. The change corrects which model ID text is shown. It does not add or restyle a durable visual element, so the snapshot requirement is not triggered by this check's wording. No concrete changed behavior lacks focused coverage.
Full details: Security Boundaries
-
Explanation
The Security boundaries check fails only for a changed path that leaks secrets or PII, trusts or executes unvalidated input, or bypasses approval or allowlist controls. The PR diff (4 files, verified with git diff against the review base) changes only webview display logic: -
useSelectedModel.ts: Zoo Gateway joins the LiteLLM/IO Intelligence settled-fetch group. The zooGateway case now returnsapiConfiguration.zooGatewayModelId || defaultModelIdand reads catalog info throughObject.hasOwn. The own-property guard narrows lookups; it does not widen them. -ZooGateway.tsx: the auto-init effect now writes the default only when the stored ID is empty. It no longer overwrites an explicit ID. - Test files: assertions only. No secrets, credentials, or PII are read, logged, or transmitted in the changed lines. The configured model ID is user-supplied settings data. The backend already used that ID before this PR, and the PR does not touch backend code. The ID is rendered as display text, not executed. No approval, allowlist, or permission check is removed or bypassed. The PR does not add a new trust boundary. No changed path matches an explicit failure condition, so the check passes.
Full details: Persistence Integrity
-
Explanation
The check fails only for a changed persistence path that can lose or corrupt state through an un-awaited operation, a non-atomic write, missing rollback or partial-failure handling, or a persisted default that does not reach a consumer. The diff (refs/coderabbit/pre-merge-check/base..head) touches four webview files: -
ZooGateway.tsx: the settings auto-init effect changes fromif (!current || !modelIds.includes(current))toif (!current). It now writes viasetApiConfigurationFieldless often. It no longer overwrites a stored ID that is missing from the catalog. This removes a write rather than adding one. No new write, storage call, or await path is introduced. -useSelectedModel.ts: the selection logic now returnsapiConfiguration.zooGatewayModelId || defaultModelIdand reads catalog info withObject.hasOwn. It is a read-only display path. It adds zoo-gateway to the settled-fetch gate. It does not write or persist anything. - The two spec files only change tests. The configured ID is preserved for display. The backend already preserves the same ID, per the PR and the linked issue. The change therefore makes the displayed model match the model used for requests. It does not drop or corrupt stored state. No changed code path matches a failure condition in the check: no un-awaited persistence call, no non-atomic write, no missing rollback, and no persisted default that fails to reach its consumer. Context:refs/coderabbit/pre-merge-check/baseandheadare available, so the patch evidence is complete. No CodeRabbit review threads were supplied.
Full details: Lifecycle Resource Cleanup
-
Explanation
The check fails only for a changed lifecycle path that can leak a listener, watcher, provider, timer, task, or other resource, or that can duplicate work after cancellation, disposal, or restart. The PR changes four files in webview-ui. The committed diff (refs/coderabbit/pre-merge-check/base..head) shows these production changes: 1.
webview-ui/src/components/settings/providers/ZooGateway.tsx: the auto-init effect now callssetApiConfigurationFieldonly whenzooGatewayModelIdis empty. The effect has no subscription, timer, or cleanup function. Its dependency array is unchanged. The change reduces the number of field writes. It does not create a new lifecycle path. 2.webview-ui/src/components/ui/hooks/useSelectedModel.ts:hasValidRouterDataadds Zoo Gateway to the existing LiteLLM/IO Intelligence!routerModels.isLoadinggroup. This changes which render-time selection branch runs. It does not start a fetch, subscribe to anything, or add a timer. The router query is unchanged. 3. The zooGatewaygetSelectedModelcase now returns the configured ID and reads model info with an own-property check. It is a pure synchronous computation. 4. The test files change assertions and add cases. They do not change runtime code. No changed code adds or removes a listener, watcher, provider, timer, or task. No changed code runs after a cancellation, disposal, or restart path. The changes are React render and state logic only. I found no concrete changed path that matches the check's failure condition.
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Review statusThanks for contributing. This comment tracks the review sequence and the next action. Current step: Resolve the merge conflicts. The review sequence resumes after the branch is mergeable. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@coderabbitai review |
Action not completed
|
Summary
Fixes #2490.
With provider
Zoo Gatewayand model fixed tozoo/glm-5.3-flash, real API requests correctly used the configured model, but the webview UI displayedanthropic/claude-sonnet-4(settings panel and chat model selector). Three display sites caused it; all three are fixed here with no backend change.Root cause
webview-ui/src/components/ui/hooks/useSelectedModel.ts,getSelectedModelzooGateway case:getValidatedModelId(...)substituted the provider default whenever the configured ID was absent from the fetched catalog.webview-ui/src/components/ui/hooks/useSelectedModel.ts,hasValidRouterDatagate: zooGateway was not in the LiteLLM/IO Intelligence exception group, so a failed fetch (the zoo-gateway fetcher returns a silent{}on error) never reached the selection logic and landed on the provider-default fallback.webview-ui/src/components/settings/providers/ZooGateway.tsx, settings auto-init effect: overwrote the stored ID whenever the loaded catalog lacked it.The backend already preserves the configured ID (
src/api/providers/router-provider.tslast-resort branch), so requests were never affected.Changes
hasValidRouterData!isLoadingexception group (mirrors fix(settings): preserve configured LiteLLM model ID in model picker #1368 and feat: add IO Intelligence provider #1758), so an empty or failed catalog no longer routes to the default fallback.apiConfiguration.zooGatewayModelId || defaultModelId.infostaysundefinedfor unlisted IDs per the hook's documented fallback contract, so the hardcoded Claude Sonnet description (zooGatewayDefaultModelInfo) cannot leak into the model info view.||(not??) matches the IO Intelligence precedent and keeps unconfigured behavior unchanged.if (!current)); an explicit selection is never overwritten.Object.hasOwn), mirroring the friendli case in the same file, so an inherited member cannot resolve as model info.ZooGateway.spec.tsxis inverted to assert preservation; new zoo-gateway rows inuseSelectedModel.spec.tscover absent-from-catalog, empty router payload, settled-error, and inherited-key IDs. Red-on-head was proven for each new row.Precedents
Zoo Gateway was the remaining provider missing this protection.
Out of scope (possible follow-ups)
useZooGatewayRouterModelsSynccache-key sync: they no longer produce a wrong display after this fix.Note on #2229
#2229 (draft, conflicting) refactors the same file toward a
getModelIdaccessor and still retains the zooGateway validation fallback, so it would not fix this bug. This change is orthogonal to that refactor and keeps the same call shape.Verification
useSelectedModel.spec.ts+ZooGateway.spec.tsx); adjacent zoo-gateway specs 108/108.tsc --noEmitclean; ESLint exit 0 on the 4 touched files with no suppression-count increase.useSelectedModelhook, real chatModelSelectordisplay), derived from the acceptance criteria before reading the author's tests.Test plan