MoonshotAI / MoonshotAI/kimi-code
Subagent thinking effort stuck at "high" for third-party models: support_efforts ignored and global/inherited effort always wins
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
What version of Kimi Code is running?
Reported on 0.38.x; mechanism verified against main @ 9a71582.
Which open platform/subscription were you using?
Third-party model (custom OpenAI-compatible provider configured via config file).
What issue are you seeing?
Original user report (Chinese):
kimi code调用子代理的思考强度有严重bug。我配置了第三方模型,无论我修改config文件里的描述还是web端的设置,或者我直接在提示词里直接说明使用max思考强度都没用。调用子代理都只会使用high思考强度(可能和主代理思考强度有关)最离谱的是,我把config文件中子代理模型中的思考强度删掉了low和high,只保留了max,调用子代理时依然会使用high思考强度
Summary: with a third-party model configured, subagents always send thinking effort high, and none of the user's countermeasures work:
- editing the model's thinking fields in the config file;
- changing the thinking setting in the web UI;
- asking for "max" thinking explicitly in the prompt;
- even removing
low/highfrom the subagent model'ssupport_effortsso onlymaxremains — subagents still sendhigh.
What steps can reproduce the bug?
- Configure a third-party (non-Kimi protocol) model and a
[secondary_model]pool for subagents. - Set that model's
support_effortsto["max"]only. - Spawn a subagent (Agent tool) bound to that model.
- Inspect the outgoing request:
reasoning_effortis"high".
What did you expect to happen?
- A subagent model that declares
support_efforts: ["max"]should resolve tomax(or at least to a declared effort), regardless of protocol. - Global/inherited effort should not silently override a subagent model's declared constraints; subagent binding should clamp to the target model's declared efforts.
- The
max→highstartup migration should not rewrite a value the user deliberately set via the UI.
Root cause analysis (main @ 9a71582)
How a subagent's thinking effort is resolved (v2 engine):
- Subagent inheriting the caller's model (
primary, or no[secondary_model.models]pool) inherits the caller agent's current thinking level —resolveSubagentBindingreturnsown.thinkingLevel, and fork bindsthinking ?? sourceData.thinkingLevel(agent-core-v2/src/session/subagent/configSection.ts,agent-core-v2/src/session/agentLifecycle/agentLifecycleService.ts). - Subagent bound to a pool/force model gets
thinking = undefined; at bind time it resolves viaresolveThinkingEffortForModel(undefined, global [thinking] config, model, strict)— the globalthinking.effortwins over the model's owndefault_effort/support_efforts(agent-core-v2/src/agent/profile/profileService.ts,agent-core-v2/src/kosong/model/thinking.ts). - Prompt-level requests cannot help: the subagent spawn path has no thinking parameter at all — only a
modelchoice.
Why high survives every countermeasure:
- Non-Kimi protocols never validate
support_efforts.strictThinkingValidationis only enabled for the kimi provider (kosong/provider/providers/kimi/kimi.contrib.ts:96). For OpenAI/Anthropic-compatible third-party providers the resolved effort is passed through verbatim asreasoning_effort(kosong/provider/bases/openai/openai-legacy.ts:616), so editingsupport_effortschanges nothing. (This half is addressed by PR #3144.) - The web UI writes thinking effort to the global config (
POST /config), so both main-agent and subagent resolution pick it up. - Startup migration
migrateThinkingEffortMaxToHighrewrites a persistedthinking.effort = "max"to"high"once (agent-core-v2/src/app/config/migrations.ts), becausemaxis session-only now — a user who setmaxvia the web UI is silently moved tohighon the next start. - When a model declares
support_effortscontaininghighbut nodefault_effort, registration defaultsdefault_efforttohigh(kosong/model/modelAuth.ts; v1:agent-core/src/config/model.ts).
Additional context
PR #3144 implements "declared support_efforts ⇒ fall back to a declared effort" independent of protocol, which fixes the verbatim-passthrough half once merged. The precedence question (global/inherited high winning over a subagent model's declaration), the web-UI-writes-global behavior, and the migration behavior are not covered by it.
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 resolveSubagentBinding in agent-core-v2/src/session/subagent/configSection.ts and the fork logic in agent-core-v2/src/session/agentLifecycle/agentLifecycleService.ts. Then trace resolveThinkingEffortForModel in agent-core-v2/src/agent/profile/profileService.ts and kosong/model/thinking.ts, along with the migration in agent-core-v2/src/app/config/migrations.ts. Done means subagent effort respects the target model's declared support_efforts, while inherited and global values no longer override valid model constraints or silently rewrite the user's setting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100