fix(core): preserve the first terminal failure (#37705)

This commit is contained in:
Kit Langton 2026-07-19 00:00:23 -04:00 committed by GitHub
commit ba0bbdafaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 35 additions and 39 deletions

View file

@ -84,8 +84,6 @@ const toolCall = (route: string, tool: PendingTool, inputOverride?: string) => {
id: tool.id,
name: tool.name,
raw,
message: error.reason.message,
providerMetadata: tool.providerMetadata,
}),
),
),

View file

@ -150,14 +150,12 @@ export const ToolInputEnd = Schema.Struct({
}).annotate({ identifier: "LLM.Event.ToolInputEnd" })
export type ToolInputEnd = Schema.Schema.Type<typeof ToolInputEnd>
/** A local tool call that could not be decoded. `raw` is diagnostic-only. */
/** A local tool call whose final input could not be decoded. */
export const ToolInputError = Schema.Struct({
type: Schema.tag("tool-input-error"),
id: ToolCallID,
name: Schema.String,
raw: Schema.String,
message: Schema.String,
providerMetadata: Schema.optional(ProviderMetadata),
}).annotate({ identifier: "LLM.Event.ToolInputError" })
export type ToolInputError = Schema.Schema.Type<typeof ToolInputError>

View file

@ -1290,8 +1290,6 @@ describe("OpenAI Responses route", () => {
id: "call_1",
name: "lookup",
raw: '{"query":"partial',
message: "Invalid JSON input for openai-responses tool call lookup",
providerMetadata: { openai: { itemId: "item_1" } },
})
expect(response.finishReason).toBe("tool-calls")
expect(response.events.some(LLMEvent.is.toolCall)).toBeFalse()

View file

@ -104,7 +104,6 @@ describe("LLMResponse reducer", () => {
id: "call_1",
name: "lookup",
raw: '{"query":"partial',
message: "Invalid JSON input",
}),
])

View file

@ -81,7 +81,6 @@ describe("ToolStream", () => {
id: "call_1",
name: "lookup",
raw: '{"query":"partial',
message: "Invalid JSON input for test-route tool call lookup",
},
],
})
@ -112,7 +111,6 @@ describe("ToolStream", () => {
id: "call_invalid",
name: "lookup",
raw: '{"query":"partial',
message: "Invalid JSON input for test-route tool call lookup",
},
],
})