if (closing && !cancelled())
await step('closing statements'), await runClosing()
if (closing && runVote && !cancelled()) await step('voting'), await runVote(rounds, [...turns])
if ((synthInterval === Infinity || closing || remaining.length) && !cancelled())
await step('synthesizing'), await runSynthesis(0)
const
synthFailed = !cancelled() && synthSelector !== undefined && telemetry.findLast(t => t.phase === 'synthesis')?.contentIndex === undefined,
shortfall = cancelled() ? null : budgetShortfall(telemetry, used(), tokenBudget, errors.budgetExhausted),
tail = (cancelled()
? [errors.cancelled]
: [synthFailed ? fill(errors.synthFailed, { synth: synthSelector! }) : null, shortfall]
).filter(t => t !== null).map(text => ({ type: 'text' as const, text }))
await step(cancelled()
? 'cancelled'