From 24c94505659704fee71f97d50f3504d7500b1f9f Mon Sep 17 00:00:00 2001 From: cte Date: Thu, 21 Aug 2025 16:09:15 -0700 Subject: [PATCH 1/3] Pass task ID in the Roo provider request headers --- src/api/providers/base-openai-compatible-provider.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/providers/base-openai-compatible-provider.ts b/src/api/providers/base-openai-compatible-provider.ts index cb6331bab4..d2beb30240 100644 --- a/src/api/providers/base-openai-compatible-provider.ts +++ b/src/api/providers/base-openai-compatible-provider.ts @@ -85,7 +85,10 @@ export abstract class BaseOpenAiCompatibleProvider params.temperature = this.options.modelTemperature } - return this.client.chat.completions.create(params) + return this.client.chat.completions.create( + params, + metadata?.taskId ? { headers: { "X-Roo-Task-ID": metadata.taskId } } : undefined, + ) } override async *createMessage( From 87644d46cddd3072301a7ebf84134f5167dc6a87 Mon Sep 17 00:00:00 2001 From: cte Date: Thu, 21 Aug 2025 16:14:06 -0700 Subject: [PATCH 2/3] Only set header for Roo provider --- src/api/providers/base-openai-compatible-provider.ts | 6 ++---- src/api/providers/roo.ts | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api/providers/base-openai-compatible-provider.ts b/src/api/providers/base-openai-compatible-provider.ts index d2beb30240..d079e22a1c 100644 --- a/src/api/providers/base-openai-compatible-provider.ts +++ b/src/api/providers/base-openai-compatible-provider.ts @@ -66,6 +66,7 @@ export abstract class BaseOpenAiCompatibleProvider systemPrompt: string, messages: Anthropic.Messages.MessageParam[], metadata?: ApiHandlerCreateMessageMetadata, + requestOptions?: OpenAI.RequestOptions, ) { const { id: model, @@ -85,10 +86,7 @@ export abstract class BaseOpenAiCompatibleProvider params.temperature = this.options.modelTemperature } - return this.client.chat.completions.create( - params, - metadata?.taskId ? { headers: { "X-Roo-Task-ID": metadata.taskId } } : undefined, - ) + return this.client.chat.completions.create(params, requestOptions) } override async *createMessage( diff --git a/src/api/providers/roo.ts b/src/api/providers/roo.ts index d986d6cd10..3d5ef6d7c9 100644 --- a/src/api/providers/roo.ts +++ b/src/api/providers/roo.ts @@ -38,7 +38,12 @@ export class RooHandler extends BaseOpenAiCompatibleProvider { messages: Anthropic.Messages.MessageParam[], metadata?: ApiHandlerCreateMessageMetadata, ): ApiStream { - const stream = await this.createStream(systemPrompt, messages, metadata) + const stream = await this.createStream( + systemPrompt, + messages, + metadata, + metadata?.taskId ? { headers: { "X-Roo-Task-ID": metadata.taskId } } : undefined, + ) for await (const chunk of stream) { const delta = chunk.choices[0]?.delta From 9049272919d0251f7d09351d956704307ac5d4d0 Mon Sep 17 00:00:00 2001 From: cte Date: Thu, 21 Aug 2025 16:40:45 -0700 Subject: [PATCH 3/3] Fix tests --- src/api/providers/__tests__/chutes.spec.ts | 1 + src/api/providers/__tests__/fireworks.spec.ts | 1 + src/api/providers/__tests__/groq.spec.ts | 3 +++ src/api/providers/__tests__/roo.spec.ts | 3 +++ src/api/providers/__tests__/sambanova.spec.ts | 1 + src/api/providers/__tests__/zai.spec.ts | 1 + 6 files changed, 10 insertions(+) diff --git a/src/api/providers/__tests__/chutes.spec.ts b/src/api/providers/__tests__/chutes.spec.ts index 0ce1823087..22ac6d67e9 100644 --- a/src/api/providers/__tests__/chutes.spec.ts +++ b/src/api/providers/__tests__/chutes.spec.ts @@ -398,6 +398,7 @@ describe("ChutesHandler", () => { stream: true, stream_options: { include_usage: true }, }), + undefined, ) }) diff --git a/src/api/providers/__tests__/fireworks.spec.ts b/src/api/providers/__tests__/fireworks.spec.ts index 985a9edad8..e6f0467e08 100644 --- a/src/api/providers/__tests__/fireworks.spec.ts +++ b/src/api/providers/__tests__/fireworks.spec.ts @@ -356,6 +356,7 @@ describe("FireworksHandler", () => { stream: true, stream_options: { include_usage: true }, }), + undefined, ) }) diff --git a/src/api/providers/__tests__/groq.spec.ts b/src/api/providers/__tests__/groq.spec.ts index 7de7a04262..a943e84daa 100644 --- a/src/api/providers/__tests__/groq.spec.ts +++ b/src/api/providers/__tests__/groq.spec.ts @@ -145,6 +145,7 @@ describe("GroqHandler", () => { stream: true, stream_options: { include_usage: true }, }), + undefined, ) }) @@ -178,6 +179,7 @@ describe("GroqHandler", () => { messages: expect.arrayContaining([{ role: "system", content: systemPrompt }]), stream: true, }), + undefined, ) // Verify temperature is NOT included @@ -216,6 +218,7 @@ describe("GroqHandler", () => { messages: expect.arrayContaining([{ role: "system", content: systemPrompt }]), stream: true, }), + undefined, ) }) }) diff --git a/src/api/providers/__tests__/roo.spec.ts b/src/api/providers/__tests__/roo.spec.ts index 2d22f992a0..57b397b8f8 100644 --- a/src/api/providers/__tests__/roo.spec.ts +++ b/src/api/providers/__tests__/roo.spec.ts @@ -261,6 +261,7 @@ describe("RooHandler", () => { expect.objectContaining({ role: "user", content: "Second message" }), ]), }), + undefined, ) }) }) @@ -365,6 +366,7 @@ describe("RooHandler", () => { expect.not.objectContaining({ temperature: expect.anything(), }), + undefined, ) }) @@ -382,6 +384,7 @@ describe("RooHandler", () => { expect.objectContaining({ temperature: 0.9, }), + undefined, ) }) diff --git a/src/api/providers/__tests__/sambanova.spec.ts b/src/api/providers/__tests__/sambanova.spec.ts index 6757b7562f..81de3058c8 100644 --- a/src/api/providers/__tests__/sambanova.spec.ts +++ b/src/api/providers/__tests__/sambanova.spec.ts @@ -148,6 +148,7 @@ describe("SambaNovaHandler", () => { stream: true, stream_options: { include_usage: true }, }), + undefined, ) }) }) diff --git a/src/api/providers/__tests__/zai.spec.ts b/src/api/providers/__tests__/zai.spec.ts index 067f4344d5..6882cfe448 100644 --- a/src/api/providers/__tests__/zai.spec.ts +++ b/src/api/providers/__tests__/zai.spec.ts @@ -224,6 +224,7 @@ describe("ZAiHandler", () => { stream: true, stream_options: { include_usage: true }, }), + undefined, ) }) })