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:
@@ -128,14 +128,22 @@ export function createAtlasEventHandler(input: {
|
|||||||
state.pendingRetryTimer = setTimeout(async () => {
|
state.pendingRetryTimer = setTimeout(async () => {
|
||||||
state.pendingRetryTimer = undefined
|
state.pendingRetryTimer = undefined
|
||||||
|
|
||||||
|
if (state.promptFailureCount >= 2) return
|
||||||
|
|
||||||
const currentBoulder = readBoulderState(ctx.directory)
|
const currentBoulder = readBoulderState(ctx.directory)
|
||||||
if (!currentBoulder) return
|
if (!currentBoulder) return
|
||||||
|
if (!currentBoulder.session_ids?.includes(sessionID)) return
|
||||||
|
|
||||||
const currentProgress = getPlanProgress(currentBoulder.active_plan)
|
const currentProgress = getPlanProgress(currentBoulder.active_plan)
|
||||||
if (currentProgress.isComplete) return
|
if (currentProgress.isComplete) return
|
||||||
|
|
||||||
if (options?.isContinuationStopped?.(sessionID)) 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()
|
state.lastContinuationInjectedAt = Date.now()
|
||||||
const currentRemaining = currentProgress.total - currentProgress.completed
|
const currentRemaining = currentProgress.total - currentProgress.completed
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user