mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-03 16:34:31 -07:00
fix(core): prevent crash in logStartSessionEvent when event is undefined
This commit is contained in:
@@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -511,6 +511,9 @@ export class ClearcutLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async logStartSessionEvent(event: StartSessionEvent): Promise<void> {
|
async logStartSessionEvent(event: StartSessionEvent): Promise<void> {
|
||||||
|
if (!event) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const data: EventValue[] = [
|
const data: EventValue[] = [
|
||||||
{
|
{
|
||||||
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_MODEL,
|
gemini_cli_key: EventMetadataKey.GEMINI_CLI_START_SESSION_MODEL,
|
||||||
|
|||||||
Reference in New Issue
Block a user