Skip to content

Commit 3c0c2fa

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
Wait for reviews before skipped-thread exit
1 parent 0218fb7 commit 3c0c2fa

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

apps/sim/executor/handlers/pi/babysit-backend.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,29 @@ describe('runBabysitPiWithOptions', () => {
365365
})
366366
})
367367

368+
it('waits for the requested bot review before stopping on skipped threads', async () => {
369+
mockFetchSnapshot.mockResolvedValue(snapshot)
370+
mockFetchThreads.mockResolvedValue({
371+
actionable: [],
372+
skipped: [trustedThread],
373+
totalUnresolved: 1,
374+
latestReview: null,
375+
})
376+
mockFetchChecks.mockResolvedValue(greenChecks)
377+
const { runner } = makeRunner({})
378+
mockWithPiSandbox.mockImplementation(async (callback) => callback(runner))
379+
380+
const result = await runBabysitPiWithOptions(params(), { onEvent: vi.fn() }, { roundWaitMs: 0 })
381+
382+
expect(mockReviewLanded).toHaveBeenCalledTimes(1)
383+
expect(result).toMatchObject({
384+
stopReason: 'skipped_threads',
385+
threadsClean: false,
386+
checksGreen: true,
387+
rounds: 0,
388+
})
389+
})
390+
368391
it('refuses excess failing checks before fetching discarded diagnostics', async () => {
369392
const failures = Array.from({ length: 21 }, (_, index) => ({
370393
...failingCheck,

apps/sim/executor/handlers/pi/babysit-backend.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,8 @@ export async function runBabysitPiWithOptions(
725725
if (
726726
latestThreads!.actionable.length === 0 &&
727727
latestThreads!.skipped.length > 0 &&
728-
latestChecks!.checksGreen
728+
latestChecks!.checksGreen &&
729+
!awaitingReview
729730
) {
730731
return resultFor(totals, 'skipped_threads', progress, false, true)
731732
}

0 commit comments

Comments
 (0)