fix(agent): sync provider filter with model support#16710
Conversation
Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
eeee0717
left a comment
There was a problem hiding this comment.
Reviewed head aff32d4.
No substantive issues found. The agent provider filter and provider-list filter now share the same runtime-support predicate, Gemini remains excluded, and the PR includes a targeted provider-list regression test. GitHub CI relevant checks are passing; general-test is skipped.
There was a problem hiding this comment.
This review was translated automatically.
Blocker
None.
Warning
src/renderer/hooks/agent/useAgentModelFilter.ts:42- Agent model filtering allows all non-Gemini providers approved byisAgentSupportedProvider(), but Claude Code runtime will still rejectcherryai::qwen.
Failure path: CherryAI default provider/model is an enabled chat model; after the model selector allows it per the filter, Claude Code runtime goes through the gateway, andsrc/main/ai/runtime/claudeCode/agentSessionWarmup.ts:198will throwCherryAI managed default model is not available through the API gatewayviaisManagedCherryAiDefaultModel().
Minimal fix: Make the Agent model filter share the same support determination logic with the runtime, at minimum excluding the managed CherryAI default model, and add auseAgentModelFiltertest case coveringcherryai::qwen.
Notice
None.
Focused Tests
- Sub-agent ran:
pnpm exec vitest run --project renderer src/renderer/pages/settings/ProviderSettings/__tests__/ProviderList.test.tsx src/renderer/hooks/agent/__tests__/useAgentModelFilter.test.ts, 2 files / 15 tests passed.
Original Content
Blocker
无。
Warning
src/renderer/hooks/agent/useAgentModelFilter.ts:42- Agent 模型过滤会放行所有isAgentSupportedProvider()认可的非 Gemini provider,但 Claude Code runtime 仍会拒绝cherryai::qwen。
Failure path: CherryAI 默认 provider/model 是 enabled chat model;模型选择器按该 filter 放行后,Claude Code runtime 走 gateway,src/main/ai/runtime/claudeCode/agentSessionWarmup.ts:198会通过isManagedCherryAiDefaultModel()抛出CherryAI managed default model is not available through the API gateway。
Minimal fix: 让 Agent 模型过滤器与 runtime 共用同一支持判定,至少排除 managed CherryAI default model,并补一个useAgentModelFilter用例覆盖cherryai::qwen。
Notice
无。
Focused Tests
- 子 agent ran:
pnpm exec vitest run --project renderer src/renderer/pages/settings/ProviderSettings/__tests__/ProviderList.test.tsx src/renderer/hooks/agent/__tests__/useAgentModelFilter.test.ts,2 files / 15 tests passed。
Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
|
Addressed in fda79f5.
Validation:
|
…nt-model-filter-v2 Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com> # Conflicts: # src/renderer/hooks/agent/__tests__/useAgentModelFilter.test.ts # src/renderer/hooks/agent/useAgentModelFilter.ts
There was a problem hiding this comment.
This review was translated automatically.
Reviewed current head e958f8fe.
Blocker: None.
Warning: None.
Notice: None.
The previous issue has been fixed: useAgentModelFilter now calls the shared isAgentRuntimeSupportedModel(); this logic filters non-chat models, Gemini provider, and CherryAI managed default models matched by isManagedCherryAiDefaultModel(providerId, rawModelId). New tests have covered that cherryai::qwen should not appear in the Claude Code agent model selector.
Focused Tests: Attempted to run src/renderer/pages/settings/ProviderSettings/__tests__/ProviderList.test.tsx and src/renderer/hooks/agent/__tests__/useAgentModelFilter.test.ts, but the local temporary worktree + main workspace dependency symlink environment failed at the Vitest worker entry resolution stage, and the test body was not executed. PR CI currently shows basic-checks passed, render-test still pending.
Original Content
已复核当前 head e958f8fe。
Blocker:无。
Warning:无。
Notice:无。
此前问题已修复:useAgentModelFilter 现在调用共享的 isAgentRuntimeSupportedModel();该逻辑会过滤非 chat 模型、Gemini provider,以及 isManagedCherryAiDefaultModel(providerId, rawModelId) 命中的 CherryAI managed default model。新增测试已覆盖 cherryai::qwen 不应出现在 Claude Code agent 模型选择器中。
Focused Tests:尝试运行 src/renderer/pages/settings/ProviderSettings/__tests__/ProviderList.test.tsx 和 src/renderer/hooks/agent/__tests__/useAgentModelFilter.test.ts,但本地临时 worktree + 主工作区依赖软链环境在 Vitest worker 入口解析阶段失败,测试体未执行。PR CI 当前 basic-checks 已通过,render-test 仍 pending。
…nt-model-filter-v2 Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
What this PR does
Before this PR:
The provider settings Agent filter only showed providers with an Anthropic Messages endpoint, even though Claude Code agents can use gateway-routable chat providers.
After this PR:
The Agent filter uses the same shared provider support predicate as the agent model picker. Gateway-routable chat providers remain visible, while Gemini providers stay excluded because the runtime rejects them.
Fixes # N/A
Why we need it and why it was done in this way
The settings page should match the actual agent runtime and model picker behavior so users are not steered back to an obsolete Anthropic-only mental model.
The following tradeoffs were made:
Kept the support predicate intentionally small and aligned with the current runtime constraint: Gemini providers remain unsupported; other chat providers can route through the local API Gateway when needed.
The following alternatives were considered:
Keeping the settings filter Anthropic-only was rejected because it conflicts with current runtime routing. Duplicating the filter logic in the settings page was rejected in favor of a shared provider predicate.
Links to places where the discussion took place: N/A
Breaking changes
If this PR introduces breaking changes, please describe the changes and the impact on users.
N/A
Special notes for your reviewer
Targeted checks run:
pnpm exec vitest run --project renderer src/renderer/pages/settings/ProviderSettings/__tests__/ProviderList.test.tsx src/renderer/hooks/agent/__tests__/useAgentModelFilter.test.tspnpm i18n:checkpnpm lintpnpm formatIntentionally not run by user override:
pnpm build:checkpnpm testChecklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
mainfor active development,v1for v1 maintenance fixes/gh-pr-review,gh pr diff, or GitHub UI) before requesting review from othersRelease note