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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user