From f4e4f68758e4962e171e678acac4bdfca4be7c66 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Sat, 16 May 2026 21:44:16 -0700 Subject: [PATCH] fix(ci): give planning smoke enough time --- .../src/lib/verify-shared-deployment.spec.ts | 15 ++++++++ scripts/verify-shared-deployment.ts | 34 +++++++++++++++---- 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 apps/cockpit/src/lib/verify-shared-deployment.spec.ts diff --git a/apps/cockpit/src/lib/verify-shared-deployment.spec.ts b/apps/cockpit/src/lib/verify-shared-deployment.spec.ts new file mode 100644 index 000000000..98cdf713a --- /dev/null +++ b/apps/cockpit/src/lib/verify-shared-deployment.spec.ts @@ -0,0 +1,15 @@ +import { describe, expect, it } from 'vitest'; + +import { + DEFAULT_SMOKE_ASSISTANT_STREAM_TIMEOUT_MS, + getSmokeAssistantStreamTimeoutMs, +} from '../../../../scripts/verify-shared-deployment'; + +describe('verify-shared-deployment', () => { + it('allows the two-pass planning graph more time than single-response smoke assistants', () => { + expect(getSmokeAssistantStreamTimeoutMs('planning')).toBe(90000); + expect(getSmokeAssistantStreamTimeoutMs('streaming')).toBe( + DEFAULT_SMOKE_ASSISTANT_STREAM_TIMEOUT_MS, + ); + }); +}); diff --git a/scripts/verify-shared-deployment.ts b/scripts/verify-shared-deployment.ts index 83047b15e..cc521f77b 100644 --- a/scripts/verify-shared-deployment.ts +++ b/scripts/verify-shared-deployment.ts @@ -8,6 +8,7 @@ */ import { readFileSync } from 'fs'; import { resolve } from 'path'; +import { pathToFileURL } from 'url'; type DeploymentUrls = Record; @@ -28,7 +29,23 @@ const SMOKE_ASSISTANT_IDS = [ 'chat', ] as const; +type SmokeAssistantId = (typeof SMOKE_ASSISTANT_IDS)[number]; + const DEPLOYMENT_URLS_PATH = resolve(__dirname, '../deployment-urls.json'); +export const DEFAULT_SMOKE_ASSISTANT_STREAM_TIMEOUT_MS = 30000; + +const SMOKE_ASSISTANT_STREAM_TIMEOUT_MS: Partial> = { + // The planning graph intentionally performs two model calls: one to create + // structured plan state, then one to execute the plan and answer. + planning: 90000, +}; + +export function getSmokeAssistantStreamTimeoutMs(assistantId: SmokeAssistantId) { + return ( + SMOKE_ASSISTANT_STREAM_TIMEOUT_MS[assistantId] ?? + DEFAULT_SMOKE_ASSISTANT_STREAM_TIMEOUT_MS + ); +} function parseArgs(argv: string[]) { return { @@ -128,8 +145,9 @@ async function createThread(url: string) { return threadId; } -async function smokeAssistant(url: string, assistantId: string) { +async function smokeAssistant(url: string, assistantId: SmokeAssistantId) { const threadId = await createThread(url); + const timeoutMs = getSmokeAssistantStreamTimeoutMs(assistantId); const runRes = await fetch(`${url}/threads/${threadId}/runs/stream`, { method: 'POST', headers: { 'Content-Type': 'application/json', ...authHeaders() }, @@ -138,7 +156,7 @@ async function smokeAssistant(url: string, assistantId: string) { input: { messages: [{ role: 'human', content: 'hello' }] }, stream_mode: ['values'], }), - signal: AbortSignal.timeout(30000), + signal: AbortSignal.timeout(timeoutMs), }); const text = await runRes.text(); @@ -198,8 +216,10 @@ async function main() { } } -main().catch((error) => { - const message = error instanceof Error ? error.message : String(error); - console.error(`❌ shared deployment verification failed — ${message}`); - process.exit(1); -}); +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + main().catch((error) => { + const message = error instanceof Error ? error.message : String(error); + console.error(`❌ shared deployment verification failed — ${message}`); + process.exit(1); + }); +}