bug: claude-haiku-5-5 rejects thinking.type.enabled (400) — ADAPTIVE_THINKING omits haiku
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 79/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
先檢查 index.ts 中的 ADAPTIVE_THINKING 運算式和 toModel 邏輯,再查看 test.ts 中關於模型相容性旗標的現有案例。檢查 Haiku 5 模型 ID 如何符合系列規則,並確保較舊的 Haiku 4 ID 仍不在規則範圍內。完成標準是受影響的目錄項目取得 forceAdaptiveThinking,且有回歸測試涵蓋此邊界。
由索引模型根據 Issue 內容生成。
描述
Versions
@commandcode/pi-commandcode-provider0.3.0@earendil-works/pi-coding-agent1.2.0 /@earendil-works/pi-ai1.2.0 (as bundled by gentle-shell 4.3.0)- Linux x64
Problem
claude-haiku-5-5 cannot be used with any thinking level: every completion fails with HTTP 400, because the model is not marked as requiring adaptive thinking and pi therefore sends the budget form of the parameter. Without a thinking level the same model answers normally.
$ pi -p --model command-code/claude-haiku-5-5:off "reply with exactly: ok"
ok
$ pi -p --model command-code/claude-haiku-5-5:high "reply with exactly: ok"
400 {"type":"error","error":{"type":"invalid_request_error","message":"{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"\\\"thinking.type.enabled\\\" is not supported for this model. Use \\\"thinking.type.adaptive\\\" and \\\"output_config.effort\\\" to control thinking behavior.\",\"request_id\":\"req_011CgSP7SdnP43dgNJZFsstt\"}"}}
Same request directly against the gateway, to remove pi from the picture:
# budget form — what pi sends today for this model
$ curl -s $BASE/v1/messages -d '{"model":"claude-haiku-5-5","max_tokens":512,
"thinking":{"type":"enabled","budget_tokens":1024},
"messages":[{"role":"user","content":"deci ok"}]}'
HTTP 400 "thinking.type.enabled" is not supported for this model.
Use "thinking.type.adaptive" and "output_config.effort" ...
# adaptive form — accepted, returns a thinking block plus text
$ curl -s $BASE/v1/messages -d '{"model":"claude-haiku-5-5","max_tokens":512,
"thinking":{"type":"adaptive"},"output_config":{"effort":"high"},
"messages":[{"role":"user","content":"deci ok"}]}'
HTTP 200 {"content":[{"type":"thinking",...},{"type":"text",...}],
"usage":{"output_tokens":177,"output_tokens_details":{"thinking_tokens":84}}}
Root cause
index.ts:84 decides which models need the adaptive form:
const ADAPTIVE_THINKING = /(opus[-.](4[-.]6|4[-.]7|4[-.]8|5)|sonnet[-.](4[-.]6|5)|fable[-.]5|mythos[-.]5)/;
and index.ts:137 is the only place that sets the flag:
} else if (api === "anthropic-messages" && ADAPTIVE_THINKING.test(item.id)) {
model.compat = { forceAdaptiveThinking: true };
}
haiku is absent, so claude-haiku-5-5 never receives forceAdaptiveThinking, and pi-ai branches on exactly that flag (pi-ai, dist/api/anthropic-messages.js):
:761— with the flag:mapThinkingLevelToEffort, and:989sendsthinking: {type: "adaptive", display}plusoutput_config: {effort}.:771/:996— without it:adjustMaxTokensForThinkingandthinking: {type: "enabled", budget_tokens}, which this model rejects.
The catalog entry is otherwise fine: claude-haiku-5-5, context_length: 1000000, supported_endpoints: ["/messages"] — the correct anthropic-messages route is chosen; only the thinking form is wrong.
Suggested fix
Add 5.x haiku to the family list, one alternative:
const ADAPTIVE_THINKING = /(opus[-.](4[-.]6|4[-.]7|4[-.]8|5)|sonnet[-.](4[-.]6|5)|haiku[-.]5|fable[-.]5|mythos[-.]5)/;
haiku[-.]5 does not match claude-haiku-4-5-20251001, so the older model keeps the budget form it accepts today. I verified the behaviour above on claude-haiku-5-5; I could not verify claude-haiku-4-5-20251001 directly, because it answers 403 MODEL_NOT_IN_PLAN on my plan before any thinking negotiation, so the scoping of the regex rests on the documented family rule (adaptive from Opus 4.6 / Sonnet 4.6 / Fable 5 onward) rather than on a run.
A test.ts case asserting model.compat?.forceAdaptiveThinking per catalog family would catch both this gap and its mirror: a family that gets the flag but still wants the budget form.
Related
#1 is in the same function (toModel) and the same area of the model object, but a different symptom (thinking levels max/minimal from a missing thinkingLevelMap); it does not cover this model or this parameter form.
- 主要語言
- TypeScript
- 星號
- 19
- 分支
- 0
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
CommandCodeAI/pi-commandcode-provider 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 70/100
CommandCodeAI/pi-commandcode-provider#1 · 1 則留言 ·
查看 CommandCodeAI/pi-commandcode-provider 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
marmelab/react-admin#11431 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
db-ux-design-system/core-web#8655 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
stripe/react-stripe-js#728 ·
-
[Upload Grade C dataset] the pop-up changes it's size while uploading the document => Jumping effect未關閉bug
難度 2/5 1-3 小時 新手友好度 66/100
epam/statgpt-admin-frontend#305 ·
維護者通常 1 天內回覆