Skip to content

Commit 64d1a45

Browse files
committed
fix: HOTFIX stop agent loop if aborted/not streaming
1 parent 4aa138f commit 64d1a45

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gui/src/redux/thunks/streamNormalInput.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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(

0 commit comments

Comments
 (0)