From 1b1bd68e1be9d82f45a562cf518f263624cc1b95 Mon Sep 17 00:00:00 2001 From: Danyang Chen Date: Fri, 30 Oct 2026 20:46:22 +0800 Subject: [PATCH] test(retired-bot-paths): wait for both reviews instead of fixed settles (#1833) The #1786 assertion waited for m1's memory file, then two fixed settle() ticks, and read whatever requests had arrived. On a busy CI runner the second review (b3) landed after those ticks, so the assertion saw ['m1'] and failed. Wait for the deterministic condition instead: both reviews recorded and m1's memory written. The retired Bot (b2) must still stay out of requests. Docs-not-needed: test-only change to one timing assertion and its patch mirror. --- core/test/retired-bot-paths.test.js | 7 ++++--- patches/ds-bot/files/test/retired-bot-paths.test.js | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/test/retired-bot-paths.test.js b/core/test/retired-bot-paths.test.js index f62a0fe3..a14d1bf8 100644 --- a/core/test/retired-bot-paths.test.js +++ b/core/test/retired-bot-paths.test.js @@ -584,9 +584,10 @@ test('#1786: a retired Bot is not brought along by a lagging review, while a liv assert.match(await tool('archive_bot', { bot: 'Writer' }, 'm1'), /^Archived Writer\./) // Coder's turn ends: it is the member that brings the others along. ctx.emit('agent/status', { agent: { id: 'g3' }, status: 'idle' }) - await waitFor(() => (existsSync(memoryFile('m1')) ? true : undefined)) - await settle() - await settle() + // Deterministic: the two reviews this turn launches (the member that ended and the + // live lagging member) are async. Wait for both to be recorded rather than for a fixed + // number of ticks, which is what made this assertion race on a busy CI runner. + await waitFor(() => (requests.length >= 2 && existsSync(memoryFile('m1')) ? true : undefined)) // Coder's own turn and the live lagging member are reviewed; the retired Bot is not. assert.deepEqual(requests.map(request => request.sessionId).sort(), ['b3', 'm1'], `only live members are reviewed: ${JSON.stringify(requests.map(request => request.sessionId))}`) diff --git a/patches/ds-bot/files/test/retired-bot-paths.test.js b/patches/ds-bot/files/test/retired-bot-paths.test.js index f62a0fe3..a14d1bf8 100644 --- a/patches/ds-bot/files/test/retired-bot-paths.test.js +++ b/patches/ds-bot/files/test/retired-bot-paths.test.js @@ -584,9 +584,10 @@ test('#1786: a retired Bot is not brought along by a lagging review, while a liv assert.match(await tool('archive_bot', { bot: 'Writer' }, 'm1'), /^Archived Writer\./) // Coder's turn ends: it is the member that brings the others along. ctx.emit('agent/status', { agent: { id: 'g3' }, status: 'idle' }) - await waitFor(() => (existsSync(memoryFile('m1')) ? true : undefined)) - await settle() - await settle() + // Deterministic: the two reviews this turn launches (the member that ended and the + // live lagging member) are async. Wait for both to be recorded rather than for a fixed + // number of ticks, which is what made this assertion race on a busy CI runner. + await waitFor(() => (requests.length >= 2 && existsSync(memoryFile('m1')) ? true : undefined)) // Coder's own turn and the live lagging member are reviewed; the retired Bot is not. assert.deepEqual(requests.map(request => request.sessionId).sort(), ['b3', 'm1'], `only live members are reviewed: ${JSON.stringify(requests.map(request => request.sessionId))}`)