fix(core): Raise AI Assistant model verification token limit (#36787)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jaakko Husso
2026-08-21 08:11:56 +00:00
committed by GitHub
parent 8582dd5185
commit 655270bf78
2 changed files with 9 additions and 2 deletions
@@ -105,7 +105,8 @@ describe('InstanceAiVerificationService', () => {
);
expect(createModelMock).toHaveBeenCalledWith(modelConfig, expect.any(Function));
expect(generateTextMock).toHaveBeenCalledWith(
expect.objectContaining({ prompt: 'Reply with OK.', maxOutputTokens: 8 }),
// OpenAI's Responses API rejects max_output_tokens below 16.
expect.objectContaining({ prompt: 'Reply with OK.', maxOutputTokens: 16 }),
);
});
@@ -26,6 +26,12 @@ const VERIFICATION_TIMEOUT_MS = 30_000;
const MAX_ERROR_MESSAGE_LENGTH = 512;
/**
* The probe only needs the call to succeed, not its text, but OpenAI's
* Responses API rejects `max_output_tokens` below 16.
*/
const VERIFICATION_MAX_OUTPUT_TOKENS = 16;
/**
* Providers can echo credentials back in error messages. Scrub known secret
* shapes (API keys, bearer tokens, key=value pairs), drop URL query strings
@@ -135,7 +141,7 @@ export class InstanceAiVerificationService {
await generateText({
model: createModel(modelConfig, createAiProxyFetch(this.outboundHttp)),
prompt: 'Reply with OK.',
maxOutputTokens: 8,
maxOutputTokens: VERIFICATION_MAX_OUTPUT_TOKENS,
abortSignal: AbortSignal.timeout(VERIFICATION_TIMEOUT_MS),
});
return { ok: true, latencyMs: Math.round(performance.now() - startedAt) };