Flush throttled subagent text in ACP finalizeTurn

After the turn ends the run fiber that routes child-thread events may be
gone, so text left to the coalescer's timer flush could drop the tail of
a subagent stream (cursor bugbot review finding on the coalescer).

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Fable 5 committed 2026-07-12 11:52:08 +02:00
1 parent 63b64f489c
commit ac3dc22a5e
1 file changed
+8
@@ -2054,6 +2054,14 @@ export function makeAcpAdapterV2(options: AcpAdapterV2Options): ProviderAdapterV
if (context.finalized) return;
context.finalized = true;
yield* closeTextStreams(context);
// Persist any throttled subagent text now: after the turn ends the
// run fiber that routes child-thread events may be gone, so waiting
// for the coalescer's timer flush could drop the tail of a stream.
for (const subagent of context.subagents.values()) {
if (subagent.streamPendingText) {
yield* flushSubagentAssistant(subagent);
}
}
const now = yield* DateTime.now;
const turn = providerTurnPayload(context, status, now);
yield* Ref.update(providerTurns, (current) => {