diff --git a/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx b/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx index 9de9e1385bf..2377d90fdd5 100644 --- a/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx +++ b/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx @@ -171,7 +171,7 @@ describe('', () => { unmount(); }); - it('renders a standard UUID-formatted session ID in the footer (powershell) on Windows', async () => { + it('renders a standard UUID-formatted session ID without quotes in the footer (powershell) on Windows', async () => { isWindowsMock.mockReturnValue(true); getShellConfigurationMock.mockReturnValue({ executable: 'powershell.exe', @@ -186,8 +186,11 @@ describe('', () => { ); const output = lastFrame(); - // PowerShell doesn't wrap UUID in quotes by default, but we wrap it in double quotes on Windows. - expect(output).toContain('gemini --resume "1234-abcd-5678-efgh"'); + // escapeShellArg already returns simple alphanumeric strings (like UUIDs) + // unquoted for PowerShell, and such strings paste safely into both + // PowerShell and cmd.exe. No additional wrapping is required. + expect(output).toContain('gemini --resume 1234-abcd-5678-efgh'); + expect(output).not.toContain('"1234-abcd-5678-efgh"'); unmount(); }); diff --git a/packages/cli/src/ui/components/SessionSummaryDisplay.tsx b/packages/cli/src/ui/components/SessionSummaryDisplay.tsx index 55ef50c7463..7313949a9cb 100644 --- a/packages/cli/src/ui/components/SessionSummaryDisplay.tsx +++ b/packages/cli/src/ui/components/SessionSummaryDisplay.tsx @@ -8,11 +8,7 @@ import type React from 'react'; import { StatsDisplay } from './StatsDisplay.js'; import { useSessionStats } from '../contexts/SessionContext.js'; import { useConfig } from '../contexts/ConfigContext.js'; -import { - escapeShellArg, - getShellConfiguration, - isWindows, -} from '@google/gemini-cli-core'; +import { escapeShellArg, getShellConfiguration } from '@google/gemini-cli-core'; interface SessionSummaryDisplayProps { duration: string; @@ -28,17 +24,11 @@ export const SessionSummaryDisplay: React.FC = ({ const worktreeSettings = config.getWorktreeSettings(); const escapedSessionId = escapeShellArg(stats.sessionId, shell); - const footerSessionId = - isWindows() && - !escapedSessionId.startsWith('"') && - !escapedSessionId.startsWith("'") - ? `"${escapedSessionId}"` - : escapedSessionId; - let footer = `To resume this session: gemini --resume ${footerSessionId}`; + let footer = `To resume this session: gemini --resume ${escapedSessionId}`; if (worktreeSettings) { footer = - `To resume work in this worktree: cd ${escapeShellArg(worktreeSettings.path, shell)} && gemini --resume ${footerSessionId}\n` + + `To resume work in this worktree: cd ${escapeShellArg(worktreeSettings.path, shell)} && gemini --resume ${escapedSessionId}\n` + `To remove manually: git worktree remove ${escapeShellArg(worktreeSettings.path, shell)}`; }