Repository navigation
fix(cli): hide unconfigured discontinued OAuth model - #5167
Conversation
DragonnZhang
left a comment
There was a problem hiding this comment.
Clean fix: discontinued QWEN_OAUTH models are now hidden from the model dialog when the user is on a different auth type, rather than being shown and then blocking selection. The filter m.authType !== AuthType.QWEN_OAUTH || authType === AuthType.QWEN_OAUTH correctly shows QWEN_OAUTH models only when the user is already on that auth type. authType added to useMemo dependencies. Old "blocks switching" test removed (replaced with "hides" test). No high-confidence issues found.
Downgraded from Approve to Comment: CI pending.
— claude-opus-4-6 via Qwen Code /review
| expect(props.showNumbers).toBe(true); | ||
| }); | ||
|
|
||
| it('hides discontinued qwen-oauth models for other auth types', () => { |
There was a problem hiding this comment.
[Suggestion] The new test covers the "hide" side (non-OAuth user doesn't see QWEN_OAUTH model) but lacks the complementary "show" test — verifying that a QWEN_OAUTH user still sees the discontinued entry. The PR description explicitly promises this behavior ("Existing Qwen OAuth sessions still see the discontinued entry"), but it's untested.
A regression in the filter logic that accidentally hides QWEN_OAUTH models from QWEN_OAUTH users (breaking the migration warning flow) would go undetected.
Consider adding a complementary test:
it('shows discontinued qwen-oauth models for QWEN_OAUTH auth type', () => {
renderComponent(
{},
{
getAuthType: vi.fn(() => AuthType.QWEN_OAUTH),
getAllConfiguredModels: vi.fn(() => [
{
id: DEFAULT_QWEN_MODEL,
label: DEFAULT_QWEN_MODEL,
authType: AuthType.QWEN_OAUTH,
},
{
id: 'gpt-4',
label: 'GPT-4',
authType: AuthType.USE_OPENAI,
},
]),
},
);
const items = mockedSelect.mock.calls[0][0].items;
const oauthItem = items.find(
(item: { value: string }) =>
item.value === `${AuthType.QWEN_OAUTH}::${DEFAULT_QWEN_MODEL}`,
);
expect(oauthItem).toBeDefined();
});— qwen3.7-max via Qwen Code /review
doudouOUC
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — qwen3.7-max via Qwen Code /review
✅ Maintainer verification — built and tested locallyI verified this PR by building it from source and driving the real interactive TUI under Setup
1. OpenAI-compatible auth — the bug in #5160 (Before → After)Fixture: Before (pre-fix): the discontinued OAuth model is the first selectable row — exactly the reported bug. After (this PR): the 2. Existing Qwen OAuth session — migration warning preserved (regression guard)Fixture: The discontinued registry row is still shown (alongside the runtime model from cached creds), so the migration notice is intact for users who actually have an OAuth session. ✅ This matches the PR's intent: the entry is filtered only when the active auth type is not 3. Automated checks (on PR head)
Notes / scope
Verdict: Behavior matches the PR description and resolves #5160 in the real TUI, with the OAuth-session path preserved. LGTM. 👍 🇨🇳 中文版(点击展开)✅ 维护者验证 —— 本地构建并实测我从源码构建了本 PR,并在 环境
1. OpenAI 兼容认证 —— #5160 的 bug(修复前 → 修复后)Fixture: 修复前: 已停用的 OAuth 模型是第一个可选项 —— 正是所报告的 bug。 修复后(本 PR): 2. 已有的 Qwen OAuth 会话 —— 迁移提示得以保留(回归保护)Fixture: 已停用的注册项仍然显示(与来自缓存凭据的 runtime 模型并列),因此对真正拥有 OAuth 会话的用户而言,迁移提示完好无损。✅ 这与 PR 的意图一致:仅当当前认证类型不是 3. 自动化检查(基于 PR head)
说明 / 范围
结论: 行为与 PR 描述一致,在真实 TUI 中解决了 #5160,同时保留了 OAuth 会话路径。可以合并。👍 Verification performed locally in an isolated environment; placeholder credentials only. |
What this PR does
The interactive
/modelpicker now hides the discontinued built-in Qwen OAuth model when the current session uses another authentication provider. Existing Qwen OAuth sessions still see the discontinued entry, so their migration warning remains available.Why it's needed
getAllConfiguredModels()includes the built-in Qwen OAuth registry entry even when a user has no OAuth configuration. That made API-key and OpenAI-compatible users see an unusable discontinued model as the first picker option. Filtering only the dialog's non-runtime registry entries removes the misleading option without changing the global registry or runtime compatibility.Reviewer Test Plan
How to verify
Open
/modelwhile authenticated through an OpenAI-compatible provider and confirm noqwen-oauthrow is shown. Open it in an existing Qwen OAuth session and confirm the discontinued row and warning remain visible.Evidence (Before & After)
Before: non-OAuth users see
[qwen-oauth] coder-model (Discontinued)as the first row. After: the row is omitted unless Qwen OAuth is the active auth type. Focused component tests cover both sides.Tested on
Environment (optional)
Node.js 24; repository dependencies installed locally.
Risk & Scope
Linked Issues
Fixes #5160
中文说明
本 PR 做了什么
交互式
/model选择器现在会在当前会话使用其它认证提供商时隐藏已经停用的内置 Qwen OAuth 模型。已有 Qwen OAuth 会话仍能看到停用条目,因此迁移提示不会丢失。为什么需要修改
getAllConfiguredModels()即使在用户没有配置 OAuth 时也会包含内置 Qwen OAuth 注册项,导致 API Key 和 OpenAI 兼容提供商用户把一个不可用的停用模型看作第一个选项。本次只过滤选择器中的非运行时注册项,不改变全局模型注册和现有运行时兼容行为。Reviewer Test Plan
验证方式
使用 OpenAI 兼容提供商认证后打开
/model,确认不再显示qwen-oauth行;在已有 Qwen OAuth 会话中打开,确认停用条目和警告仍然可见。修改前后证据
修改前,非 OAuth 用户会把
[qwen-oauth] coder-model (Discontinued)看到为第一行;修改后,只有当前认证类型为 Qwen OAuth 时才显示该行。聚焦组件测试覆盖了两侧行为。已测试环境
Windows,Node.js 24;本地安装仓库依赖。聚焦测试、lint、完整 build 和全工作区 typecheck 均通过。
风险与范围
关联 Issue
Fixes #5160