fix(core): prevent crash in logStartSessionEvent when event is undefined

This commit is contained in:
Christian Gunderman
2026-01-23 10:54:59 -08:00
parent 488d5fc439
commit 46a577cc80
2 changed files with 13 additions and 0 deletions

View File

@@ -1281,4 +1281,14 @@ describe('ClearcutLogger', () => {
]);
});
});
describe('logStartSessionEvent', () => {
it('should not throw if event is undefined', async () => {
const { logger } = setup();
// @ts-expect-error - intentionally passing undefined to reproduce the issue
await expect(
logger?.logStartSessionEvent(undefined),
).resolves.not.toThrow();
});
});
});

View File

@@ -511,6 +511,9 @@ export class ClearcutLogger {
}
async logStartSessionEvent(event: StartSessionEvent): Promise<void> {
if (!event) {
return;
}
const data: EventValue[] = [
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_MODEL,