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 @@ -356,7 +356,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
356356
357357 if ( startTask ) {
358358 if ( task || images ) {
359- this . startTask ( task , images , initialTodos )
359+ this . startTask ( task , images )
360360 } else if ( historyItem ) {
361361 this . resumeTaskFromHistory ( )
362362 } else {
@@ -937,7 +937,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
937937
938938 // Start / Abort / Resume
939939
940- private async startTask ( task ?: string , images ?: string [ ] , initialTodos ?: TodoItem [ ] ) : Promise < void > {
940+ private async startTask ( task ?: string , images ?: string [ ] ) : Promise < void > {
941941 // `conversationHistory` (for API) and `clineMessages` (for webview)
942942 // need to be in sync.
943943 // If the extension process were killed, then on restart the
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 77 type ModeConfig ,
88 type ExperimentId ,
99 type OrganizationAllowList ,
10+ type TodoItem ,
1011 ORGANIZATION_ALLOW_ALL ,
1112} from "@roo-code/types"
1213
@@ -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