File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -254,12 +254,17 @@ export const streamNormalInput = createAsyncThunk<
254254
255255 // 2. Pre-process args to catch invalid args before checking policies
256256 const state2 = getState ( ) ;
257+ if ( streamAborter . signal . aborted || ! state2 . session . isStreaming ) {
258+ return ;
259+ }
257260 const generatedCalls2 = selectPendingToolCalls ( state2 ) ;
258261 await preprocessToolCalls ( dispatch , extra . ideMessenger , generatedCalls2 ) ;
259262
260263 // 3. Security check: evaluate updated policies based on args
261264 const state3 = getState ( ) ;
262-
265+ if ( streamAborter . signal . aborted || ! state3 . session . isStreaming ) {
266+ return ;
267+ }
263268 const generatedCalls3 = selectPendingToolCalls ( state3 ) ;
264269 const toolPolicies = state3 . ui . toolSettings ;
265270 const policies = await evaluateToolPolicies (
@@ -283,6 +288,9 @@ export const streamNormalInput = createAsyncThunk<
283288 // auto stream cases increase thunk depth by 1
284289 const state4 = getState ( ) ;
285290 const generatedCalls4 = selectPendingToolCalls ( state4 ) ;
291+ if ( streamAborter . signal . aborted || ! state4 . session . isStreaming ) {
292+ return ;
293+ }
286294 if ( generatedCalls4 . length > 0 ) {
287295 // All that didn't fail are auto approved - call them
288296 await Promise . all (
You can’t perform that action at this time.
0 commit comments