fix: task subagent static race main (#843)

This commit is contained in:
Charles Packer
2026-02-05 18:15:43 -08:00
committed by GitHub
parent ee28095ebc
commit 2b7d618b39
3 changed files with 287 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
import type { Buffers } from "./accumulator.js";
/**
* Completed subagents should only be cleared on true new turns.
* During allowReentry (post-approval continuation), completed subagents
* must remain available so deferred Task grouping can still resolve.
*/
export function shouldClearCompletedSubagentsOnTurnStart(
allowReentry: boolean,
hasActiveSubagents: boolean,
): boolean {
return !allowReentry && !hasActiveSubagents;
}
/**
* Flush static-eligible lines before reentry so Task grouping is not delayed
* by deferred non-Task tool commits.
*/
export function flushEligibleLinesBeforeReentry(
commitEligibleLines: (
b: Buffers,
opts?: { deferToolCalls?: boolean },
) => void,
buffers: Buffers,
): void {
commitEligibleLines(buffers, { deferToolCalls: false });
}