diff --git a/packages/cli/src/ui/commands/bugCommand.test.ts b/packages/cli/src/ui/commands/bugCommand.test.ts
index 1a618fd1..89e3b561 100644
--- a/packages/cli/src/ui/commands/bugCommand.test.ts
+++ b/packages/cli/src/ui/commands/bugCommand.test.ts
@@ -16,6 +16,7 @@ import { formatMemoryUsage } from '../utils/formatters.js';
vi.mock('open');
vi.mock('../../utils/version.js');
vi.mock('../utils/formatters.js');
+vi.mock('@google/gemini-cli-core');
vi.mock('node:process', () => ({
default: {
platform: 'test-platform',
@@ -30,6 +31,9 @@ describe('bugCommand', () => {
beforeEach(() => {
vi.mocked(getCliVersion).mockResolvedValue('0.1.0');
vi.mocked(formatMemoryUsage).mockReturnValue('100 MB');
+ vi.mock('@google/gemini-cli-core', () => ({
+ sessionId: 'test-session-id',
+ }));
vi.stubEnv('SANDBOX', 'gemini-test');
});
@@ -54,6 +58,7 @@ describe('bugCommand', () => {
const expectedInfo = `
* **CLI Version:** 0.1.0
* **Git Commit:** ${GIT_COMMIT_INFO}
+* **Session ID:** test-session-id
* **Operating System:** test-platform v20.0.0
* **Sandbox Environment:** test
* **Model Version:** gemini-pro
@@ -84,6 +89,7 @@ describe('bugCommand', () => {
const expectedInfo = `
* **CLI Version:** 0.1.0
* **Git Commit:** ${GIT_COMMIT_INFO}
+* **Session ID:** test-session-id
* **Operating System:** test-platform v20.0.0
* **Sandbox Environment:** test
* **Model Version:** gemini-pro
diff --git a/packages/cli/src/ui/commands/bugCommand.ts b/packages/cli/src/ui/commands/bugCommand.ts
index 667276ab..528b2b4c 100644
--- a/packages/cli/src/ui/commands/bugCommand.ts
+++ b/packages/cli/src/ui/commands/bugCommand.ts
@@ -15,6 +15,7 @@ import { MessageType } from '../types.js';
import { GIT_COMMIT_INFO } from '../../generated/git-commit.js';
import { formatMemoryUsage } from '../utils/formatters.js';
import { getCliVersion } from '../../utils/version.js';
+import { sessionId } from '@google/gemini-cli-core';
export const bugCommand: SlashCommand = {
name: 'bug',
@@ -40,6 +41,7 @@ export const bugCommand: SlashCommand = {
const info = `
* **CLI Version:** ${cliVersion}
* **Git Commit:** ${GIT_COMMIT_INFO}
+* **Session ID:** ${sessionId}
* **Operating System:** ${osVersion}
* **Sandbox Environment:** ${sandboxEnv}
* **Model Version:** ${modelVersion}
diff --git a/packages/cli/src/ui/components/StatsDisplay.test.tsx b/packages/cli/src/ui/components/StatsDisplay.test.tsx
index a0ed3858..eed105e3 100644
--- a/packages/cli/src/ui/components/StatsDisplay.test.tsx
+++ b/packages/cli/src/ui/components/StatsDisplay.test.tsx
@@ -24,6 +24,7 @@ const useSessionStatsMock = vi.mocked(SessionContext.useSessionStats);
const renderWithMockedStats = (metrics: SessionMetrics) => {
useSessionStatsMock.mockReturnValue({
stats: {
+ sessionId: 'test-session-id',
sessionStartTime: new Date(),
metrics,
lastPromptTokenCount: 0,
@@ -55,7 +56,7 @@ describe('', () => {
const output = lastFrame();
expect(output).toContain('Performance');
- expect(output).not.toContain('Interaction Summary');
+ expect(output).toContain('Interaction Summary');
expect(output).not.toContain('Efficiency & Optimizations');
expect(output).not.toContain('Model'); // The table header
expect(output).toMatchSnapshot();
@@ -289,6 +290,7 @@ describe('', () => {
it('renders the custom title when a title prop is provided', () => {
useSessionStatsMock.mockReturnValue({
stats: {
+ sessionId: 'test-session-id',
sessionStartTime: new Date(),
metrics: zeroMetrics,
lastPromptTokenCount: 0,
diff --git a/packages/cli/src/ui/components/StatsDisplay.tsx b/packages/cli/src/ui/components/StatsDisplay.tsx
index 014026ff..71c88aef 100644
--- a/packages/cli/src/ui/components/StatsDisplay.tsx
+++ b/packages/cli/src/ui/components/StatsDisplay.tsx
@@ -197,30 +197,31 @@ export const StatsDisplay: React.FC = ({
{renderTitle()}
- {tools.totalCalls > 0 && (
-
-
-
- {tools.totalCalls} ({' '}
- ✔ {tools.totalSuccess}{' '}
- ✖ {tools.totalFail} )
+
+
+ {stats.sessionId}
+
+
+
+ {tools.totalCalls} ({' '}
+ ✔ {tools.totalSuccess}{' '}
+ ✖ {tools.totalFail} )
+
+
+
+ {computed.successRate.toFixed(1)}%
+
+ {computed.totalDecisions > 0 && (
+
+
+ {computed.agreementRate.toFixed(1)}%{' '}
+
+ ({computed.totalDecisions} reviewed)
+
-
- {computed.successRate.toFixed(1)}%
-
- {computed.totalDecisions > 0 && (
-
-
- {computed.agreementRate.toFixed(1)}%{' '}
-
- ({computed.totalDecisions} reviewed)
-
-
-
- )}
-
- )}
+ )}
+
diff --git a/packages/cli/src/ui/components/__snapshots__/SessionSummaryDisplay.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/SessionSummaryDisplay.test.tsx.snap
index c9b2bd64..98e7722e 100644
--- a/packages/cli/src/ui/components/__snapshots__/SessionSummaryDisplay.test.tsx.snap
+++ b/packages/cli/src/ui/components/__snapshots__/SessionSummaryDisplay.test.tsx.snap
@@ -5,6 +5,11 @@ exports[` > renders the summary display with a title 1`
│ │
│ Agent powering down. Goodbye! │
│ │
+│ Interaction Summary │
+│ Session ID: │
+│ Tool Calls: 0 ( ✔ 0 ✖ 0 ) │
+│ Success Rate: 0.0% │
+│ │
│ Performance │
│ Wall Time: 1h 23m 45s │
│ Agent Active: 50.2s │
diff --git a/packages/cli/src/ui/components/__snapshots__/StatsDisplay.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/StatsDisplay.test.tsx.snap
index c7c2ec59..09202599 100644
--- a/packages/cli/src/ui/components/__snapshots__/StatsDisplay.test.tsx.snap
+++ b/packages/cli/src/ui/components/__snapshots__/StatsDisplay.test.tsx.snap
@@ -6,6 +6,7 @@ exports[` > Conditional Color Tests > renders success rate in gr
│ Session Stats │
│ │
│ Interaction Summary │
+│ Session ID: test-session-id │
│ Tool Calls: 10 ( ✔ 10 ✖ 0 ) │
│ Success Rate: 100.0% │
│ │
@@ -25,6 +26,7 @@ exports[` > Conditional Color Tests > renders success rate in re
│ Session Stats │
│ │
│ Interaction Summary │
+│ Session ID: test-session-id │
│ Tool Calls: 10 ( ✔ 5 ✖ 5 ) │
│ Success Rate: 50.0% │
│ │
@@ -44,6 +46,7 @@ exports[` > Conditional Color Tests > renders success rate in ye
│ Session Stats │
│ │
│ Interaction Summary │
+│ Session ID: test-session-id │
│ Tool Calls: 10 ( ✔ 9 ✖ 1 ) │
│ Success Rate: 90.0% │
│ │
@@ -62,6 +65,11 @@ exports[` > Conditional Rendering Tests > hides Efficiency secti
│ │
│ Session Stats │
│ │
+│ Interaction Summary │
+│ Session ID: test-session-id │
+│ Tool Calls: 0 ( ✔ 0 ✖ 0 ) │
+│ Success Rate: 0.0% │
+│ │
│ Performance │
│ Wall Time: 1s │
│ Agent Active: 100ms │
@@ -82,6 +90,7 @@ exports[` > Conditional Rendering Tests > hides User Agreement w
│ Session Stats │
│ │
│ Interaction Summary │
+│ Session ID: test-session-id │
│ Tool Calls: 2 ( ✔ 1 ✖ 1 ) │
│ Success Rate: 50.0% │
│ │
@@ -100,6 +109,11 @@ exports[` > Title Rendering > renders the custom title when a ti
│ │
│ Agent powering down. Goodbye! │
│ │
+│ Interaction Summary │
+│ Session ID: test-session-id │
+│ Tool Calls: 0 ( ✔ 0 ✖ 0 ) │
+│ Success Rate: 0.0% │
+│ │
│ Performance │
│ Wall Time: 1s │
│ Agent Active: 0s │
@@ -115,6 +129,11 @@ exports[` > Title Rendering > renders the default title when no
│ │
│ Session Stats │
│ │
+│ Interaction Summary │
+│ Session ID: test-session-id │
+│ Tool Calls: 0 ( ✔ 0 ✖ 0 ) │
+│ Success Rate: 0.0% │
+│ │
│ Performance │
│ Wall Time: 1s │
│ Agent Active: 0s │
@@ -130,6 +149,11 @@ exports[` > renders a table with two models correctly 1`] = `
│ │
│ Session Stats │
│ │
+│ Interaction Summary │
+│ Session ID: test-session-id │
+│ Tool Calls: 0 ( ✔ 0 ✖ 0 ) │
+│ Success Rate: 0.0% │
+│ │
│ Performance │
│ Wall Time: 1s │
│ Agent Active: 19.5s │
@@ -155,6 +179,7 @@ exports[` > renders all sections when all data is present 1`] =
│ Session Stats │
│ │
│ Interaction Summary │
+│ Session ID: test-session-id │
│ Tool Calls: 2 ( ✔ 1 ✖ 1 ) │
│ Success Rate: 50.0% │
│ User Agreement: 100.0% (1 reviewed) │
@@ -182,6 +207,11 @@ exports[` > renders only the Performance section in its zero sta
│ │
│ Session Stats │
│ │
+│ Interaction Summary │
+│ Session ID: test-session-id │
+│ Tool Calls: 0 ( ✔ 0 ✖ 0 ) │
+│ Success Rate: 0.0% │
+│ │
│ Performance │
│ Wall Time: 1s │
│ Agent Active: 0s │
diff --git a/packages/cli/src/ui/contexts/SessionContext.tsx b/packages/cli/src/ui/contexts/SessionContext.tsx
index 942af8b5..80c2454c 100644
--- a/packages/cli/src/ui/contexts/SessionContext.tsx
+++ b/packages/cli/src/ui/contexts/SessionContext.tsx
@@ -17,6 +17,7 @@ import {
uiTelemetryService,
SessionMetrics,
ModelMetrics,
+ sessionId,
} from '@google/gemini-cli-core';
// --- Interface Definitions ---
@@ -24,6 +25,7 @@ import {
export type { SessionMetrics, ModelMetrics };
export interface SessionStatsState {
+ sessionId: string;
sessionStartTime: Date;
metrics: SessionMetrics;
lastPromptTokenCount: number;
@@ -64,6 +66,7 @@ export const SessionStatsProvider: React.FC<{ children: React.ReactNode }> = ({
children,
}) => {
const [stats, setStats] = useState({
+ sessionId,
sessionStartTime: new Date(),
metrics: uiTelemetryService.getMetrics(),
lastPromptTokenCount: 0,
diff --git a/packages/core/src/telemetry/clearcut-logger/event-metadata-key.ts b/packages/core/src/telemetry/clearcut-logger/event-metadata-key.ts
index 66797caa..7ec0bccb 100644
--- a/packages/core/src/telemetry/clearcut-logger/event-metadata-key.ts
+++ b/packages/core/src/telemetry/clearcut-logger/event-metadata-key.ts
@@ -223,11 +223,11 @@ export enum EventMetadataKey {
// Kitty Sequence Overflow Event Keys
// ===========================================================================
- // Logs the length of the kitty sequence that overflowed.
- GEMINI_CLI_KITTY_SEQUENCE_LENGTH = 53,
-
// Logs the truncated kitty sequence.
GEMINI_CLI_KITTY_TRUNCATED_SEQUENCE = 52,
+
+ // Logs the length of the kitty sequence that overflowed.
+ GEMINI_CLI_KITTY_SEQUENCE_LENGTH = 53,
}
export function getEventMetadataKey(