MoonshotAI / MoonshotAI/kimi-code

web: Subagent model panel uses the legacy [secondary_model].model key, so it disagrees with the engine and the TUI

Open
#3,903 0 comments 0 reactions 0 assignees View on GitHub

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;
    
    model is the legacy single-key form — the changelog for #2700 describes it as "a lone legacy model key in the same section keeps working as the fallback default".
  • TUI /secondary-model (alias /subagent-model) writes default_model (plus models when a pool already exists) and reads default_model ?? modelapps/kimi-code/src/tui/commands/config.ts.
  • Web panel (shipped bundle apps/kimi-code/dist-web/assets/index-*.js): reads c.config?.secondaryModel?.model ?? "", writes updateConfig,{secondaryModel:{model:…,defaultEffort:…}}; the only labels involved are secondaryModelSection:"Subagents", secondaryModel:"Subagent model", noSecondaryModel:"Not set (inherit primary)".
Repro
  1. In config.toml (or via the TUI's /secondary-model):
    [secondary_model]
    default_model = "example/model"
    
  2. 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.
  3. Pick any model in that panel. config.toml gains model = "…" while default_model remains, 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.
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.