File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
381381
382382 if ( startTask ) {
383383 if ( task || images ) {
384- this . startTask ( task , images , initialTodos )
384+ this . startTask ( task , images )
385385 } else if ( historyItem ) {
386386 this . resumeTaskFromHistory ( )
387387 } else {
@@ -1059,7 +1059,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
10591059
10601060 // Start / Abort / Resume
10611061
1062- private async startTask ( task ?: string , images ?: string [ ] , initialTodos ?: TodoItem [ ] ) : Promise < void > {
1062+ private async startTask ( task ?: string , images ?: string [ ] ) : Promise < void > {
10631063 if ( this . enableTaskBridge ) {
10641064 try {
10651065 this . bridgeService = this . bridgeService || ExtensionBridgeService . getInstance ( )
Original file line number Diff line number Diff line change @@ -51,7 +51,11 @@ export async function newTaskTool(
5151
5252 // Get the experimental setting for requiring todos
5353 const provider = cline . providerRef . deref ( )
54- const state = await provider ?. getState ( )
54+ if ( ! provider ) {
55+ pushToolResult ( formatResponse . toolError ( "Provider reference lost" ) )
56+ return
57+ }
58+ const state = await provider . getState ( )
5559 const requireTodos = Experiments . isEnabled ( state ?. experiments ?? { } , EXPERIMENT_IDS . NEW_TASK_REQUIRE_TODOS )
5660
5761 // Check if todos are required based on experimental setting
@@ -82,7 +86,7 @@ export async function newTaskTool(
8286 const unescapedMessage = message . replace ( / \\ \\ @ / g, "\\@" )
8387
8488 // Verify the mode exists
85- const targetMode = getModeBySlug ( mode , ( await cline . providerRef . deref ( ) ?. getState ( ) ) ?. customModes )
89+ const targetMode = getModeBySlug ( mode , state ?. customModes )
8690
8791 if ( ! targetMode ) {
8892 pushToolResult ( formatResponse . toolError ( `Invalid mode: ${ mode } ` ) )
@@ -102,9 +106,7 @@ export async function newTaskTool(
102106 return
103107 }
104108
105- if ( ! provider ) {
106- return
107- }
109+ // Provider is guaranteed to be defined here due to earlier check
108110
109111 if ( cline . enableCheckpoints ) {
110112 cline . checkpointSave ( true )
Original file line number Diff line number Diff line change 66 type CustomModePrompts ,
77 type ModeConfig ,
88 type ExperimentId ,
9+ type TodoItem ,
910} from "@roo-code/types"
1011
1112import { type OrganizationAllowList , ORGANIZATION_ALLOW_ALL } from "@roo/cloud"
@@ -31,7 +32,7 @@ export interface ExtensionStateContextType extends ExtensionState {
3132 mcpServers : McpServer [ ]
3233 hasSystemPromptOverride ?: boolean
3334 currentCheckpoint ?: string
34- currentTaskTodos ?: any [ ] // Initial todos for the current task
35+ currentTaskTodos ?: TodoItem [ ] // Initial todos for the current task
3536 filePaths : string [ ]
3637 openedTabs : Array < { label : string ; isActive : boolean ; path ?: string } >
3738 commands : Command [ ]
You can’t perform that action at this time.
0 commit comments