Skip to content

Commit 1c7a816

Browse files
uinstinctsestinj
andauthored
feat: remove auto-accept edits setting (#8310)
* feat: automatically accept file edit tools * remove edit tools from tool policies ui * remove checking for edit tool in tool policy section * remove hiding of edit policies * remove auto accept edit tool diffs * fix tests * re-run tests * re-run tests --------- Co-authored-by: Nate <sestinj@gmail.com>
1 parent cc2a6c3 commit 1c7a816

File tree

12 files changed

+12
-370
lines changed

12 files changed

+12
-370
lines changed

core/config/migrateSharedConfig.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,6 @@ export function migrateJsonSharedConfig(filepath: string, ide: IDE): void {
173173
effected = true;
174174
}
175175

176-
const { autoAcceptEditToolDiffs, ...withoutAutoApply } = migratedUI;
177-
if (autoAcceptEditToolDiffs !== undefined) {
178-
shareConfigUpdates.autoAcceptEditToolDiffs = autoAcceptEditToolDiffs;
179-
migratedUI = withoutAutoApply;
180-
effected = true;
181-
}
182-
183176
const { showChatScrollbar, ...withoutShowChatScrollbar } = migratedUI;
184177
if (showChatScrollbar !== undefined) {
185178
shareConfigUpdates.showChatScrollbar = showChatScrollbar;

core/config/sharedConfig.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const sharedConfigSchema = z
3131
codeWrap: z.boolean(),
3232
displayRawMarkdown: z.boolean(),
3333
showChatScrollbar: z.boolean(),
34-
autoAcceptEditToolDiffs: z.boolean(),
3534
continueAfterToolRejection: z.boolean(),
3635

3736
// `tabAutocompleteOptions` in `ContinueConfig`
@@ -140,10 +139,6 @@ export function modifyAnyConfigWithSharedConfig<
140139
if (sharedConfig.showChatScrollbar !== undefined) {
141140
configCopy.ui.showChatScrollbar = sharedConfig.showChatScrollbar;
142141
}
143-
if (sharedConfig.autoAcceptEditToolDiffs !== undefined) {
144-
configCopy.ui.autoAcceptEditToolDiffs =
145-
sharedConfig.autoAcceptEditToolDiffs;
146-
}
147142

148143
if (sharedConfig.allowAnonymousTelemetry !== undefined) {
149144
configCopy.allowAnonymousTelemetry = sharedConfig.allowAnonymousTelemetry;

core/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,6 @@ export interface ContinueUIConfig {
14041404
showChatScrollbar?: boolean;
14051405
codeWrap?: boolean;
14061406
showSessionTabs?: boolean;
1407-
autoAcceptEditToolDiffs?: boolean;
14081407
continueAfterToolRejection?: boolean;
14091408
}
14101409

gui/src/pages/config/components/ToolPoliciesGroup.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
ChevronDownIcon,
33
WrenchScrewdriverIcon,
44
} from "@heroicons/react/24/outline";
5+
import { Tool } from "core";
56
import { useMemo, useState } from "react";
67
import ToggleSwitch from "../../../components/gui/Switch";
78
import { ToolTip } from "../../../components/gui/Tooltip";
@@ -28,7 +29,9 @@ export function ToolPoliciesGroup({
2829
const dispatch = useAppDispatch();
2930
const [isExpanded, setIsExpanded] = useState(false);
3031

31-
const availableTools = useAppSelector((state) => state.config.config.tools);
32+
const availableTools = useAppSelector(
33+
(state) => state.config.config.tools as Tool[],
34+
);
3235
const tools = useMemo(() => {
3336
return availableTools.filter((t) => t.group === groupName);
3437
}, [availableTools, groupName]);

gui/src/pages/config/components/ToolPolicyItem.tsx

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
import { useFontSize } from "../../../components/ui/font";
2020
import { useAppSelector } from "../../../redux/hooks";
2121
import { addTool, setToolPolicy } from "../../../redux/slices/uiSlice";
22-
import { isEditTool } from "../../../util/toolCallState";
2322

2423
interface ToolPolicyItemProps {
2524
tool: Tool;
@@ -29,22 +28,12 @@ interface ToolPolicyItemProps {
2928

3029
export function ToolPolicyItem(props: ToolPolicyItemProps) {
3130
const dispatch = useDispatch();
32-
const toolPolicy = useAppSelector(
31+
const policy = useAppSelector(
3332
(state) => state.ui.toolSettings[props.tool.function.name],
3433
);
3534
const [isExpanded, setIsExpanded] = useState(false);
3635
const mode = useAppSelector((state) => state.session.mode);
3736

38-
const autoAcceptEditToolDiffs = useAppSelector(
39-
(state) => state.config.config.ui?.autoAcceptEditToolDiffs,
40-
);
41-
const isAutoAcceptedToolCall =
42-
isEditTool(props.tool.function.name) && autoAcceptEditToolDiffs;
43-
44-
const policy = isAutoAcceptedToolCall
45-
? "allowedWithoutPermission"
46-
: toolPolicy;
47-
4837
useEffect(() => {
4938
if (!policy) {
5039
dispatch(addTool(props.tool));
@@ -64,7 +53,6 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
6453
const fontSize = useFontSize(-2);
6554

6655
const disabled =
67-
isAutoAcceptedToolCall ||
6856
!props.isGroupEnabled ||
6957
(mode === "plan" &&
7058
props.tool.group === BUILT_IN_GROUP_NAME &&
@@ -112,19 +100,6 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
112100
<InformationCircleIcon className="h-3 w-3 flex-shrink-0 cursor-help text-yellow-500" />
113101
</ToolTip>
114102
) : null}
115-
{isAutoAcceptedToolCall ? (
116-
<ToolTip
117-
place="bottom"
118-
className="flex flex-wrap items-center"
119-
content={
120-
<p className="m-0 p-0">
121-
Auto-Accept Agent Edits setting is on
122-
</p>
123-
}
124-
>
125-
<InformationCircleIcon className="h-3 w-3 flex-shrink-0 cursor-help text-yellow-500" />
126-
</ToolTip>
127-
) : null}
128103
{props.tool.faviconUrl && (
129104
<img
130105
src={props.tool.faviconUrl}
@@ -164,13 +139,11 @@ export function ToolPolicyItem(props: ToolPolicyItemProps) {
164139
data-tooltip-id={disabled ? disabledTooltipId : undefined}
165140
>
166141
<span className="text-xs">
167-
{isAutoAcceptedToolCall
168-
? "Automatic"
169-
: disabled || policy === "disabled"
170-
? "Excluded"
171-
: policy === "allowedWithoutPermission"
172-
? "Automatic"
173-
: "Ask First"}
142+
{disabled || policy === "disabled"
143+
? "Excluded"
144+
: policy === "allowedWithoutPermission"
145+
? "Automatic"
146+
: "Ask First"}
174147
</span>
175148
<ChevronDownIcon className="h-3 w-3" />
176149
</ListboxButton>

gui/src/pages/config/sections/UserSettingsSection.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export function UserSettingsSection() {
6464
const codeWrap = config.ui?.codeWrap ?? false;
6565
const showChatScrollbar = config.ui?.showChatScrollbar ?? false;
6666
const readResponseTTS = config.experimental?.readResponseTTS ?? false;
67-
const autoAcceptEditToolDiffs = config.ui?.autoAcceptEditToolDiffs ?? false;
6867
const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false;
6968
const disableSessionTitles = config.disableSessionTitles ?? false;
7069
const useCurrentFileAsContext =
@@ -163,15 +162,6 @@ export function UserSettingsSection() {
163162
handleUpdate({ displayRawMarkdown: !value })
164163
}
165164
/>
166-
<UserSetting
167-
type="toggle"
168-
title="Auto-Accept Agent Edits"
169-
description="Diffs generated by the edit tool are automatically accepted and Agent proceeds with the next conversational turn."
170-
value={autoAcceptEditToolDiffs}
171-
onChange={(value) =>
172-
handleUpdate({ autoAcceptEditToolDiffs: value })
173-
}
174-
/>
175165
</div>
176166
</Card>
177167
</div>

gui/src/pages/gui/chat-tests/EditToolScenarios.test.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import { BuiltInToolNames } from "core/tools/builtIn";
2-
import { generateToolCallButtonTestId } from "../../../components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar";
3-
import {
4-
addAndSelectMockLlm,
5-
triggerConfigUpdate,
6-
} from "../../../util/test/config";
72
import { updateConfig } from "../../../redux/slices/configSlice";
83
import { renderWithProviders } from "../../../util/test/render";
94
import { Chat } from "../Chat";
105

116
import { waitFor } from "@testing-library/dom";
127
import { act } from "@testing-library/react";
138
import { ChatMessage } from "core";
14-
import { setToolPolicy } from "../../../redux/slices/uiSlice";
159
import { setInactive } from "../../../redux/slices/sessionSlice";
1610
import {
1711
getElementByTestId,
@@ -133,12 +127,6 @@ test(
133127
await user.click(toggleCodeblockChevron);
134128
await getElementByText(EDIT_CHANGES);
135129

136-
// Pending tool call - find and click the accept button
137-
const acceptToolCallButton = await getElementByTestId(
138-
generateToolCallButtonTestId("accept", EDIT_TOOL_CALL_ID),
139-
);
140-
await user.click(acceptToolCallButton);
141-
142130
// Tool call, check that applyToFile was called for edit
143131
await waitFor(() => {
144132
expect(messengerRequestSpy).toHaveBeenCalledWith("applyToFile", {

0 commit comments

Comments
 (0)