fix(cli): remove redundant double-quote wrap from session resume tip - #26907
fix(cli): remove redundant double-quote wrap from session resume tip#26907Eswar809 wants to merge 2 commits into
Conversation
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
Summary of ChangesHello, 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
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 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 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
|
There was a problem hiding this comment.
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.
|
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. |
Summary
"..."wrap around the session ID in the resume tip shown when a session endsescapeShellArg(made shell-aware in don't wrap args unnecessarily #26599) to produce paste-safe output for the detected shellContext
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
escapeShellArgto return alphanumeric strings unquoted for both PowerShelland 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
isWindows()branch inSessionSummaryDisplay.tsx; useescapeShellArg(stats.sessionId, shell)directly for both the standard and worktreefooter paths
Behavior
powershellgemini --resume "uuid"gemini --resume uuidpowershellgemini --resume 'a b c'gemini --resume 'a b c'(unchanged)bashgemini --resume uuidgemini --resume uuid(unchanged)The malicious-input escape path is unchanged —
escapeShellArgstill wraps non-alphanumeric values in single quotes for PowerShell and double quotes forcmd.exe / bash.
Test plan
npx vitest run packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx— 6/6 passnpx vitest run packages/cli/src/utils/sessions.test.ts packages/cli/src/utils/sessionUtils.test.ts— 50/50 passnpm run typecheck— cleangemini --resume <uuid>command into Windows Terminal — should not produceInvalid session identifier