@@ -1230,11 +1230,7 @@ export class ClineProvider
12301230 )
12311231
12321232 if ( options ?. startTask !== false ) {
1233- void this . taskScheduler
1234- . schedule ( task , ( ) => task . run ( ) )
1235- . catch ( ( error ) => {
1236- console . error ( "[createTaskWithHistoryItem] taskScheduler.schedule (rehydrate) failed:" , error )
1237- } )
1233+ this . scheduleTask ( task , "createTaskWithHistoryItem" )
12381234 }
12391235 } else {
12401236 await this . addClineToStack ( task )
@@ -1244,11 +1240,7 @@ export class ClineProvider
12441240 )
12451241
12461242 if ( options ?. startTask !== false ) {
1247- void this . taskScheduler
1248- . schedule ( task , ( ) => task . run ( ) )
1249- . catch ( ( error ) => {
1250- console . error ( "[createTaskWithHistoryItem] taskScheduler.schedule failed:" , error )
1251- } )
1243+ this . scheduleTask ( task , "createTaskWithHistoryItem" )
12521244 }
12531245 }
12541246
@@ -3208,11 +3200,7 @@ export class ClineProvider
32083200
32093201 await this . addClineToStack ( task )
32103202 if ( options . startTask !== false ) {
3211- void this . taskScheduler
3212- . schedule ( task , ( ) => task . run ( ) )
3213- . catch ( ( error ) => {
3214- console . error ( "[createTask] taskScheduler.schedule failed:" , error )
3215- } )
3203+ this . scheduleTask ( task , "createTask" )
32163204 }
32173205
32183206 this . log (
@@ -3233,6 +3221,12 @@ export class ClineProvider
32333221 await this . cancelTaskInternal ( task )
32343222 }
32353223
3224+ private scheduleTask ( task : Task , source : string ) : void {
3225+ void this . taskScheduler
3226+ . schedule ( task , ( ) => task . run ( ) )
3227+ . catch ( ( error ) => console . error ( `[${ source } ] taskScheduler.schedule failed:` , error ) )
3228+ }
3229+
32363230 private async cancelTaskInternal ( task : Task ) : Promise < void > {
32373231 let historyItem : HistoryItem | undefined
32383232 try {
@@ -3724,11 +3718,7 @@ export class ClineProvider
37243718 }
37253719
37263720 // 6) Start the child task now that parent metadata is safely persisted.
3727- void this . taskScheduler
3728- . schedule ( child , ( ) => child . run ( ) )
3729- . catch ( ( error ) => {
3730- console . error ( "[delegateParentAndOpenChild] taskScheduler.schedule failed:" , error )
3731- } )
3721+ this . scheduleTask ( child , "delegateParentAndOpenChild" )
37323722
37333723 // 7) Emit TaskDelegated (provider-level)
37343724 try {
0 commit comments