mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 11:48:38 +00:00
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:
committed by
Peter Steinberger
parent
252079f001
commit
eae13d9367
@@ -298,7 +298,7 @@ describe("sanitizeSessionHistory", () => {
|
|||||||
expect(result[1]?.role).toBe("assistant");
|
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 = [
|
const messages = [
|
||||||
{
|
{
|
||||||
role: "assistant",
|
role: "assistant",
|
||||||
@@ -314,8 +314,11 @@ describe("sanitizeSessionHistory", () => {
|
|||||||
sessionId: TEST_SESSION_ID,
|
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[0]?.role).toBe("assistant");
|
||||||
|
expect(result[1]?.role).toBe("toolResult");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("drops malformed tool calls missing input or arguments", async () => {
|
it("drops malformed tool calls missing input or arguments", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user