Add setting to disable YOLO mode (#11609)

Co-authored-by: Shreya Keshive <shreyakeshive@google.com>
This commit is contained in:
Adib234
2025-10-22 11:57:10 -07:00
committed by GitHub
parent 5bb9cd1a13
commit 6d75005afc
10 changed files with 203 additions and 1 deletions
+16
View File
@@ -442,6 +442,21 @@ export async function loadCliConfig(
argv.yolo || false ? ApprovalMode.YOLO : ApprovalMode.DEFAULT;
}
// Override approval mode if disableYoloMode is set.
if (settings.security?.disableYoloMode) {
if (approvalMode === ApprovalMode.YOLO) {
debugLogger.error('YOLO mode is disabled by the "disableYolo" setting.');
throw new FatalConfigError(
'Cannot start in YOLO mode when it is disabled by settings',
);
}
approvalMode = ApprovalMode.DEFAULT;
} else if (approvalMode === ApprovalMode.YOLO) {
debugLogger.warn(
'YOLO mode is enabled. All tool calls will be automatically approved.',
);
}
// Force approval mode to default if the folder is not trusted.
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
debugLogger.warn(
@@ -583,6 +598,7 @@ export async function loadCliConfig(
geminiMdFileCount: fileCount,
geminiMdFilePaths: filePaths,
approvalMode,
disableYoloMode: settings.security?.disableYoloMode,
showMemoryUsage: settings.ui?.showMemoryUsage || false,
accessibility: {
...settings.ui?.accessibility,