fix: hydrate Workbench messages on realtime gap (#1908)

This commit is contained in:
Lyon
2026-06-22 17:34:54 +08:00
committed by GitHub
parent 9deb7ebb32
commit 6ec00c6190
@@ -445,6 +445,15 @@ export const useWorkbenchStore = defineStore("workbench", () => {
return runWorkbenchReadHydration(() => api.workbench.traceEvents(traceId, codeAgentTimeoutMs.value, () => activityRef.value, { afterProjectedSeq, limit: TRACE_HYDRATION_PAGE_LIMIT }));
}
async function refreshSessionMessageProjectionPage(sessionId: string | null | undefined): Promise<void> {
const id = normalizeWorkbenchSessionId(sessionId);
if (!id) return;
const response = await runWorkbenchReadHydration(() => api.workbench.sessionMessages(id, { limit: 100 }));
if (!response.ok || !response.data) return;
const pageMessages = Array.isArray(response.data.messages) ? response.data.messages.map((message) => normalizeChatMessage(message as ChatMessage)) : [];
rememberSessionMessages(id, mergeMessageProjectionPage(id, pageMessages));
}
async function refreshMessageProjectionForTrace(sessionId: string | null | undefined, traceId: string): Promise<void> {
const id = normalizeWorkbenchSessionId(sessionId);
if (!id) return;
@@ -1063,6 +1072,7 @@ function nonBlockingProjection(projection: ProjectionDiagnostic | null): Project
async function hydrateRealtimeGap(reason: string): Promise<void> {
recordActivity(`realtime-gap:${reason}`);
scheduleSessionListRefresh(activeSessionId.value, SESSION_LIST_REALTIME_REFRESH_DELAY_MS);
await refreshSessionMessageProjectionPage(activeSessionId.value);
await Promise.all([
hydrateTurnStatusAuthority(messages.value),
hydrateTraceEvents(messages.value)