File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " kilo-code " : patch
3+ ---
4+
5+ Fix infinite spinning initial API request
Original file line number Diff line number Diff line change @@ -80,18 +80,27 @@ export async function newTaskTool(
8080 // Preserve the current mode so we can resume with it later.
8181 cline . pausedModeSlug = ( await provider . getState ( ) ) . mode ?? defaultModeSlug
8282
83- // Create new task instance first (this preserves parent's current mode in its history)
83+ // kilocode_change start: Switch to the desired mode BEFORE creating the task
84+ await provider . handleModeSwitch ( mode )
85+ // Small delay to ensure mode switch has propagated
86+ await delay ( 100 )
87+ // kilocode_change end
88+
89+ // Now create the task with the correct mode already set
8490 const newCline = await provider . initClineWithTask ( unescapedMessage , undefined , cline )
8591 if ( ! newCline ) {
92+ await provider . handleModeSwitch ( cline . pausedModeSlug ) // kilocode_change: if task creation failed, switch back to the parent's mode
8693 pushToolResult ( t ( "tools:newTask.errors.policy_restriction" ) )
8794 return
8895 }
8996
90- // Now switch the newly created task to the desired mode
91- await provider . handleModeSwitch ( mode )
97+ // kilocode_change start: Switch to the desired mode BEFORE creating the task above
98+ // // Now switch the newly created task to the desired mode
99+ // await provider.handleModeSwitch(mode)
92100
93- // Delay to allow mode change to take effect
94- await delay ( 500 )
101+ // // Delay to allow mode change to take effect
102+ // await delay(500)
103+ // kilocode_change end
95104
96105 cline . emit ( "taskSpawned" , newCline . taskId )
97106
You can’t perform that action at this time.
0 commit comments