fix(core): prevent duplicate tool approval entries in auto-saved.toml#19487
fix(core): prevent duplicate tool approval entries in auto-saved.toml#19487Abhijit-2592 merged 3 commits intomainfrom
Conversation
Summary of ChangesHello @Abhijit-2592, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a bug that caused duplicate entries in the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a bug causing duplicate tool approval entries in auto-saved.toml. The root cause was redundant policy update triggers in both individual tool onConfirm callbacks and the schedulers. The fix correctly centralizes this logic within the CoreToolScheduler, removing the duplicated calls from all tool implementations. This is a solid refactoring that not only fixes the bug but also improves the overall architecture by centralizing responsibility and reducing code duplication. The changes have been applied consistently across all relevant tools and their tests have been updated accordingly.
|
Size Change: -1 kB (0%) Total Size: 24.5 MB
ℹ️ View Unchanged
|
e909f5a to
fc6985a
Compare
abhipatel12
left a comment
There was a problem hiding this comment.
LGTM, let's just remove the coreToolScheduler changes
Centralized the responsibility for publishing policy updates in the tool schedulers (Scheduler and CoreToolScheduler). Removed redundant publishPolicyUpdate and manual setApprovalMode calls from individual tool implementations. Updated associated tests to reflect the new centralized architecture.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
fb62d93 to
be636bc
Compare
…#19487) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
This PR fixes an issue where selecting "Allow for all future sessions" in a tool confirmation dialog caused the corresponding policy entry to be added twice to the
auto-saved.tomlfile.Details
The root cause was redundant
UPDATE_POLICYmessage triggers:BaseToolInvocationand several specific tools (shell, edit, write-file, etc.) published a policy update within theironConfirmcallback.SchedulerandCoreToolSchedulerindependently calledupdatePolicy()after a confirmation was resolved.This PR centralizes the responsibility for publishing policy updates in the schedulers and removes the redundant triggers from individual tool implementations. This ensures that exactly one write to disk occurs per user confirmation.
Key changes:
Scheduler(already present) andCoreToolScheduler(newly added).publishPolicyUpdateandsetApprovalModecalls from all tool invocations.confirmation-policy.test.tsandweb-fetch.test.tsto reflect the centralized architecture.Related Issues
Closes #19485
How to Validate
npm run startlswith shell confirmation enabled).~/.gemini/policies/auto-saved.tomland verify only one entry was added for that tool.npx vitest run packages/core/src/tools/confirmation-policy.test.tsPre-Merge Checklist