Commit 29f118e
bcode
fix(provider): honor strict temperature requirements over agent override
Some providers reject any temperature value other than the one they require
(e.g. Moonshot's kimi-k2.* returns HTTP 400 "invalid temperature: only 1 is
allowed for this model"). The previous chain in session/llm.ts let the
agent's preference win:
input.agent.temperature ?? ProviderTransform.temperature(input.model)
The built-in title agent hard-codes temperature: 0.5, so any session that
started with title generation on one of these models silently failed. OSS
Laminar telemetry over the past 13 days shows 27 occurrences on kimi-k2.6
alone, plus failures on minimax-m2, glm-4.6/4.7, gemini.
Split the model->temperature mapping into:
- temperatureStrict(model): only returns a value when the provider rejects
other values. These must override agent/user preferences.
- temperature(model): falls through to temperatureStrict, otherwise
returns a recommended default (qwen=0.55) or undefined. Used as the
soft fallback when no agent/user temperature is set.
session/llm.ts call site becomes:
temperatureStrict(model) ?? agent.temperature ?? temperature(model)
so the strict value always wins, the user/agent override still applies on
flexible models, and we keep recommended defaults when nothing is set.1 parent de1d917 commit 29f118e
3 files changed
Lines changed: 71 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
479 | 486 | | |
480 | | - | |
481 | | - | |
482 | 487 | | |
483 | 488 | | |
484 | 489 | | |
485 | 490 | | |
486 | 491 | | |
487 | | - | |
| 492 | + | |
488 | 493 | | |
489 | 494 | | |
490 | 495 | | |
| |||
493 | 498 | | |
494 | 499 | | |
495 | 500 | | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
496 | 513 | | |
497 | 514 | | |
498 | 515 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3686 | 3686 | | |
3687 | 3687 | | |
3688 | 3688 | | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
| 3702 | + | |
| 3703 | + | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
| 3710 | + | |
| 3711 | + | |
| 3712 | + | |
| 3713 | + | |
| 3714 | + | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
| 3727 | + | |
| 3728 | + | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
0 commit comments