Skip to content

fix(cli): remove redundant double-quote wrap from session resume tip - #26907

Closed
Eswar809 wants to merge 2 commits into
google-gemini:mainfrom
Eswar809:fix/session-resume-message-windows-quotes
Closed

fix(cli): remove redundant double-quote wrap from session resume tip#26907
Eswar809 wants to merge 2 commits into
google-gemini:mainfrom
Eswar809:fix/session-resume-message-windows-quotes

Conversation

@Eswar809

Copy link
Copy Markdown
Contributor

Summary

  • Removes the redundant "..." wrap around the session ID in the resume tip shown when a session ends
  • Trusts escapeShellArg (made shell-aware in don't wrap args unnecessarily #26599) to produce paste-safe output for the detected shell

Context

PR #26669 added a Windows-specific wrap to fix #26628, where PowerShell args were being wrapped in single quotes that cmd.exe couldn't strip. That root
cause was already fixed by PR #26599 (merged 2 days earlier), which changed escapeShellArg to return alphanumeric strings unquoted for both PowerShell
and cmd.exe. The wrap is therefore redundant for the common UUID case and adds noise that some Windows terminals mangle on copy-paste (smart quotes,
ConPTY artifacts), reaching the CLI as literal quote characters and producing Invalid session identifier "'uuid'".

Change

  • Drop the isWindows() branch in SessionSummaryDisplay.tsx; use escapeShellArg(stats.sessionId, shell) directly for both the standard and worktree
    footer paths
  • Update the existing PowerShell-on-Windows test to assert the unwrapped form and add a negative assertion that the wrap quotes are not present

Behavior

Shell detected Session ID Before After
powershell UUID (alnum) gemini --resume "uuid" gemini --resume uuid
powershell with spaces gemini --resume 'a b c' gemini --resume 'a b c' (unchanged)
bash UUID gemini --resume uuid gemini --resume uuid (unchanged)

The malicious-input escape path is unchanged — escapeShellArg still wraps non-alphanumeric values in single quotes for PowerShell and double quotes for
cmd.exe / bash.

Test plan

  • npx vitest run packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx — 6/6 pass
  • npx vitest run packages/cli/src/utils/sessions.test.ts packages/cli/src/utils/sessionUtils.test.ts — 50/50 pass
  • npm run typecheck — clean
  • ESLint, prettier (pre-commit hooks) — clean
  • Manual repro on Windows: exit a session, paste the printed gemini --resume <uuid> command into Windows Terminal — should not produce Invalid session identifier

The session-end resume tip on Windows wrapped the session ID in an
extra `"..."` even when escapeShellArg had already returned a
shell-safe unquoted UUID, producing noisy output like
`gemini --resume "1234-abcd-..."`. Some Windows terminals further
mangle the wrapping quotes when copy-pasting (smart quotes, ConPTY
edge cases), at which point the literal quote characters reach the
CLI and trigger `Invalid session identifier`.

The wrap was introduced in google-gemini#26669 to work around the original
single-quoting in `escapeShellArg` for PowerShell. That root cause
was fixed in google-gemini#26599, which now returns simple alphanumeric strings
(such as UUIDs) unquoted on PowerShell and cmd.exe. With that
function shell-aware, the outer wrap is redundant for the common
UUID case and counterproductive for paste robustness.

This change drops the wrap and trusts `escapeShellArg` to do the
right thing per detected shell. The malicious-input escaping path
is unchanged because `escapeShellArg` still wraps non-alphanumeric
values in single quotes for PowerShell.

Fixes google-gemini#26861
@Eswar809
Eswar809 requested a review from a team as a code owner May 12, 2026 08:14
@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 cleans up the session resume tip display by removing a redundant quoting layer that was previously applied specifically for Windows environments. By trusting the existing shell-aware escaping logic, the CLI now produces cleaner, more reliable command strings that avoid common terminal copy-paste errors while maintaining correct behavior for special characters.

Highlights

  • Redundant Quote Removal: Removed the forced double-quote wrapping of session IDs on Windows, relying instead on the shell-aware escapeShellArg utility.
  • Improved Shell Compatibility: Eliminated potential copy-paste issues in Windows terminals caused by unnecessary quote artifacts that were previously mangling session identifiers.
  • Test Suite Updates: Updated PowerShell-on-Windows tests to verify that session IDs are rendered without redundant quotes.
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 simplifies the session ID rendering in the CLI footer by removing redundant manual quoting for Windows environments. The logic now relies on escapeShellArg to handle alphanumeric strings like UUIDs correctly across shells, including PowerShell and cmd.exe. Corresponding tests in SessionSummaryDisplay.test.tsx have been updated to verify that session IDs are rendered without extra quotes. I have no feedback to provide as there were no review comments.

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality labels May 12, 2026
@gemini-cli

gemini-cli Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

@Eswar809 Eswar809 closed this May 25, 2026
@sripasg sripasg added the size/s A small PR label Jun 2, 2026
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 priority/p2 Important but can be addressed in a future release. size/s A small PR status/pr-nudge-sent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid resume message when quitting in Windows

2 participants