fix(core): ensure user rejections update tool outcome for telemetry#18982
fix(core): ensure user rejections update tool outcome for telemetry#18982chrstnb merged 1 commit intogoogle-gemini:mainfrom
Conversation
Summary of ChangesHello @abhiasap, 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 resolves a critical bug impacting the accuracy of telemetry data, specifically 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 effectively resolves a bug in telemetry reporting for tool call agreement rates. By ensuring setOutcome is called for all user decisions, including rejections, the telemetry will now accurately reflect user choices. The accompanying change to conditionally call updatePolicy only after a user interaction is a logical improvement that enhances code clarity. The new test case correctly validates the fix. The changes are well-implemented and address the issue described.
c9fca0f to
7cdfb24
Compare
Head branch was pushed to by a user without write access
7cdfb24 to
95bb7cd
Compare
ad9c49a
Summary
This PR fixes a bug where the "User Agreement" (
agreementRate) telemetry metric always reported 100%, even when users rejected tool call confirmations.Details
The core issue was that user rejection outcomes were not being set in the scheduler's state, causing these events to be missed by the telemetry system.
The
_processToolCallmethod inpackages/core/src/scheduler/scheduler.tsonly calledthis.state.setOutcome()when a tool was auto-allowed. This PR ensuresthis.state.setOutcome()is called unconditionally with theoutcomederived fromresolveConfirmation(), correctly capturing user decisions likeToolConfirmationOutcome.Cancel. This allows theToolCallEventto be created with the correctToolCallDecision.REJECT, so it's properly logged.Because
outcomeis now properly set for all code paths, this check ensures the policy engine is only invoked when the user actively made a choice, preventing unintended side-effects from sending default outcomes for auto-allowed tools.Related Issues
Fixes #19035 (mirror of b/484240481)
Testing
npm test -w @google/gemini-cli-core. All tests should pass, including the new assertion inscheduler.test.tsspecifically checking for thesetOutcomecall on cancel.How to Validate
npm run startPrevious Behavior (Bug):
In stats, the User Agreement is (pre-fix)
Fixed Behavior:
In stats, the User Agreement is now (post-fix)
Pre-Merge Checklist