zai-org / zai-org/feedback

[Bug] Switching the provider family selection doesn't re-validate pinned subagent models

Open
#403 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2 status: 待评估 type: Bug
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

模型设置 / 切换 · Model config

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

影响体验 · Major (功能可用但体验受损 / works but degraded)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description

Subagents whose model is pinned to a specific provider (a model: field in a user agent's frontmatter, or a model override for a built-in agent) keep referencing the old provider after the user switches the active provider within the Z.ai provider family (e.g. Start Plan → Coding Plan). The runtime's provider registry only ever contains the currently selected family provider, so every spawn of such an agent fails at turn 0 with AiSdkModelAdapterError: "Model provider is not configured: " (provider_not_found, non-retryable).

Switching the provider family selection does not re-validate or migrate pinned subagent model references. The main-session model handles unavailability gracefully (the "current model is unavailable, pick another" flow), but pinned subagent models hard-fail with no fallback, and the error gives no hint that the cause is a stale provider pin in the agent definition or built-in override.

Related (same root cause): agent definitions and model overrides are cached per session with no hot reload — editing ~/.zcode/agents/*.md or the built-in override only takes effect in a new conversation/app restart.

复现步骤 · Steps to reproduce
  1. Sign in with the Z.ai Coding Start Plan, so builtin:zai-start-plan is the selected family provider (registry contains only this provider).
  2. Pin a subagent model to it, either way: create a user agent ~/.zcode/agents/coder.md with frontmatter model: "custom:builtin%3Azai-start-plan:GLM-5.3-Flash", or set a model override for the built-in Explore agent (stored as builtInModelOverrides.Explore in ~/.zcode/v2/agents-state.json).
  3. Switch the provider family selection to the Coding Plan provider (builtin:zai-coding-plan) in model settings (modelProviderFamilySelectedKeys.zai in ~/.zcode/v2/setting.json).
  4. Start a new conversation and have the main agent spawn the pinned subagent (Agent tool, e.g. subagent_type: coder).
  5. The subagent turn fails immediately with Model provider is not configured: builtin:zai-start-plan.
期望表现 · Expected behavior

After switching the provider family selection, agents with a pinned model should either be migrated to an available provider or fall back to the session default model with a warning. At minimum, the error should tell the user the pinned provider is no longer active and where to fix it.

实际表现 · Actual behavior

Every spawn of the affected agent fails deterministically at turn 0. Agents without a model pin (e.g. built-in general-purpose) work fine on the newly selected provider. Workaround: delete the model: pin (or clear the built-in override) and start a new conversation / restart the app.

ZCode 版本 · ZCode version

3.10.1

设备 / 系统 / 浏览器 · Device / OS / Browser

Linux desktop — Fedora 44, x86_64, kernel 7.1.10-200.fc44

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

{"level":"error","event":"turn.failed","module":"core.runtime","message":"Turn failed",
"context":{"agentType":"coder","turnNumber":0,"turnPhase":"processing_input"},
"error":{"message":"Turn execution failed","cause":{
"name":"AiSdkModelAdapterError",
"message":"Model provider is not configured: builtin:zai-start-plan",
"code":"provider_not_found",
"context":{"providerId":"builtin:zai-start-plan","modelId":"GLM-5.3-Flash",
"reason":"provider_not_configured","retryable":false,"source":"runtime"}}}}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provider switch with ~/.zcode/v2/setting.json and a pinned agent in ~/.zcode/agents/*.md or builtInModelOverrides in ~/.zcode/v2/agents-state.json. Trace the provider registry and the Agent tool's subagent model resolution, including session caching. Done means pinned models are migrated or safely fall back with a warning, and regression coverage verifies the stale-provider case and actionable error.

Written by the indexing model from the issue text.

Assessment

Domain
ai, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.