fix(core): dynamic session ID injection to resolve resume bugs (#24972)

This commit is contained in:
Tommaso Sciortino
2026-04-08 23:27:24 +00:00
committed by GitHub
parent 80764c8bb5
commit d06dba3538
33 changed files with 165 additions and 189 deletions

View File

@@ -60,7 +60,7 @@ describe('SessionStatsContext', () => {
> = { current: undefined };
const { unmount } = await render(
<SessionStatsProvider>
<SessionStatsProvider sessionId="test-session-id">
<TestHarness contextRef={contextRef} />
</SessionStatsProvider>,
);
@@ -79,7 +79,7 @@ describe('SessionStatsContext', () => {
> = { current: undefined };
const { unmount } = await render(
<SessionStatsProvider>
<SessionStatsProvider sessionId="test-session-id">
<TestHarness contextRef={contextRef} />
</SessionStatsProvider>,
);
@@ -162,7 +162,7 @@ describe('SessionStatsContext', () => {
};
const { unmount } = await render(
<SessionStatsProvider>
<SessionStatsProvider sessionId="test-session-id">
<CountingTestHarness />
</SessionStatsProvider>,
);
@@ -245,7 +245,7 @@ describe('SessionStatsContext', () => {
> = { current: undefined };
const { unmount } = await render(
<SessionStatsProvider>
<SessionStatsProvider sessionId="test-session-id">
<TestHarness contextRef={contextRef} />
</SessionStatsProvider>,
);

View File

@@ -13,14 +13,13 @@ import {
useMemo,
useEffect,
} from 'react';
import type {
SessionMetrics,
ModelMetrics,
RoleMetrics,
ToolCallStats,
} from '@google/gemini-cli-core';
import { uiTelemetryService, sessionId } from '@google/gemini-cli-core';
import { uiTelemetryService } from '@google/gemini-cli-core';
export enum ToolCallDecision {
ACCEPT = 'accept',
@@ -183,9 +182,10 @@ const SessionStatsContext = createContext<SessionStatsContextValue | undefined>(
// --- Provider Component ---
export const SessionStatsProvider: React.FC<{ children: React.ReactNode }> = ({
children,
}) => {
export const SessionStatsProvider: React.FC<{
children: React.ReactNode;
sessionId: string;
}> = ({ children, sessionId }) => {
const [stats, setStats] = useState<SessionStatsState>({
sessionId,
sessionStartTime: new Date(),