test(agents): update test to match universal tool-result repair for OpenAI

The previous test asserted that OpenAI-responses sessions would NOT get
synthetic tool results for orphaned tool calls. With repairToolUseResultPairing
now running universally, the correct behavior is that orphaned tool calls
get a synthetic tool_result — matching what OpenAI actually requires.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit 2edb0ffe0b)
This commit is contained in:
Ben Marvell
2026-02-23 14:37:56 +00:00
committed by Peter Steinberger
parent 252079f001
commit eae13d9367

View File

@@ -298,7 +298,7 @@ describe("sanitizeSessionHistory", () => {
expect(result[1]?.role).toBe("assistant");
});
it("does not synthesize tool results for openai-responses", async () => {
it("synthesizes missing tool results for openai-responses after repair", async () => {
const messages = [
{
role: "assistant",
@@ -314,8 +314,11 @@ describe("sanitizeSessionHistory", () => {
sessionId: TEST_SESSION_ID,
});
expect(result).toHaveLength(1);
// repairToolUseResultPairing now runs for all providers (including OpenAI)
// to fix orphaned function_call_output items that OpenAI would reject.
expect(result).toHaveLength(2);
expect(result[0]?.role).toBe("assistant");
expect(result[1]?.role).toBe("toolResult");
});
it("drops malformed tool calls missing input or arguments", async () => {