feat: Persistent "Always Allow" policies with granular shell & MCP support (#14737)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Allen Hutchison
2025-12-12 13:45:39 -08:00
committed by GitHub
parent d2a1a45646
commit 5f298c17d7
18 changed files with 431 additions and 21 deletions

View File

@@ -114,6 +114,11 @@ export const ToolConfirmationMessage: React.FC<
value: ToolConfirmationOutcome.ProceedAlways,
key: 'Yes, allow always',
});
options.push({
label: 'Yes, allow always and save to policy',
value: ToolConfirmationOutcome.ProceedAlwaysAndSave,
key: 'Yes, allow always and save to policy',
});
}
if (!config.getIdeMode() || !isDiffingEnabled) {
options.push({
@@ -145,6 +150,11 @@ export const ToolConfirmationMessage: React.FC<
value: ToolConfirmationOutcome.ProceedAlways,
key: `Yes, allow always ...`,
});
options.push({
label: `Yes, allow always and save to policy`,
value: ToolConfirmationOutcome.ProceedAlwaysAndSave,
key: `Yes, allow always and save to policy`,
});
}
options.push({
label: 'No, suggest changes (esc)',
@@ -164,6 +174,11 @@ export const ToolConfirmationMessage: React.FC<
value: ToolConfirmationOutcome.ProceedAlways,
key: 'Yes, allow always',
});
options.push({
label: 'Yes, allow always and save to policy',
value: ToolConfirmationOutcome.ProceedAlwaysAndSave,
key: 'Yes, allow always and save to policy',
});
}
options.push({
label: 'No, suggest changes (esc)',
@@ -190,6 +205,11 @@ export const ToolConfirmationMessage: React.FC<
value: ToolConfirmationOutcome.ProceedAlwaysServer,
key: `Yes, always allow all tools from server "${mcpProps.serverName}"`,
});
options.push({
label: `Yes, allow always tool "${mcpProps.toolName}" and save to policy`,
value: ToolConfirmationOutcome.ProceedAlwaysAndSave,
key: `Yes, allow always tool "${mcpProps.toolName}" and save to policy`,
});
}
options.push({
label: 'No, suggest changes (esc)',

View File

@@ -10,7 +10,8 @@ Do you want to proceed?
● 1. Yes, allow once
2. Yes, allow always
3. No, suggest changes (esc)
3. Yes, allow always and save to policy
4. No, suggest changes (esc)
"
`;
@@ -21,7 +22,8 @@ Do you want to proceed?
● 1. Yes, allow once
2. Yes, allow always
3. No, suggest changes (esc)
3. Yes, allow always and save to policy
4. No, suggest changes (esc)
"
`;
@@ -51,8 +53,9 @@ Apply this change?
● 1. Yes, allow once
2. Yes, allow always
3. Modify with external editor
4. No, suggest changes (esc)
3. Yes, allow always and save to policy
4. Modify with external editor
5. No, suggest changes (esc)
"
`;
@@ -73,7 +76,8 @@ Allow execution of: 'echo'?
● 1. Yes, allow once
2. Yes, allow always ...
3. No, suggest changes (esc)
3. Yes, allow always and save to policy
4. No, suggest changes (esc)
"
`;
@@ -94,7 +98,8 @@ Do you want to proceed?
● 1. Yes, allow once
2. Yes, allow always
3. No, suggest changes (esc)
3. Yes, allow always and save to policy
4. No, suggest changes (esc)
"
`;
@@ -118,6 +123,7 @@ Allow execution of MCP tool "test-tool" from server "test-server"?
● 1. Yes, allow once
2. Yes, always allow tool "test-tool" from server "test-server"
3. Yes, always allow all tools from server "test-server"
4. No, suggest changes (esc)
4. Yes, allow always tool "test-tool" and save to policy
5. No, suggest changes (esc)
"
`;

View File

@@ -39,7 +39,8 @@ exports[`<ToolGroupMessage /> > Confirmation Handling > shows confirmation dialo
│ │
│ ● 1. Yes, allow once │
│ 2. Yes, allow always │
│ 3. No, suggest changes (esc)
│ 3. Yes, allow always and save to policy
│ 4. No, suggest changes (esc) │
│ │
│ │
│ ? second-confirm A tool for testing │
@@ -122,7 +123,8 @@ exports[`<ToolGroupMessage /> > Golden Snapshots > renders tool call awaiting co
│ │
│ ● 1. Yes, allow once │
│ 2. Yes, allow always │
│ 3. No, suggest changes (esc)
│ 3. Yes, allow always and save to policy
│ 4. No, suggest changes (esc) │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯"
`;

View File

@@ -449,6 +449,7 @@ export class Session {
);
case ToolConfirmationOutcome.ProceedOnce:
case ToolConfirmationOutcome.ProceedAlways:
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
case ToolConfirmationOutcome.ProceedAlwaysServer:
case ToolConfirmationOutcome.ProceedAlwaysTool:
case ToolConfirmationOutcome.ModifyWithEditor: