MoonshotAI / MoonshotAI/kimi-code
web: Subagent model panel uses the legacy [secondary_model].model key, so it disagrees with the engine and the TUI
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Summary
The web Settings → Subagents → Subagent model panel reads and writes only [secondary_model].model, while the engine resolves the subagent model with the precedence models > default_model > model. So the panel and the engine disagree in both directions: it shows "not set" when a model is configured, and a model set from the web is silently ignored whenever default_model / models exists.
Where
- Engine precedence —
packages/agent-core-v2/src/session/subagent/configSection.ts,resolveSubagentModelPool():if (section?.models !== undefined) return { defaultModel: section.defaultModel, models: section.models }; if (section?.defaultModel !== undefined) return { defaultModel: section.defaultModel, models: { [section.defaultModel]: '' } }; if (section?.model !== undefined) return { defaultModel: section.model, models: { [section.model]: '' } }; return undefined;modelis the legacy single-key form — the changelog for #2700 describes it as "a lone legacymodelkey in the same section keeps working as the fallback default". - TUI
/secondary-model(alias/subagent-model) writesdefault_model(plusmodelswhen a pool already exists) and readsdefault_model ?? model—apps/kimi-code/src/tui/commands/config.ts. - Web panel (shipped bundle
apps/kimi-code/dist-web/assets/index-*.js): readsc.config?.secondaryModel?.model ?? "", writesupdateConfig,{secondaryModel:{model:…,defaultEffort:…}}; the only labels involved aresecondaryModelSection:"Subagents",secondaryModel:"Subagent model",noSecondaryModel:"Not set (inherit primary)".
Repro
- In
config.toml(or via the TUI's/secondary-model):[secondary_model] default_model = "example/model" - Open the web UI → Settings → Subagents. The model is displayed as "Not set (inherit primary)", which is wrong: subagents are bound to
example/model, they do not inherit the primary model. - Pick any model in that panel.
config.tomlgainsmodel = "…"whiledefault_modelremains, so:- the engine keeps using
default_model(the panel's value has no effect), and - the panel keeps displaying the value it wrote — the two views now contradict each other, and the engine follows the TUI/config side.
- the engine keeps using
Related
The panel's visibility gate is experimentalFlags["secondary-model"] ?? config.experimental["secondary-model"], but SECONDARY_MODEL_FLAG_ID (packages/agent-core-v2/src/session/subagent/flag.ts) no longer has a consumer anywhere in the engine — grep for the id returns only its own definition. docs/en/configuration/config-files.md still documents the pool as experimental and "disabled by default … the pool keys stay inert", which no longer matches the code either (the pool is resolved unconditionally).
Ask
Please align the web panel with the keys the engine actually resolves (default_model / models, i.e. the same shape the TUI writes), or make the two keys behave consistently. Either way the panel should not report "not set (inherit primary)" for a session that has default_model configured.
cc @liruifengv (web panel) @7Sageer (secondary-model / subagent pool)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/agent-core-v2/src/session/subagent/configSection.ts and apps/kimi-code/src/tui/commands/config.ts to compare the engine and TUI configuration shapes. Then locate the web-panel source corresponding to the shipped apps/kimi-code/dist-web/assets/index-*.js bundle and reproduce the default_model case from the issue. Done means the web panel reads and writes keys the engine resolves and no longer reports a configured default_model as unset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100