fix(atlas): add full eligibility checks to delayed retry callback

Address Cubic P1 review: timer callback now re-checks failure backoff
count, boulder session membership, and running background tasks before
injecting continuation, matching the main idle handler's eligibility
gate.
This commit is contained in:
YeonGyu-Kim
2026-03-06 16:31:48 +09:00
parent cecb78e944
commit 4eb38d99d2

View File

@@ -128,14 +128,22 @@ export function createAtlasEventHandler(input: {
state.pendingRetryTimer = setTimeout(async () => {
state.pendingRetryTimer = undefined
if (state.promptFailureCount >= 2) return
const currentBoulder = readBoulderState(ctx.directory)
if (!currentBoulder) return
if (!currentBoulder.session_ids?.includes(sessionID)) return
const currentProgress = getPlanProgress(currentBoulder.active_plan)
if (currentProgress.isComplete) return
if (options?.isContinuationStopped?.(sessionID)) return
const hasBgTasks = backgroundManager
? backgroundManager.getTasksByParentSession(sessionID).some((t: { status: string }) => t.status === "running")
: false
if (hasBgTasks) return
state.lastContinuationInjectedAt = Date.now()
const currentRemaining = currentProgress.total - currentProgress.completed
try {