From 492c989b6b49e17874940d518d5a1f2f4e319585 Mon Sep 17 00:00:00 2001 From: Klaus Lungwitz Date: Tue, 1 Sep 2026 16:10:48 -0300 Subject: [PATCH] fix(kimi): stop sending temperature, which Kimi pins per model #15 set thinking to 'disabled' on kimi-k2.6, and the next review came back 400: invalid temperature: only 0.6 is allowed for this model Disabling thinking is what moved k2.6 into its non-thinking regime, where 1.0 -- the value the workflow has always sent -- is rejected. From the parameter reference: kimi-k2.6: fixed at 1.0 in thinking mode and 0.6 in non-thinking mode; other values return an error. Do not pass temperature explicitly when calling these models. Every Kimi model pins it: kimi-k3 and kimi-k2.7-code at 1.0, kimi-k2.6 at 1.0 or 0.6 depending on thinking. Hardcoding 0.6 would be correct only while both the model and the thinking setting stay exactly as they are today, and would break silently the moment either moves. Omitting the field is the only choice correct for every model. temperature becomes a string input defaulting to '', and is added to the payload only when non-empty, mirroring how `thinking` already works. No caller passes temperature (only lambda_compiler_kit passes an input at all, a custom prompt), so the type change breaks nobody. Source: https://platform.kimi.ai/docs/api/models-overview --- .github/workflows/ai-review-kimi.yml | 17 +++++++++++------ README.md | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ai-review-kimi.yml b/.github/workflows/ai-review-kimi.yml index 32e85ee..b624621 100644 --- a/.github/workflows/ai-review-kimi.yml +++ b/.github/workflows/ai-review-kimi.yml @@ -36,10 +36,15 @@ on: type: number default: 4096 temperature: - description: 'AI temperature setting' + description: >- + Sampling temperature as a string, or '' (the default) to omit the + field and let the model apply its own. Kimi pins this per model: + kimi-k3 and kimi-k2.7-code are fixed at 1.0, and kimi-k2.6 requires + 1.0 with thinking enabled but 0.6 with it disabled. Any other value + is a 400, so omitting it is the only value correct for every model. required: false - type: number - default: 1 + type: string + default: '' secrets: KIMI_API_KEY: description: 'Moonshot AI API key' @@ -143,7 +148,7 @@ jobs: --arg system "$SYSTEM_PROMPT" \ --arg user "$USER_PROMPT" \ --argjson max_tokens "$MAX_TOKENS" \ - --argjson temperature "$TEMPERATURE" \ + --arg temperature "$TEMPERATURE" \ --arg thinking "$THINKING" \ --rawfile diff /tmp/pr_diff_truncated.txt \ '{ @@ -152,10 +157,10 @@ jobs: { role: "system", content: $system }, { role: "user", content: ($user + "\n\nDiff:\n" + $diff) } ], - temperature: $temperature, max_tokens: $max_tokens } - + (if $thinking == "" then {} else { thinking: { type: $thinking } } end)' > /tmp/payload.json + + (if $thinking == "" then {} else { thinking: { type: $thinking } } end) + + (if $temperature == "" then {} else { temperature: ($temperature | tonumber) } end)' > /tmp/payload.json RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "https://api.moonshot.ai/v1/chat/completions" \ -H "Content-Type: application/json" \ diff --git a/README.md b/README.md index dc46c61..df76132 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ jobs: thinking: 'disabled' # 'disabled', 'enabled', or '' to omit max_diff_lines: 10000 # Max lines of diff to review max_tokens: 4096 # Max response tokens - temperature: 1 # AI temperature (1 required for reasoning models) + temperature: '' # '' omits it; Kimi pins temperature per model prompt: '' # Custom prompt (overrides prompt file) ```