fix(core): update telemetry token count after session resume (#15491)

Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
Pyush Sinha
2026-01-20 10:01:39 -08:00
committed by GitHub
parent b71fe94e0a
commit 5b8a23979f
2 changed files with 12 additions and 0 deletions

View File

@@ -303,6 +303,17 @@ describe('Gemini Client (client.ts)', () => {
});
});
describe('resumeChat', () => {
it('should update telemetry token count when a chat is resumed', async () => {
const history: Content[] = [
{ role: 'user', parts: [{ text: 'resumed message' }] },
];
await client.resumeChat(history);
expect(uiTelemetryService.setLastPromptTokenCount).toHaveBeenCalled();
});
});
describe('resetChat', () => {
it('should create a new chat session, clearing the old history', async () => {
// 1. Get the initial chat instance and add some history.

View File

@@ -269,6 +269,7 @@ export class GeminiClient {
resumedSessionData?: ResumedSessionData,
): Promise<void> {
this.chat = await this.startChat(history, resumedSessionData);
this.updateTelemetryTokenCount();
}
getChatRecordingService(): ChatRecordingService | undefined {