Skip to content

Commit 0fbbe66

Browse files
feat: remove auto-approve toggles for to-do and retry actions (#10062)
1 parent a3b258a commit 0fbbe66

38 files changed

+12
-366
lines changed

packages/types/src/global-settings.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,13 @@ export const globalSettingsSchema = z.object({
7474
alwaysAllowWriteProtected: z.boolean().optional(),
7575
writeDelayMs: z.number().min(0).optional(),
7676
alwaysAllowBrowser: z.boolean().optional(),
77-
alwaysApproveResubmit: z.boolean().optional(),
7877
requestDelaySeconds: z.number().optional(),
7978
alwaysAllowMcp: z.boolean().optional(),
8079
alwaysAllowModeSwitch: z.boolean().optional(),
8180
alwaysAllowSubtasks: z.boolean().optional(),
8281
alwaysAllowExecute: z.boolean().optional(),
8382
alwaysAllowFollowupQuestions: z.boolean().optional(),
8483
followupAutoApproveTimeoutMs: z.number().optional(),
85-
alwaysAllowUpdateTodoList: z.boolean().optional(),
8684
allowedCommands: z.array(z.string()).optional(),
8785
deniedCommands: z.array(z.string()).optional(),
8886
commandExecutionTimeout: z.number().optional(),
@@ -307,14 +305,12 @@ export const EVALS_SETTINGS: RooCodeSettings = {
307305
alwaysAllowWriteProtected: false,
308306
writeDelayMs: 1000,
309307
alwaysAllowBrowser: true,
310-
alwaysApproveResubmit: true,
311308
requestDelaySeconds: 10,
312309
alwaysAllowMcp: true,
313310
alwaysAllowModeSwitch: true,
314311
alwaysAllowSubtasks: true,
315312
alwaysAllowExecute: true,
316313
alwaysAllowFollowupQuestions: true,
317-
alwaysAllowUpdateTodoList: true,
318314
followupAutoApproveTimeoutMs: 0,
319315
allowedCommands: ["*"],
320316
commandExecutionTimeout: 20,

src/core/auto-approval/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ export type AutoApprovalState =
1212
| "alwaysAllowReadOnly"
1313
| "alwaysAllowWrite"
1414
| "alwaysAllowBrowser"
15-
| "alwaysApproveResubmit"
1615
| "alwaysAllowMcp"
1716
| "alwaysAllowModeSwitch"
1817
| "alwaysAllowSubtasks"
1918
| "alwaysAllowExecute"
2019
| "alwaysAllowFollowupQuestions"
21-
| "alwaysAllowUpdateTodoList"
2220

2321
// Some of these actions have additional settings associated with them.
2422
export type AutoApprovalStateOptions =
@@ -144,7 +142,7 @@ export async function checkAutoApproval({
144142
}
145143

146144
if (tool.tool === "updateTodoList") {
147-
return state.alwaysAllowUpdateTodoList === true ? { decision: "approve" } : { decision: "ask" }
145+
return { decision: "approve" }
148146
}
149147

150148
if (tool?.tool === "fetchInstructions") {

src/core/task/Task.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2959,7 +2959,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
29592959

29602960
// Apply exponential backoff similar to first-chunk errors when auto-resubmit is enabled
29612961
const stateForBackoff = await this.providerRef.deref()?.getState()
2962-
if (stateForBackoff?.autoApprovalEnabled && stateForBackoff?.alwaysApproveResubmit) {
2962+
if (stateForBackoff?.autoApprovalEnabled) {
29632963
await this.backoffAndAnnounce(
29642964
currentItem.retryAttempt ?? 0,
29652965
error,
@@ -3216,7 +3216,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
32163216

32173217
// Check if we should auto-retry or prompt the user
32183218
// Reuse the state variable from above
3219-
if (state?.autoApprovalEnabled && state?.alwaysApproveResubmit) {
3219+
if (state?.autoApprovalEnabled) {
32203220
// Auto-retry with backoff - don't persist failure message when retrying
32213221
const errorMsg =
32223222
"Unexpected API Response: The language model did not provide any assistant messages. This may indicate an issue with the API or the model's output."
@@ -3509,7 +3509,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
35093509
const {
35103510
apiConfiguration,
35113511
autoApprovalEnabled,
3512-
alwaysApproveResubmit,
35133512
requestDelaySeconds,
35143513
mode,
35153514
autoCondenseContext = true,
@@ -3811,7 +3810,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
38113810
}
38123811

38133812
// 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.
3814-
if (autoApprovalEnabled && alwaysApproveResubmit) {
3813+
if (autoApprovalEnabled) {
38153814
let errorMsg
38163815

38173816
if (error.error?.metadata?.raw) {

src/core/task/__tests__/Task.spec.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -697,11 +697,8 @@ describe("Cline", () => {
697697
return mockSuccessStream
698698
})
699699

700-
// Set alwaysApproveResubmit and requestDelaySeconds
701-
mockProvider.getState = vi.fn().mockResolvedValue({
702-
alwaysApproveResubmit: true,
703-
requestDelaySeconds: 3,
704-
})
700+
// Set up mock state
701+
mockProvider.getState = vi.fn().mockResolvedValue({})
705702

706703
// Mock previous API request message
707704
cline.clineMessages = [
@@ -723,7 +720,7 @@ describe("Cline", () => {
723720
await iterator.next()
724721

725722
// Calculate expected delay for first retry
726-
const baseDelay = 3 // from requestDelaySeconds
723+
const baseDelay = 3 // test retry delay
727724

728725
// Verify countdown messages
729726
for (let i = baseDelay; i > 0; i--) {
@@ -821,11 +818,8 @@ describe("Cline", () => {
821818
return mockSuccessStream
822819
})
823820

824-
// Set alwaysApproveResubmit and requestDelaySeconds
825-
mockProvider.getState = vi.fn().mockResolvedValue({
826-
alwaysApproveResubmit: true,
827-
requestDelaySeconds: 3,
828-
})
821+
// Set up mock state
822+
mockProvider.getState = vi.fn().mockResolvedValue({})
829823

830824
// Mock previous API request message
831825
cline.clineMessages = [
@@ -847,7 +841,7 @@ describe("Cline", () => {
847841
await iterator.next()
848842

849843
// Verify delay is only applied for the countdown
850-
const baseDelay = 3 // from requestDelaySeconds
844+
const baseDelay = 3 // test retry delay
851845
const expectedDelayCount = baseDelay // One delay per second for countdown
852846
expect(mockDelay).toHaveBeenCalledTimes(expectedDelayCount)
853847
expect(mockDelay).toHaveBeenCalledWith(1000) // Each delay should be 1 second

src/core/webview/ClineProvider.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,6 @@ export class ClineProvider
18161816
alwaysAllowMcp,
18171817
alwaysAllowModeSwitch,
18181818
alwaysAllowSubtasks,
1819-
alwaysAllowUpdateTodoList,
18201819
allowedMaxRequests,
18211820
allowedMaxCost,
18221821
autoCondenseContext,
@@ -1848,8 +1847,6 @@ export class ClineProvider
18481847
fuzzyMatchThreshold,
18491848
mcpEnabled,
18501849
enableMcpServerCreation,
1851-
alwaysApproveResubmit,
1852-
requestDelaySeconds,
18531850
currentApiConfigName,
18541851
listApiConfigMeta,
18551852
pinnedApiConfigs,
@@ -1948,7 +1945,6 @@ export class ClineProvider
19481945
alwaysAllowMcp: alwaysAllowMcp ?? false,
19491946
alwaysAllowModeSwitch: alwaysAllowModeSwitch ?? false,
19501947
alwaysAllowSubtasks: alwaysAllowSubtasks ?? false,
1951-
alwaysAllowUpdateTodoList: alwaysAllowUpdateTodoList ?? false,
19521948
isBrowserSessionActive,
19531949
allowedMaxRequests,
19541950
allowedMaxCost,
@@ -1994,8 +1990,6 @@ export class ClineProvider
19941990
fuzzyMatchThreshold: fuzzyMatchThreshold ?? 1.0,
19951991
mcpEnabled: mcpEnabled ?? true,
19961992
enableMcpServerCreation: enableMcpServerCreation ?? true,
1997-
alwaysApproveResubmit: alwaysApproveResubmit ?? false,
1998-
requestDelaySeconds: requestDelaySeconds ?? 10,
19991993
currentApiConfigName: currentApiConfigName ?? "default",
20001994
listApiConfigMeta: listApiConfigMeta ?? [],
20011995
pinnedApiConfigs: pinnedApiConfigs ?? {},
@@ -2189,7 +2183,6 @@ export class ClineProvider
21892183
alwaysAllowModeSwitch: stateValues.alwaysAllowModeSwitch ?? false,
21902184
alwaysAllowSubtasks: stateValues.alwaysAllowSubtasks ?? false,
21912185
alwaysAllowFollowupQuestions: stateValues.alwaysAllowFollowupQuestions ?? false,
2192-
alwaysAllowUpdateTodoList: stateValues.alwaysAllowUpdateTodoList ?? false,
21932186
isBrowserSessionActive,
21942187
followupAutoApproveTimeoutMs: stateValues.followupAutoApproveTimeoutMs ?? 60000,
21952188
diagnosticsEnabled: stateValues.diagnosticsEnabled ?? true,
@@ -2232,8 +2225,6 @@ export class ClineProvider
22322225
mcpEnabled: stateValues.mcpEnabled ?? true,
22332226
enableMcpServerCreation: stateValues.enableMcpServerCreation ?? true,
22342227
mcpServers: this.mcpHub?.getAllServers() ?? [],
2235-
alwaysApproveResubmit: stateValues.alwaysApproveResubmit ?? false,
2236-
requestDelaySeconds: Math.max(5, stateValues.requestDelaySeconds ?? 10),
22372228
currentApiConfigName: stateValues.currentApiConfigName ?? "default",
22382229
listApiConfigMeta: stateValues.listApiConfigMeta ?? [],
22392230
pinnedApiConfigs: stateValues.pinnedApiConfigs ?? {},

src/core/webview/__tests__/ClineProvider.spec.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ describe("ClineProvider", () => {
558558
fuzzyMatchThreshold: 1.0,
559559
mcpEnabled: true,
560560
enableMcpServerCreation: false,
561-
requestDelaySeconds: 5,
562561
mode: defaultModeSlug,
563562
customModes: [],
564563
experiments: experimentDefault,
@@ -835,27 +834,6 @@ describe("ClineProvider", () => {
835834
expect(mockPostMessage).toHaveBeenCalled()
836835
})
837836

838-
test("requestDelaySeconds defaults to 10 seconds", async () => {
839-
// Mock globalState.get to return undefined for requestDelaySeconds
840-
;(mockContext.globalState.get as any).mockImplementation((key: string) => {
841-
if (key === "requestDelaySeconds") {
842-
return undefined
843-
}
844-
return null
845-
})
846-
847-
const state = await provider.getState()
848-
expect(state.requestDelaySeconds).toBe(10)
849-
})
850-
851-
test("alwaysApproveResubmit defaults to false", async () => {
852-
// Mock globalState.get to return undefined for alwaysApproveResubmit
853-
;(mockContext.globalState.get as any).mockReturnValue(undefined)
854-
855-
const state = await provider.getState()
856-
expect(state.alwaysApproveResubmit).toBe(false)
857-
})
858-
859837
test("autoCondenseContext defaults to true", async () => {
860838
// Mock globalState.get to return undefined for autoCondenseContext
861839
;(mockContext.globalState.get as any).mockImplementation((key: string) =>
@@ -1026,22 +1004,6 @@ describe("ClineProvider", () => {
10261004
expect((await provider.getState()).showRooIgnoredFiles).toBe(false)
10271005
})
10281006

1029-
test("handles request delay settings messages", async () => {
1030-
await provider.resolveWebviewView(mockWebviewView)
1031-
const messageHandler = (mockWebviewView.webview.onDidReceiveMessage as any).mock.calls[0][0]
1032-
1033-
// Test alwaysApproveResubmit
1034-
await messageHandler({ type: "updateSettings", updatedSettings: { alwaysApproveResubmit: true } })
1035-
expect(updateGlobalStateSpy).toHaveBeenCalledWith("alwaysApproveResubmit", true)
1036-
expect(mockContext.globalState.update).toHaveBeenCalledWith("alwaysApproveResubmit", true)
1037-
expect(mockPostMessage).toHaveBeenCalled()
1038-
1039-
// Test requestDelaySeconds
1040-
await messageHandler({ type: "updateSettings", updatedSettings: { requestDelaySeconds: 10 } })
1041-
expect(mockContext.globalState.update).toHaveBeenCalledWith("requestDelaySeconds", 10)
1042-
expect(mockPostMessage).toHaveBeenCalled()
1043-
})
1044-
10451007
test("handles updatePrompt message correctly", async () => {
10461008
await provider.resolveWebviewView(mockWebviewView)
10471009
const messageHandler = (mockWebviewView.webview.onDidReceiveMessage as any).mock.calls[0][0]

src/shared/ExtensionMessage.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,11 @@ export type ExtensionState = Pick<
233233
| "alwaysAllowWriteOutsideWorkspace"
234234
| "alwaysAllowWriteProtected"
235235
| "alwaysAllowBrowser"
236-
| "alwaysApproveResubmit"
237236
| "alwaysAllowMcp"
238237
| "alwaysAllowModeSwitch"
239238
| "alwaysAllowSubtasks"
240239
| "alwaysAllowFollowupQuestions"
241240
| "alwaysAllowExecute"
242-
| "alwaysAllowUpdateTodoList"
243241
| "followupAutoApproveTimeoutMs"
244242
| "allowedCommands"
245243
| "deniedCommands"
@@ -290,6 +288,7 @@ export type ExtensionState = Pick<
290288
| "includeCurrentTime"
291289
| "includeCurrentCost"
292290
| "maxGitStatusFiles"
291+
| "requestDelaySeconds"
293292
> & {
294293
version: string
295294
clineMessages: ClineMessage[]
@@ -302,7 +301,6 @@ export type ExtensionState = Pick<
302301
taskHistory: HistoryItem[]
303302

304303
writeDelayMs: number
305-
requestDelaySeconds: number
306304

307305
enableCheckpoints: boolean
308306
checkpointTimeout: number // Timeout for checkpoint initialization in seconds (default: 15)

webview-ui/src/components/chat/AutoApproveDropdown.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,17 @@ export const AutoApproveDropdown = ({ disabled = false, triggerClassName = "" }:
3131
const {
3232
autoApprovalEnabled,
3333
setAutoApprovalEnabled,
34-
alwaysApproveResubmit,
3534
setAlwaysAllowReadOnly,
3635
setAlwaysAllowWrite,
3736
setAlwaysAllowExecute,
3837
setAlwaysAllowBrowser,
3938
setAlwaysAllowMcp,
4039
setAlwaysAllowModeSwitch,
4140
setAlwaysAllowSubtasks,
42-
setAlwaysApproveResubmit,
4341
setAlwaysAllowFollowupQuestions,
44-
setAlwaysAllowUpdateTodoList,
4542
} = useExtensionState()
4643

47-
const baseToggles = useAutoApprovalToggles()
48-
49-
// Include alwaysApproveResubmit in addition to the base toggles.
50-
const toggles = React.useMemo(
51-
() => ({
52-
...baseToggles,
53-
alwaysApproveResubmit: alwaysApproveResubmit,
54-
}),
55-
[baseToggles, alwaysApproveResubmit],
56-
)
44+
const toggles = useAutoApprovalToggles()
5745

5846
const onAutoApproveToggle = React.useCallback(
5947
(key: AutoApproveSetting, value: boolean) => {
@@ -81,15 +69,9 @@ export const AutoApproveDropdown = ({ disabled = false, triggerClassName = "" }:
8169
case "alwaysAllowSubtasks":
8270
setAlwaysAllowSubtasks(value)
8371
break
84-
case "alwaysApproveResubmit":
85-
setAlwaysApproveResubmit(value)
86-
break
8772
case "alwaysAllowFollowupQuestions":
8873
setAlwaysAllowFollowupQuestions(value)
8974
break
90-
case "alwaysAllowUpdateTodoList":
91-
setAlwaysAllowUpdateTodoList(value)
92-
break
9375
}
9476

9577
// If enabling any option, ensure autoApprovalEnabled is true.
@@ -107,9 +89,7 @@ export const AutoApproveDropdown = ({ disabled = false, triggerClassName = "" }:
10789
setAlwaysAllowMcp,
10890
setAlwaysAllowModeSwitch,
10991
setAlwaysAllowSubtasks,
110-
setAlwaysApproveResubmit,
11192
setAlwaysAllowFollowupQuestions,
112-
setAlwaysAllowUpdateTodoList,
11393
setAutoApprovalEnabled,
11494
],
11595
)

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
8888
mode,
8989
setMode,
9090
alwaysAllowModeSwitch,
91-
alwaysAllowUpdateTodoList,
9291
customModes,
9392
telemetrySetting,
9493
hasSystemPromptOverride,
@@ -1299,9 +1298,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
12991298
tool = { tool: "updateTodoList" }
13001299
}
13011300
}
1302-
if (tool.tool === "updateTodoList" && alwaysAllowUpdateTodoList) {
1303-
return false
1304-
}
13051301
return tool.tool === "updateTodoList" && enableButtons && !!primaryButtonText
13061302
})()
13071303
}
@@ -1320,7 +1316,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
13201316
handleBatchFileResponse,
13211317
currentFollowUpTs,
13221318
isFollowUpAutoApprovalPaused,
1323-
alwaysAllowUpdateTodoList,
13241319
enableButtons,
13251320
primaryButtonText,
13261321
],

0 commit comments

Comments
 (0)