fix(tooling): surface non-executable tool-use warnings

This commit is contained in:
William Valentin
2026-02-17 16:34:54 -08:00
parent 061b96fd68
commit 5451f8a1de
6 changed files with 126 additions and 4 deletions
+36
View File
@@ -69,4 +69,40 @@ describe('OpenAIClient OAuth (Codex)', () => {
expect(resp.content).toBe('hello');
expect(resp.usage).toEqual({ inputTokens: 2, outputTokens: 2 });
});
it('adds provider warning when tools are requested in OAuth mode', async () => {
const sse = makeSse([
{ event: 'response.output_text.delta', data: { type: 'response.output_text.delta', delta: 'result body' } },
{ event: 'response.completed', data: { type: 'response.completed', response: { usage: { input_tokens: 1, output_tokens: 1 } } } },
]);
globalThis.fetch = vi.fn(async () => {
const stream = new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode(sse));
controller.close();
},
});
return new Response(stream, { status: 200 });
}) as typeof fetch;
const client = new OpenAIClient({ model: 'gpt-5.3-codex', useOAuth: true });
const resp = await client.chat({
system: 'You are helpful.',
messages: [{ role: 'user', content: 'use tools' }],
tools: [{
name: 'gmail_read',
description: 'Read Gmail message',
input_schema: {
type: 'object',
properties: { id: { type: 'string' } },
required: ['id'],
},
}],
});
expect(resp.content).toContain('[provider-warning] OpenAI OAuth (Codex backend) does not support tool execution in Flynn yet.');
expect(resp.content).toContain('Requested tools were not sent to the provider');
expect(resp.content).toContain('result body');
});
});