From ad04816b86cb3ac44915b5a4fa0edec5c580658d Mon Sep 17 00:00:00 2001 From: qwen-code-dev-bot Date: Fri, 31 Jul 2026 15:22:57 +0000 Subject: [PATCH 1/3] fix(integration): use QWEN_CODE_TEST_CRON_FAST in acp-cron test (#8237) The acp-cron E2E test relied on real minute-boundary cron timing, waiting up to 75s for the scheduler to fire. This made it flaky in CI where timing is unpredictable. The interactive cron test already uses the QWEN_CODE_TEST_CRON_FAST test seam to auto-fire after 5s; apply the same approach here and reduce the wait timeout to 30s. --- integration-tests/cli/acp-cron.test.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/integration-tests/cli/acp-cron.test.ts b/integration-tests/cli/acp-cron.test.ts index 3209f8e53f2..c15bea6c86a 100644 --- a/integration-tests/cli/acp-cron.test.ts +++ b/integration-tests/cli/acp-cron.test.ts @@ -12,8 +12,9 @@ * even after the originating prompt has already returned. * * Uses fake-openai-server for deterministic model responses, eliminating - * model output variance as a failure source. The cron scheduler still - * operates on real minute-boundary timing. + * model output variance as a failure source. The QWEN_CODE_TEST_CRON_FAST + * test seam auto-fires cron jobs after a short delay instead of waiting + * for the wall-clock minute boundary. */ import { spawn } from 'node:child_process'; @@ -110,6 +111,10 @@ function setupAcpCronTest(rig: TestRig, fakeServer: FakeOpenAIServer) { // Defends against an ambient proxy intercepting the local fake server. NO_PROXY: '127.0.0.1,localhost', no_proxy: '127.0.0.1,localhost', + // Enable the CronScheduler test seam: newly created session-only + // jobs auto-fire after 5s instead of waiting for the wall-clock + // minute boundary (see cron-interactive.test.ts). + QWEN_CODE_TEST_CRON_FAST: '1', }, }, ); @@ -390,10 +395,11 @@ async function initSession( })) as { stopReason: string }; expect(interactiveResult.stopReason).toBe('end_turn'); - // --- Part 3: Wait for cron-fired notification (up to 75s) --- - // The cron fires at the next minute boundary. The model response - // should stream back as sessionUpdate notifications after the - // originating prompt has already returned. + // --- Part 3: Wait for cron-fired notification --- + // With QWEN_CODE_TEST_CRON_FAST the job auto-fires ~5s after + // creation. The model response should stream back as + // sessionUpdate notifications after the originating prompt has + // already returned. // 3a: Check for user_message_chunk echoing the cron prompt with _meta.source const cronUserMsg = await waitForSessionUpdate( @@ -402,7 +408,7 @@ async function initSession( (u.update?.content?.text ?? '').includes('CRONFIRE7742') && u.receivedAt > promptDoneAt, 'cron-fired user_message_chunk with CRONFIRE7742', - 75_000, + 30_000, ); expect(cronUserMsg.update?._meta).toBeDefined(); expect(cronUserMsg.update?._meta?.source).toBe('cron'); From e998ad98cb11572b366c3c4dd29a1a6e226d962b Mon Sep 17 00:00:00 2001 From: Qwen Code Bot Date: Sat, 1 Aug 2026 00:06:58 +0000 Subject: [PATCH 2/3] fix(test): pin cron delay and fix stale timeout comment (#8237) --- integration-tests/cli/acp-cron.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integration-tests/cli/acp-cron.test.ts b/integration-tests/cli/acp-cron.test.ts index c15bea6c86a..3afcdf1a444 100644 --- a/integration-tests/cli/acp-cron.test.ts +++ b/integration-tests/cli/acp-cron.test.ts @@ -115,6 +115,7 @@ function setupAcpCronTest(rig: TestRig, fakeServer: FakeOpenAIServer) { // jobs auto-fire after 5s instead of waiting for the wall-clock // minute boundary (see cron-interactive.test.ts). QWEN_CODE_TEST_CRON_FAST: '1', + QWEN_CODE_TEST_CRON_DELAY_MS: '5000', }, }, ); @@ -375,7 +376,7 @@ async function initSession( // Fail fast if the cron_create tool call was not served to the first // user prompt. An internal model call before the first prompt (title // generation, a classifier pass) would shift dispatch and otherwise - // surface only as an opaque 75s timeout in Part 3. + // surface only as an opaque 30s timeout in Part 3a. expect( JSON.stringify(fakeServer.requests[0]?.body['messages']), 'requestIndex 0 was not the cron_create prompt — dispatch shifted', From ea063415faa117d454004b0a768e8280732e4d77 Mon Sep 17 00:00:00 2001 From: Qwen Code Bot Date: Sat, 1 Aug 2026 02:09:39 +0000 Subject: [PATCH 3/3] fix(integration): restore 75s cron-fire fallback timeout in acp-cron (#8237) --- integration-tests/cli/acp-cron.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/cli/acp-cron.test.ts b/integration-tests/cli/acp-cron.test.ts index 3afcdf1a444..ed46c9d030d 100644 --- a/integration-tests/cli/acp-cron.test.ts +++ b/integration-tests/cli/acp-cron.test.ts @@ -376,7 +376,7 @@ async function initSession( // Fail fast if the cron_create tool call was not served to the first // user prompt. An internal model call before the first prompt (title // generation, a classifier pass) would shift dispatch and otherwise - // surface only as an opaque 30s timeout in Part 3a. + // surface only as an opaque 75s timeout in Part 3a. expect( JSON.stringify(fakeServer.requests[0]?.body['messages']), 'requestIndex 0 was not the cron_create prompt — dispatch shifted', @@ -409,7 +409,7 @@ async function initSession( (u.update?.content?.text ?? '').includes('CRONFIRE7742') && u.receivedAt > promptDoneAt, 'cron-fired user_message_chunk with CRONFIRE7742', - 30_000, + 75_000, ); expect(cronUserMsg.update?._meta).toBeDefined(); expect(cronUserMsg.update?._meta?.source).toBe('cron');