From 6ec00c61904e187373753d0094f820b94bec9902 Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Mon, 22 Jun 2026 17:34:54 +0800 Subject: [PATCH] fix: hydrate Workbench messages on realtime gap (#1908) --- web/hwlab-cloud-web/src/stores/workbench.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/hwlab-cloud-web/src/stores/workbench.ts b/web/hwlab-cloud-web/src/stores/workbench.ts index 56de6857..be16f63d 100644 --- a/web/hwlab-cloud-web/src/stores/workbench.ts +++ b/web/hwlab-cloud-web/src/stores/workbench.ts @@ -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 { + 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 { const id = normalizeWorkbenchSessionId(sessionId); if (!id) return; @@ -1063,6 +1072,7 @@ function nonBlockingProjection(projection: ProjectionDiagnostic | null): Project async function hydrateRealtimeGap(reason: string): Promise { 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)