Skip to content

Title-agent temperature 0.5 overrides model-required temperature, causing 400s on Moonshot kimi-k2.* #27796

@Alezander9

Description

@Alezander9

Description

In packages/opencode/src/session/llm.ts:172 the temperature is resolved as:

input.agent.temperature ?? ProviderTransform.temperature(input.model)

The built-in title agent hard-codes temperature: 0.5 (packages/opencode/src/agent/agent.ts:253), so ?? short-circuits and the agent default is used.

For model families that the provider strictly requires a specific temperature for (kimi-k2., glm-4.6/4.7, minimax-m2, gemini, qwen), ProviderTransform.temperature exists to encode that. Moonshot kimi-k2. returns HTTP 400 invalid temperature: only 1 is allowed for this model when 0.5 is sent.

Steps to reproduce

  1. Configure Moonshot kimi-k2.6 as the provider/model.
  2. Trigger a session that runs the title agent (any new session).
  3. Moonshot rejects the request: 400 invalid temperature: only 1 is allowed for this model.

Suggested fix

Swap the operands so the model-aware transform wins, with agent preference as fallback:

ProviderTransform.temperature(input.model) ?? input.agent.temperature

For models without a transform entry (claude, openai, etc.) the function returns undefined and the agent preference still applies via ??.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions