fix(ai): send drop_block for OpenCode Zen and Go Claude models

Enable per-message effort for OpenCode Claude models that support it, which
also sends thinking.block_binding drop_block. OpenCode Go rejected replayed
thinking with a 400 after the tool list or system prompt changed.

closes #10954
This commit is contained in:
David Brailovsky 2026-11-02 12:35:31 +01:00
parent 7b991fd96a
commit 9ee7586a95
2 changed files with 12 additions and 1 deletions

View file

@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed OpenCode Go Claude Haiku 5.5 failing with a 400 (`Invalid signature in thinking block ... bound to a different conversation`) after the tool list, system prompt, or earlier history changed, which left the session failing on every retry. OpenCode Go and Zen Claude 5.5 models, Opus 5, and Fable 5.1 now use per-message effort and send `thinking.block_binding: drop_block`, like the Anthropic provider ([#10954](https://github.com/earendil-works/pi/issues/10954))
## [1.5.0] - 2026-11-02
### Breaking Changes

View file

@ -7,7 +7,11 @@ import {
modelsDevModels,
type ProviderContext,
} from "../define.ts";
import { supportsClaudeMidConvoSystemMessages } from "../families/anthropic.ts";
import {
enableClaudeMidConvoEffort,
supportsClaudeMidConvoEffort,
supportsClaudeMidConvoSystemMessages,
} from "../families/anthropic.ts";
import { googleThinkingLevels } from "../families/google.ts";
import { isKimiK3FamilyId } from "../families/kimi.ts";
import { enableOpenAiGrammarTools, enableOpenAiMidConvoSystemMessages } from "../families/openai.ts";
@ -162,6 +166,9 @@ export function finalizeOpencodeModel(model: ChatModel): void {
if (model.provider === "opencode" && supportsClaudeMidConvoSystemMessages(model.id)) {
mergeCompat(messagesModel, { supportsMidConvoSystemMessages: true });
}
// Zen and Go forward per-message effort and `thinking.block_binding`. Without
// `drop_block`, Go rejects replayed thinking after the system prompt or tools change.
if (supportsClaudeMidConvoEffort(model.id)) enableClaudeMidConvoEffort(messagesModel);
// OpenCode Qwen 3.8 Flash emits and accepts thinking blocks with empty signatures.
if (model.id === "qwen3.8-flash") mergeCompat(messagesModel, { allowEmptySignature: true });
}