test: drain the command's completion before checking it in child-work admission

The test polled for the compact turn's 'completed' state with vi.waitFor's 1 s
default while the completion committed through the child's event sink; on a
loaded runner (two CI runs) the commit outlasted the budget. It now flushes
the sink and checks once.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Brennan Benson
2026-11-16 02:19:42 -08:00
co-authored by Claude Opus 5.5
parent fd8198f001
commit ac2fe0fd6e
@@ -119,9 +119,9 @@ describe('conversation command admission reads the work the provider reported',
expect(await state.host.conversationCommand(CALLER, first)).toMatchObject({ ok: true })
await vi.waitFor(() => expect(compact).toHaveBeenCalledTimes(1))
finish()
await vi.waitFor(async () =>
expect(await commandTurnState(first.envelope.clientOperationId)).toBe('completed')
)
// The completion commits through the child's event sink; drain it instead of polling 1 s.
await state.host.flushStreamedEvents(HOST_TEST_SESSION)
expect(await commandTurnState(first.envelope.clientOperationId)).toBe('completed')
report([devServer()])
await vi.waitFor(() =>