fix(opencode): preserve signed thinking during anthropic reorder (#30182)
This commit is contained in:
@@ -230,6 +230,18 @@ function normalizeMessages(
|
||||
const parts = msg.content
|
||||
const first = parts.findIndex((part) => part.type === "tool-call")
|
||||
if (first === -1) return [msg]
|
||||
// Anthropic signs thinking blocks, so moving them during replay invalidates the request.
|
||||
if (
|
||||
parts
|
||||
.slice(first)
|
||||
.some(
|
||||
(part) =>
|
||||
part.type === "reasoning" &&
|
||||
(part.providerOptions?.anthropic?.signature != null ||
|
||||
part.providerOptions?.anthropic?.redactedData != null),
|
||||
)
|
||||
)
|
||||
return [msg]
|
||||
if (!parts.slice(first).some((part) => part.type !== "tool-call")) return [msg]
|
||||
return [
|
||||
{ ...msg, content: parts.filter((part) => part.type !== "tool-call") },
|
||||
|
||||
Reference in New Issue
Block a user