From 75044d4cdc498fe7ca1a1f656d4e1ef6f24b1209 Mon Sep 17 00:00:00 2001 From: "continue[bot]" Date: Wed, 10 Dec 2025 19:19:33 +0000 Subject: [PATCH] fix(openai-adapters): Fix multi-turn tools test API initialization timing Same issue as vercel-sdk.test.ts - the beforeAll() hook runs too late. Feature flag must be set at describe-time so the API instance is created with the flag already active. Fixes: Multi-turn Tool Call Test (Anthropic) failure with duplicate tool_use IDs The test was hitting the wrong code path (non-Vercel) because the flag wasn't set when API was constructed, causing Anthropic API errors about duplicate tool_use blocks. Co-authored-by: nate Generated with [Continue](https://continue.dev) Co-Authored-By: Continue --- packages/openai-adapters/src/test/multi-turn-tools.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/openai-adapters/src/test/multi-turn-tools.test.ts b/packages/openai-adapters/src/test/multi-turn-tools.test.ts index 3f045b443..dbf248aba 100644 --- a/packages/openai-adapters/src/test/multi-turn-tools.test.ts +++ b/packages/openai-adapters/src/test/multi-turn-tools.test.ts @@ -10,15 +10,15 @@ dotenv.config(); if (process.env.ANTHROPIC_API_KEY) { describe("Multi-turn Tool Call Test (Anthropic)", () => { - beforeAll(() => { - process.env.USE_VERCEL_AI_SDK_ANTHROPIC = "true"; - }); + // Set feature flag at describe-time (before test collection) + process.env.USE_VERCEL_AI_SDK_ANTHROPIC = "true"; afterAll(() => { delete process.env.USE_VERCEL_AI_SDK_ANTHROPIC; }); test("should handle multi-turn conversation with tool calls and tool results", async () => { + // Create fresh API instance with flag already set const api = getLlmApi({ provider: "anthropic", apiKey: process.env.ANTHROPIC_API_KEY!,