fix(telemetry): Prevent duplicate StartSessionEvent logging (#12090)

This commit is contained in:
Sandy Tao
2025-10-27 13:40:03 -07:00
committed by GitHub
parent abd22a753d
commit 6db64aab2b
4 changed files with 32 additions and 26 deletions

View File

@@ -10,6 +10,8 @@ import {
IdeConnectionType,
logIdeConnection,
type Config,
StartSessionEvent,
logCliConfiguration,
} from '@google/gemini-cli-core';
import { type LoadedSettings } from '../config/settings.js';
import { performInitialAuth } from './auth.js';
@@ -42,6 +44,11 @@ export async function initializeApp(
const shouldOpenAuthDialog =
settings.merged.security?.auth?.selectedType === undefined || !!authError;
logCliConfiguration(
config,
new StartSessionEvent(config, config.getToolRegistry()),
);
if (config.getIdeMode()) {
const ideClient = await IdeClient.getInstance();
await ideClient.connect();

View File

@@ -174,6 +174,18 @@ describe('gemini.tsx main function', () => {
getMessageBus: () => ({
subscribe: vi.fn(),
}),
getToolRegistry: vi.fn(),
getContentGeneratorConfig: vi.fn(),
getModel: () => 'gemini-pro',
getEmbeddingModel: () => 'embedding-001',
getApprovalMode: () => 'default',
getCoreTools: () => [],
getTelemetryEnabled: () => false,
getTelemetryLogPromptsEnabled: () => false,
getFileFilteringRespectGitIgnore: () => true,
getOutputFormat: () => 'text',
getExtensions: () => [],
getUsageStatisticsEnabled: () => false,
} as unknown as Config;
});
vi.mocked(loadSettings).mockReturnValue({
@@ -309,6 +321,18 @@ describe('gemini.tsx main function kitty protocol', () => {
getMessageBus: () => ({
subscribe: vi.fn(),
}),
getToolRegistry: vi.fn(),
getContentGeneratorConfig: vi.fn(),
getModel: () => 'gemini-pro',
getEmbeddingModel: () => 'embedding-001',
getApprovalMode: () => 'default',
getCoreTools: () => [],
getTelemetryEnabled: () => false,
getTelemetryLogPromptsEnabled: () => false,
getFileFilteringRespectGitIgnore: () => true,
getOutputFormat: () => 'text',
getExtensions: () => [],
getUsageStatisticsEnabled: () => false,
} as unknown as Config);
vi.mocked(loadSettings).mockReturnValue({
errors: [],