Skip to content

fix(openai-native): use canonical default model - #1627

Open
JunyongParkDev wants to merge 1 commit into
Zoo-Code-Org:mainfrom
JunyongParkDev:fix/openai-native-default-model
Open

fix(openai-native): use canonical default model#1627
JunyongParkDev wants to merge 1 commit into
Zoo-Code-Org:mainfrom
JunyongParkDev:fix/openai-native-default-model

Conversation

@JunyongParkDev

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Closes: #992

Description

OpenAI Native could select gpt-4o when no apiModelId was configured, even though its canonical default is gpt-5.6-sol. Update getProviderDefaultModelId() to import and return openAiNativeDefaultModelId instead of a hardcoded model ID. This keeps fallback selection aligned with future provider default changes and improves provider reliability.

The existing useSelectedModel() logic now receives the canonical default. Explicitly configured models, including gpt-4o, remain selected. Add focused shared-types and hook regression tests for default selection, loading router data, and explicit model preservation.

Test Procedure

pnpm --dir packages/types exec vitest run src/__tests__/provider-default-model.test.ts src/__tests__/openai-models.test.ts
pnpm --dir webview-ui exec vitest run src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
pnpm --dir packages/types check-types
pnpm --dir webview-ui check-types
pnpm lint

The four added test cases verify that:

  • The shared OpenAI Native default equals openAiNativeDefaultModelId.
  • Without an explicit model, the hook returns the canonical model ID and metadata when router data is available.
  • The same default resolves while router data is loading, without marking the static provider as loading.
  • An explicitly configured gpt-4o retains its model ID and metadata.

Before the fix, the three new default-selection cases failed with gpt-4o instead of the canonical default. All four pass with the fix.

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).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Visual Snapshots

Videos (interaction / animation only)

Documentation Updates

  • No documentation updates are required.

Additional Notes

Get in Touch

Use openAiNativeDefaultModelId for the shared OpenAI Native fallback.
Cover default selection while router models load and preserve explicitly
configured models with focused regression tests.

Fixes Zoo-Code-Org#992

Signed-off-by: JunyongParkDev <jun94.park@samsung.com>
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: Advanced

Run ID: d541096d-b182-4e72-97cb-bf52256d4069

📥 Commits

Reviewing files that changed from the base of the PR and between c6eb8fb and 12748f5.

📒 Files selected for processing (3)
  • packages/types/src/__tests__/provider-default-model.test.ts
  • packages/types/src/providers/index.ts
  • webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.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 (5)
For persisted settings, verify the complete schema/storage/runtime/webview round trip, shared default semantics, and focused true plus false/unset tests.

⚙️ CodeRabbit configuration file

Files:

  • packages/types/src/__tests__/provider-default-model.test.ts
  • packages/types/src/providers/index.ts
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
  • packages/types/src/__tests__/provider-default-model.test.ts
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
  • packages/types/src/__tests__/provider-default-model.test.ts
  • packages/types/src/providers/index.ts
Check React state and effect dependencies, cleanup, accessibility, i18n, and light/dark theme behavior.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
Act as an adversarial second-opinion reviewer.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
  • packages/types/src/__tests__/provider-default-model.test.ts
  • packages/types/src/providers/index.ts
🔇 Additional comments (3)
packages/types/src/providers/index.ts (1)

45-45: LGTM!

Also applies to: 109-109

packages/types/src/__tests__/provider-default-model.test.ts (1)

22-22: LGTM!

Also applies to: 37-40

webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts (1)

21-22: LGTM!

Also applies to: 114-142


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • OpenAI Native now consistently selects its supported default model when no model is configured.
    • Explicitly configured OpenAI Native model IDs, such as gpt-4o, are preserved instead of being replaced by the default.
    • Default model information is now available immediately and remains stable during loading states.

Walkthrough

The OpenAI Native fallback now uses openAiNativeDefaultModelId. Tests cover shared default lookup, unconfigured hook selection, loading states, and preservation of explicit model IDs.

Changes

OpenAI Native default selection

Layer / File(s) Summary
Canonical default wiring
packages/types/src/providers/index.ts
getProviderDefaultModelId now returns openAiNativeDefaultModelId for the OpenAI Native provider instead of the hardcoded gpt-4o value.
Default selection regression coverage
packages/types/src/__tests__/provider-default-model.test.ts, webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts
Tests verify the canonical shared default, unconfigured OpenAI Native selection across router loading states, static model information, and preservation of an explicit apiModelId.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 12748

The canonical OpenAI Native default is wired and covered by regression tests; the change is ready to merge.

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation satisfies #992. packages/types/src/providers/index.ts imports and returns openAiNativeDefaultModelId for providerIdentifiers.openaiNative. useSelectedModel.ts already uses `…
Out of Scope Changes check ✅ Passed The changed files are limited to the shared default resolver and focused shared-types and hook regression tests. Each change directly supports #992 acceptance criteria. No unrelated production behavio…
Regression Evidence ✅ Passed PASS. The changed fallback in packages/types/src/providers/index.ts is covered at the shared-types layer by provider-default-model.test.ts, which compares OpenAI Native selection with `openAiNativ…
Security Boundaries ✅ Passed PASS. The authoritative diff changes only a static OpenAI Native default import/return and adds regression tests. The changed production path returns the compile-time constant `openAiNativeDefaultMode…
Persistence Integrity ✅ Passed PASS — The pull request changes a pure default-model resolver and adds tests. The exact diff contains no persistence write, storage operation, async operation, transaction, rollback, or partial-failur…
Lifecycle Resource Cleanup ✅ Passed PASS. The pull request changes only default-model selection and regression tests. getProviderDefaultModelId() now returns openAiNativeDefaultModelId; it does not create or manage a resource. The h…
Title check ✅ Passed The title clearly identifies the main change: using the canonical default model for OpenAI Native.
Description check ✅ Passed The description links issue #992, explains the implementation, documents focused test procedures and results, and completes the relevant checklist items. The reviewer contact field is empty, but this …
✨ 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.

@github-actions

github-actions Bot commented Sep 13, 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.

@codecov

codecov Bot commented Sep 13, 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 coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Sep 13, 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 labels Sep 13, 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.

[BUG] OpenAI Native fallback ignores the canonical default model

1 participant