Skip to content

Commit 647ff81

Browse files
committed
Refactor intelligent update handlers to ensure proper cleanup before retrying or aborting operations
- upon manual cancellation, open the configurations quick pick └── apps └── editor └── src └── views └── prompt └── backend └── message-handlers ├── handle-cancel-intelligent-update-file-in-preview.ts ├── handle-fix-all-failed-files.ts ├── handle-intelligent-update-file-in-preview.ts ├── index.ts └── utils └── intelligent-update-utils.ts
1 parent 3afddeb commit 647ff81

2 files changed

Lines changed: 21 additions & 15 deletions

File tree

‎apps/editor/src/views/prompt/backend/message-handlers/handle-fix-all-failed-files.ts‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,28 +243,29 @@ export const handle_fix_all_failed_files = async (params: {
243243
} catch (error: any) {
244244
if (
245245
!axios.isCancel(error) &&
246-
error.message != 'User cancelled the operation'
246+
error.message != 'User cancelled the operation' &&
247+
error.message != 'Batch operation failed, triggering configuration selection.'
247248
) {
248249
Logger.error({
249250
function_name: 'handle_fix_all_failed_files',
250251
message: 'Error during process_file',
251252
data: { error, file_path }
252253
})
253254

254-
batch_abort_controllers.forEach((controller) => {
255-
controller.abort(
256-
'Batch operation failed, triggering configuration selection.'
257-
)
258-
})
259-
260255
vscode.window.showErrorMessage(
261256
dictionary.error_message.APPLYING_CHANGES_GENERIC_ERROR(
262257
error.message
263258
)
264259
)
265-
266-
throw error
267260
}
261+
262+
batch_abort_controllers.forEach((controller) => {
263+
controller.abort(
264+
'Batch operation failed, triggering configuration selection.'
265+
)
266+
})
267+
268+
throw error
268269
} finally {
269270
params.prompt_view_provider.send_message({
270271
command: 'UPDATE_FILE_PROGRESS',

‎apps/editor/src/views/prompt/backend/message-handlers/handle-intelligent-update-file-in-preview.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ export const handle_intelligent_update_file_in_preview = async (
188188
on_thinking_chunk
189189
})
190190

191+
let should_retry = false
192+
191193
try {
192194
const updated_content = await content_promise
193195

@@ -235,13 +237,9 @@ export const handle_intelligent_update_file_in_preview = async (
235237
data: { error, file_path }
236238
})
237239
vscode.window.showErrorMessage(error.message)
238-
239-
await handle_intelligent_update_file_in_preview(prompt_view_provider, {
240-
...message,
241-
force_model_selection: true
242-
})
243-
return
244240
}
241+
242+
should_retry = true
245243
} finally {
246244
const index =
247245
prompt_view_provider.intelligent_update_abort_controllers.findIndex(
@@ -257,4 +255,11 @@ export const handle_intelligent_update_file_in_preview = async (
257255
is_applying: false
258256
})
259257
}
258+
259+
if (should_retry) {
260+
await handle_intelligent_update_file_in_preview(prompt_view_provider, {
261+
...message,
262+
force_model_selection: true
263+
})
264+
}
260265
}

0 commit comments

Comments
 (0)