Merge pull request #3455 from CHLK/fix/cli-run-premature-exit-with-background-tasks

fix(cli-run): prevent premature exit when background tasks are active
This commit is contained in:
YeonGyu-Kim
2026-05-04 23:58:34 +09:00
committed by GitHub
6 changed files with 56 additions and 3 deletions
+5
View File
@@ -20,6 +20,11 @@ export async function checkCompletionConditions(ctx: RunContext): Promise<boolea
return false
}
if (continuationState.hasActiveBackgroundTaskMarker) {
logWaiting(ctx, continuationState.activeHookMarkerReason ?? "background tasks are active")
return false
}
if (!await areAllChildrenIdle(ctx)) {
return false
}
+2
View File
@@ -16,6 +16,7 @@ export interface ContinuationState {
hasActiveRalphLoop: boolean
hasHookMarker: boolean
hasTodoHookMarker: boolean
hasActiveBackgroundTaskMarker: boolean
hasActiveHookMarker: boolean
activeHookMarkerReason: string | null
}
@@ -32,6 +33,7 @@ export async function getContinuationState(
hasActiveRalphLoop: hasActiveRalphLoopContinuation(directory, sessionID),
hasHookMarker: marker !== null,
hasTodoHookMarker: marker?.sources.todo !== undefined,
hasActiveBackgroundTaskMarker: marker?.sources["background-task"]?.state === "active",
hasActiveHookMarker: isContinuationMarkerActive(marker),
activeHookMarkerReason: getActiveContinuationMarkerReason(marker),
}