mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 04:04:17 +00:00
fix(ai): skip errored/aborted assistant messages in transform-messages
Fixes OpenAI Responses 400 error 'reasoning without following item' by skipping errored/aborted assistant messages entirely rather than filtering at the provider level. This covers openai-responses, openai-codex-responses, and future providers. Removes strictResponsesPairing compat option (no longer needed). Closes #838
This commit is contained in:
parent
abb1775ff7
commit
2d27a2c728
10 changed files with 109 additions and 52 deletions
|
|
@ -329,7 +329,7 @@ function convertAssistantMessage(msg: AssistantMessage): unknown[] {
|
|||
const output: unknown[] = [];
|
||||
|
||||
for (const block of msg.content) {
|
||||
if (block.type === "thinking" && msg.stopReason !== "error" && block.thinkingSignature) {
|
||||
if (block.type === "thinking" && block.thinkingSignature) {
|
||||
output.push(JSON.parse(block.thinkingSignature));
|
||||
} else if (block.type === "text") {
|
||||
output.push({
|
||||
|
|
@ -338,7 +338,7 @@ function convertAssistantMessage(msg: AssistantMessage): unknown[] {
|
|||
content: [{ type: "output_text", text: sanitizeSurrogates(block.text), annotations: [] }],
|
||||
status: "completed",
|
||||
});
|
||||
} else if (block.type === "toolCall" && msg.stopReason !== "error") {
|
||||
} else if (block.type === "toolCall") {
|
||||
const [callId, id] = block.id.split("|");
|
||||
output.push({
|
||||
type: "function_call",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue