google-gemini / google-gemini/gemini-cli
bug: IDE connection events are logged with the START_SESSION event name (EventNames.IDE_CONNECTION unused), corrupting session metrics
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 45
Description
## What happened?
`logIdeConnectionEvent` builds an event whose payload carries only `GEMINI_CLI_IDE_CONNECTION_TYPE`, but tags it with `EventNames.START_SESSION`. The purpose-built enum value `EventNames.IDE_CONNECTION = 'ide_connection'` exists (defined at line 99) and is referenced **nowhere else in the repository** — every IDE connection is therefore counted as a *session start* in Clearcut analytics, corrupting session-count metrics for any user with the IDE companion connected.
## Affected code
`packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1148-1150`:
```ts
this.enqueueLogEventAfterExperimentsLoadAsync(
this.createLogEvent(EventNames.START_SESSION, data),
)
```
with the payload above it:
```ts
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_IDE_CONNECTION_TYPE,
value: JSON.stringify(event.connection_type),
},
```
and the unused enum member at `clearcut-logger.ts:99`: `IDE_CONNECTION = 'ide_connection',`.
## How can this be reproduced?
Connect the CLI to the VS Code companion and inspect outgoing Clearcut events (or unit-test `logIdeConnectionEvent`): the logged event name is `start_session`, not `ide_connection`.
## What did you expect to happen?
IDE connections are recorded under their dedicated event name so session metrics remain accurate.
## Impact
Analytics-only: inflated session counts / distorted DAU-style metrics whenever IDE integration is active. No functional user impact.
## Suggested direction
Use `EventNames.IDE_CONNECTION` in `createLogEvent` (and update dashboards/tests referencing the old behavior).
---
*Found by source audit on current `main` (commit `5411f113c`); platform-independent. No open issue/PR covering this was found (searched: telemetry ide connection session).*
Contributor guide
Research direction
Start in packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts at logIdeConnectionEvent around lines 1148-1150, and inspect the IDE_CONNECTION enum member at line 99. Verify the event name produced when connecting the CLI to the VS Code companion, then update tests or dashboards that reference the old behavior. Done means IDE connections use the dedicated ide_connection event and are no longer counted as session starts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- analytics, cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100