Skip to content

fix(cli): avoid duplicate history and telemetry after confirmation - #29248

Open
PansaLegrand wants to merge 1 commit into
google-gemini:mainfrom
PansaLegrand:codex/fix-slash-command-confirmation
Open

fix(cli): avoid duplicate history and telemetry after confirmation#29248
PansaLegrand wants to merge 1 commit into
google-gemini:mainfrom
PansaLegrand:codex/fix-slash-command-confirmation

Conversation

@PansaLegrand

Copy link
Copy Markdown

Summary

Fixes duplicate slash-command history and telemetry when an action is confirmed. For example, confirming an overwrite with /resume save <tag> now keeps one command entry, even if another message arrived while the confirmation was open.

Details

  • Suppress the repeated history insertion when resuming confirm_action.
  • Let the resumed invocation record the final telemetry outcome for both action and shell confirmations. This removes duplicate success events and prevents a failed continuation from also being reported as successful by its caller.
  • Preserve cancellation behavior and add six regression cases covering success, failure, and cancellation across both confirmation paths.
  • Document checkpoint overwrite confirmation in the session guide.

Draft for maintainer consideration: #29032 does not yet have the help wanted designation. Could a maintainer confirm whether this focused fix is suitable for community contribution?

Related Issues

Fixes #29032.

How to Validate

  • npm exec -w @google/gemini-cli -- vitest run src/ui/hooks/slashCommandProcessor.test.tsx --coverage.enabled=false
    • 44 tests passed. Against the unchanged implementation, the new cases produced four failures (action history duplication and shell telemetry duplication/misclassification); both cancellation cases passed.
  • npx --no-install eslint packages/cli/src/ui/hooks/slashCommandProcessor.ts packages/cli/src/ui/hooks/slashCommandProcessor.test.tsx
    • Passed.
  • npm run preflight on macOS arm64 / Node.js 20.19.5:
    • All workspace builds, formatting, ESLint, actionlint, shellcheck, yamllint, and type checks passed.
    • Workspace tests: 15,218 passed, 20 failed, 64 skipped. The changed suite passed all 44 tests.
    • All 20 failures reproduce on unchanged upstream 24cab6830a:
      • Nine failures in src/gemini.test.tsx require the test environment used by .github/workflows/ci.yml. Rerunning startup and configuration tests with GEMINI_CLI_TRUST_WORKSPACE=true passed 264 tests (two skipped).
      • Eleven failures in src/config/extensionRegistryClient.test.ts occur because this host resolves geminicli.com to a reserved address, which the existing private-IP check rejects. No registry or network-safety code was changed.
    • Preflight therefore did not exit successfully on this host.
  • npm run test:scripts and npm run test:sea-launch
    • Run separately because the workspace-test failures stopped the final chained stages; 201 and 17 tests passed, respectively.

The regressions exercise an unrelated history update during confirmation, then assert a single command entry, one final telemetry event, and cleared confirmation state. They require no model request.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any): none
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@google-cla

google-cla Bot commented Sep 8, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions Bot added the size/m A medium sized PR label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

📊 PR Size: size/M

  • Lines changed: 118
  • Additions: +117
  • Deletions: -1
  • Files changed: 3

@gemini-cli gemini-cli Bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Sep 8, 2026
@PansaLegrand
PansaLegrand marked this pull request as ready for review September 9, 2026 05:04
@PansaLegrand
PansaLegrand requested review from a team as code owners September 9, 2026 05:04
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 issues with duplicate slash-command history entries and telemetry events that occur when a user confirms an action or shell command. By tracking command reinvocations, the logic now ensures that history and telemetry are only processed once, specifically upon the final outcome of the confirmed operation. This improves data consistency and provides a cleaner user experience during interactive command flows.

Highlights

  • Duplicate History Prevention: Suppressed redundant history insertions when resuming commands after user confirmation.
  • Telemetry Accuracy: Refined telemetry reporting to ensure only the final outcome of a confirmed command is recorded, preventing duplicate success events.
  • Regression Testing: Added six new test cases covering success, failure, and cancellation scenarios for both action and shell command confirmations.
  • Documentation: Updated the session management guide to clarify checkpoint overwrite behavior.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request prevents duplicate history entries and terminal events from being recorded when a slash command requires confirmation (such as overwriting a checkpoint or executing shell commands). It introduces a commandReinvoked flag in useSlashCommandProcessor to track resumed invocations and avoid redundant logging. Unit tests have been added to verify this behavior, and the session management documentation has been updated to explain the checkpoint confirmation flow. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: confirm_action slash-command flow re-adds history and double-fires telemetry vs the shell-confirmation path

1 participant