@@ -41,7 +41,12 @@ import {
4141import { logAuditEvent } from "./audit-logger.js" ;
4242import { checkBudget as checkBudgetThresholds , initBudget } from "./budget-monitor.js" ;
4343import { recordCost } from "./cost-tracker.js" ;
44- import { allTasksTerminal , getReadyTasks , getUnreachableTasks , hasFailedTasks } from "./dag-executor.js" ;
44+ import {
45+ allTasksTerminal ,
46+ getReadyTasks ,
47+ getUnreachableTasks ,
48+ hasFailedTasks ,
49+ } from "./dag-executor.js" ;
4550import { storeFailure } from "./failure-store.js" ;
4651import { createHealingProject , shouldAutoHeal } from "./healing-engine.js" ;
4752import { extractPatternsFromRun } from "./knowledge-store.js" ;
@@ -297,7 +302,9 @@ export async function executeNextWave(runId: string): Promise<Result<AgentState[
297302 }
298303
299304 const readyTasks = getReadyTasks ( run . plan . tasks ) ;
300- console . log ( `[executeNextWave] readyTasks=${ readyTasks . length } ids=[${ readyTasks . map ( ( t ) => t . id ) . join ( ", " ) } ]` ) ;
305+ console . log (
306+ `[executeNextWave] readyTasks=${ readyTasks . length } ids=[${ readyTasks . map ( ( t ) => t . id ) . join ( ", " ) } ]` ,
307+ ) ;
301308
302309 if ( readyTasks . length === 0 ) {
303310 // Defer any PENDING tasks blocked by failed dependencies (unreachable)
@@ -450,16 +457,17 @@ export async function completeTask(
450457 // to avoid Phi-4/catalog model JSON parsing failures in the verifier
451458 const retryCount = run . retryCountByTask [ taskId ] ?? 0 ;
452459 const baseVerifierDecision = router . route ( AgentRole . Verifier , task . sigmaEstimate ) ;
453- const verifierDecision = pendingFix || retryCount > 0
454- ? {
455- ...baseVerifierDecision ,
456- model : "gpt-4o-mini" ,
457- providerConfig : baseVerifierDecision . providerConfig
458- ? { ...baseVerifierDecision . providerConfig , model : "gpt-4o-mini" }
459- : baseVerifierDecision . providerConfig ,
460- reason : `${ baseVerifierDecision . reason } (escalated: retry/fix re-verify)` ,
461- }
462- : baseVerifierDecision ;
460+ const verifierDecision =
461+ pendingFix || retryCount > 0
462+ ? {
463+ ...baseVerifierDecision ,
464+ model : "gpt-4o-mini" ,
465+ providerConfig : baseVerifierDecision . providerConfig
466+ ? { ...baseVerifierDecision . providerConfig , model : "gpt-4o-mini" }
467+ : baseVerifierDecision . providerConfig ,
468+ reason : `${ baseVerifierDecision . reason } (escalated: retry/fix re-verify)` ,
469+ }
470+ : baseVerifierDecision ;
463471 routingLog . push ( verifierDecision ) ;
464472 const verifier = await spawnAgent ( runId , AgentRole . Verifier , taskId , verifierDecision . model ) ;
465473 await updateAgentStatus ( verifier . agentId , AgentStatus . Executing ) ;
@@ -484,7 +492,9 @@ export async function completeTask(
484492 pushEvent ( run , agentId , agentRole , "TASK_COMPLETED" , `Task ${ taskId } completed` ) ;
485493 checkpointRun ( run ) ;
486494
487- console . log ( `[completeTask] Task ${ taskId } completed (role=${ agentRole } ), triggering auto-advance` ) ;
495+ console . log (
496+ `[completeTask] Task ${ taskId } completed (role=${ agentRole } ), triggering auto-advance` ,
497+ ) ;
488498
489499 // Auto-advance: try to execute next wave of ready tasks
490500 executeNextWave ( runId ) . catch ( ( err ) => {
@@ -588,16 +598,17 @@ export async function failTask(
588598 // Spawn Fixer agent — escalate to more reliable model on retries
589599 // On retry 2+, force gpt-4o-mini to avoid repeated failures from catalog models
590600 const baseFixerDecision = router . route ( AgentRole . Builder , task . sigmaEstimate ) ;
591- const fixerDecision = retryCount >= 1
592- ? {
593- ...baseFixerDecision ,
594- model : "gpt-4o-mini" ,
595- providerConfig : baseFixerDecision . providerConfig
596- ? { ...baseFixerDecision . providerConfig , model : "gpt-4o-mini" }
597- : baseFixerDecision . providerConfig ,
598- reason : `${ baseFixerDecision . reason } (escalated: fixer retry ${ retryCount + 1 } )` ,
599- }
600- : baseFixerDecision ;
601+ const fixerDecision =
602+ retryCount >= 1
603+ ? {
604+ ...baseFixerDecision ,
605+ model : "gpt-4o-mini" ,
606+ providerConfig : baseFixerDecision . providerConfig
607+ ? { ...baseFixerDecision . providerConfig , model : "gpt-4o-mini" }
608+ : baseFixerDecision . providerConfig ,
609+ reason : `${ baseFixerDecision . reason } (escalated: fixer retry ${ retryCount + 1 } )` ,
610+ }
611+ : baseFixerDecision ;
601612 routingLog . push ( fixerDecision ) ;
602613 const fixer = await spawnAgent ( runId , AgentRole . Builder , taskId , fixerDecision . model ) ;
603614 await updateAgentStatus ( fixer . agentId , AgentStatus . Executing ) ;
@@ -1079,7 +1090,9 @@ function checkBudget(run: RunState): Result<AgentState[]> {
10791090 const ceiling = run . lock . budgetCeiling ;
10801091 const percentUsed = ceiling > 0 ? ( currentSpend / ceiling ) * 100 : 0 ;
10811092
1082- console . log ( `[checkBudget] run=${ run . runId } spend=$${ currentSpend . toFixed ( 4 ) } ceiling=$${ ceiling } percent=${ percentUsed . toFixed ( 1 ) } %` ) ;
1093+ console . log (
1094+ `[checkBudget] run=${ run . runId } spend=$${ currentSpend . toFixed ( 4 ) } ceiling=$${ ceiling } percent=${ percentUsed . toFixed ( 1 ) } %` ,
1095+ ) ;
10831096
10841097 // Alert at 80%
10851098 if ( percentUsed >= 80 && budgetCallback ) {
@@ -1088,7 +1101,9 @@ function checkBudget(run: RunState): Result<AgentState[]> {
10881101
10891102 // Pause at 95%
10901103 if ( percentUsed >= 95 ) {
1091- console . log ( `[checkBudget] BUDGET EXCEEDED 95% — deferring pending tasks and pausing run ${ run . runId } ` ) ;
1104+ console . log (
1105+ `[checkBudget] BUDGET EXCEEDED 95% — deferring pending tasks and pausing run ${ run . runId } ` ,
1106+ ) ;
10921107 // Defer pending tasks
10931108 for ( const task of run . plan . tasks ) {
10941109 if ( task . status === TaskStatus . Pending ) {
@@ -1133,7 +1148,9 @@ function completeRun(run: RunState): void {
11331148 } else {
11341149 run . status = RunStatus . Completed ;
11351150 }
1136- console . log ( `[completeRun] run=${ run . runId } finalStatus=${ run . status } hasFailed=${ hasFailed } tasks=[${ taskSummary } ]` ) ;
1151+ console . log (
1152+ `[completeRun] run=${ run . runId } finalStatus=${ run . status } hasFailed=${ hasFailed } tasks=[${ taskSummary } ]` ,
1153+ ) ;
11371154 run . completedAt = new Date ( ) . toISOString ( ) ;
11381155 checkpointRun ( run ) ;
11391156 notifyStatusChange ( run . runId , run . status ) ;
0 commit comments