Просмотр исходного кода

Make retries respect the global auto approve checkbox (#3067)

Matt Rubens 8 месяцев назад
Родитель
Сommit
6e86f04a74
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/core/Cline.ts

+ 2 - 2
src/core/Cline.ts

@@ -930,7 +930,7 @@ export class Cline extends EventEmitter<ClineEvents> {
 	async *attemptApiRequest(previousApiReqIndex: number, retryAttempt: number = 0): ApiStream {
 	async *attemptApiRequest(previousApiReqIndex: number, retryAttempt: number = 0): ApiStream {
 		let mcpHub: McpHub | undefined
 		let mcpHub: McpHub | undefined
 
 
-		const { apiConfiguration, mcpEnabled, alwaysApproveResubmit, requestDelaySeconds } =
+		const { apiConfiguration, mcpEnabled, autoApprovalEnabled, alwaysApproveResubmit, requestDelaySeconds } =
 			(await this.providerRef.deref()?.getState()) ?? {}
 			(await this.providerRef.deref()?.getState()) ?? {}
 
 
 		let rateLimitDelay = 0
 		let rateLimitDelay = 0
@@ -1093,7 +1093,7 @@ export class Cline extends EventEmitter<ClineEvents> {
 			this.isWaitingForFirstChunk = false
 			this.isWaitingForFirstChunk = false
 		} catch (error) {
 		} catch (error) {
 			// note that this api_req_failed ask is unique in that we only present this option if the api hasn't streamed any content yet (ie it fails on the first chunk due), as it would allow them to hit a retry button. However if the api failed mid-stream, it could be in any arbitrary state where some tools may have executed, so that error is handled differently and requires cancelling the task entirely.
 			// note that this api_req_failed ask is unique in that we only present this option if the api hasn't streamed any content yet (ie it fails on the first chunk due), as it would allow them to hit a retry button. However if the api failed mid-stream, it could be in any arbitrary state where some tools may have executed, so that error is handled differently and requires cancelling the task entirely.
-			if (alwaysApproveResubmit) {
+			if (autoApprovalEnabled && alwaysApproveResubmit) {
 				let errorMsg
 				let errorMsg
 
 
 				if (error.error?.metadata?.raw) {
 				if (error.error?.metadata?.raw) {