fix(core): prevent duplicate tool approval entries in auto-saved.toml (#19487)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Abhijit Balaji
2026-02-19 12:03:52 -08:00
committed by GitHub
parent c276d0c7b6
commit 3408542a66
11 changed files with 39 additions and 62 deletions
+4 -9
View File
@@ -25,7 +25,7 @@ import {
BaseDeclarativeTool,
BaseToolInvocation,
Kind,
ToolConfirmationOutcome,
type ToolConfirmationOutcome,
} from './tools.js';
import { ToolErrorType } from './tool-error.js';
import { makeRelative, shortenPath } from '../utils/paths.js';
@@ -228,14 +228,9 @@ class WriteFileToolInvocation extends BaseToolInvocation<
fileDiff,
originalContent,
newContent: correctedContent,
onConfirm: async (outcome: ToolConfirmationOutcome) => {
if (outcome === ToolConfirmationOutcome.ProceedAlways) {
// No need to publish a policy update as the default policy for
// AUTO_EDIT already reflects always approving write-file.
this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
} else {
await this.publishPolicyUpdate(outcome);
}
onConfirm: async (_outcome: ToolConfirmationOutcome) => {
// Mode transitions (e.g. AUTO_EDIT) and policy updates are now
// handled centrally by the scheduler.
if (ideConfirmation) {
const result = await ideConfirmation;