Skip to content

Commit ca74d24

Browse files
committed
fix(chat): update reasoning_opaque handling to accept latest value in multi-turn responses
1 parent 7688837 commit ca74d24

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,15 +444,11 @@ export class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
444444

445445
const delta = choice.delta
446446

447-
// Capture reasoning_opaque for Copilot multi-turn reasoning
447+
// Capture reasoning_opaque for Copilot multi-turn reasoning.
448+
// The API may send reasoning_opaque in multiple delta chunks
449+
// (e.g. once with reasoning text, once with tool calls), so
450+
// accept the latest value instead of rejecting duplicates.
448451
if (delta.reasoning_opaque) {
449-
if (reasoningOpaque != null) {
450-
throw new InvalidResponseDataError({
451-
data: delta,
452-
message:
453-
"Multiple reasoning_opaque values received in a single response. Only one thinking part per response is supported.",
454-
})
455-
}
456452
reasoningOpaque = delta.reasoning_opaque
457453
}
458454

0 commit comments

Comments
 (0)