Skip to content

The agent that grows with you

fix(desktop): tile refresh and post-turn hydrate ignore an empty page too

kshitijk4poor2d46d124c72b
diff --git a/apps/desktop/src/app/contrib/hooks/use-background-sync.ts b/apps/desktop/src/app/contrib/hooks/use-background-sync.ts
index c4877929b7f..4762100d2ca 100644
--- a/apps/desktop/src/app/contrib/hooks/use-background-sync.ts
+++ b/apps/desktop/src/app/contrib/hooks/use-background-sync.ts
@@ -241,6 +241,12 @@ export async function reconcileTileTranscripts({
continue
}
+ // Same rule as the active pane below: a transient zero-row page must not
+ // blank a populated tile, and leaves no signature behind.
+ if (emptyPageOverPopulatedTranscript(latest.messages, $sessionStates.get()[runtimeSessionId], storedSessionId)) {
+ continue
+ }
+
const signature = sessionMessagesSignature(latest.messages)
if (signatureRef.current.get(signatureKey) === signature) {
@@ -292,6 +298,10 @@ export async function hydrateStoredSessionTranscript({
transcriptChangedDuringRead(messagesAtRequest, $sessionStates.get()[runtimeSessionId]?.messages)
for (let index = 0; index < Math.max(1, attempts); index += 1) {
+ if (index > 0) {
+ await new Promise(resolve => window.setTimeout(resolve, 250))
+ }
+
if (superseded()) {
return
}
@@ -305,6 +315,12 @@ export async function hydrateStoredSessionTranscript({
return
}
+ // A zero-row page over the populated turn is a transient read, not the
+ // answer.
+ if (emptyPageOverPopulatedTranscript(latest.messages, $sessionStates.get()[runtimeSessionId], storedSessionId)) {
+ continue
+ }
+
const messages = toChatMessages(latest.messages)
updateSessionState(
runtimeSessionId,
@@ -330,10 +346,6 @@ export async function hydrateStoredSessionTranscript({
} catch {
// Best-effort fallback when live stream payloads are empty.
}
-
- if (index < attempts - 1) {
- await new Promise(resolve => window.setTimeout(resolve, 250))
- }
}
}