You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recovers Desktop assistant output when a turn finishes without a usable terminal message.
There are two related failure paths:
An empty message.complete can arrive while the live transcript still ends with the user message, even though the durable session already contains the assistant response. The completion handler now hydrates that durable response.
A confirmed live turn can transition to session.info running=false without receiving message.complete, including after interim assistant output. The session handler now settles the pending bubble, refreshes session metadata, and hydrates the active transcript from durable history.
Foreground isolation remains intact: background sessions update their cached busy state and sidebar metadata without replacing the visible transcript.
The older #62504 and #41922 changes preserve assistant text that was already streamed into the renderer. This change covers the complementary cases where no final assistant text is visible and durable-history catch-up is required, or where the terminal event is missing entirely.
New feature (non-breaking change that adds functionality)
Security fix
Documentation update
Tests (adding or improving test coverage)
Refactor (no behavior change)
New skill (bundled or hub)
Changes Made
Updated apps/desktop/src/app/session/hooks/use-message-stream/index.ts to hydrate durable history when an empty completion leaves an unresolved user tail.
Updated apps/desktop/src/app/session/hooks/use-message-stream/gateway-event.ts to recover any confirmed live turn that ends without message.complete, including turns with interim assistant output.
Added regression coverage in interim-sealing.test.tsx and session-info-side-effects.test.tsx for both event sequences and active/background session isolation.
How to Test
Run cd apps/desktop && npx vitest run src/app/session/hooks/use-message-stream.
Run npm run typecheck, npm run lint, and npm run build from apps/desktop.
Simulate an empty message.complete after message.start, and a message.interim followed by session.info running=false without message.complete; verify the active transcript hydrates from stored history and the composer is released.
AI code review — automated review for reference; please use your judgment.
gateway-event.ts — Positive: widening the recovery edge from "never saw an assistant payload" to turnLive (a confirmed live turn whose terminal message never arrived) closes the reconnect-gap case where interim text streamed but message.complete was lost — previously that left awaitingResponse latched exactly like [Bug]: TUI (Desktop App) shows "Running Code..." indicator indefinitely after session has completed #46517 but with partial content on screen, which is worse because it looks alive. The once-per-edge coalescing comment carries over correctly.
index.ts hydration gate — Positive: (!unresolvedUserTail || !finalText) is the subtle half — a turn that produced some text but ended unresolved still needs the durable transcript pulled rather than trusting the stream; its regression test mounts a state whose transcript ends on the user message and asserts hydration fires with the right args on an empty completion. No change requested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area/sessionsSession lifecycle, resume, persistence, historyarea/streamingStreaming responses: gateway delivery, provider wirecomp/desktopElectron desktop app (apps/desktop/*)P2Medium — degraded but workaround existssweeper:risk-session-stateSweeper risk: may lose/corrupt/mis-associate session or context statetype/bugSomething isn't working
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Recovers Desktop assistant output when a turn finishes without a usable terminal message.
There are two related failure paths:
message.completecan arrive while the live transcript still ends with the user message, even though the durable session already contains the assistant response. The completion handler now hydrates that durable response.session.info running=falsewithout receivingmessage.complete, including after interim assistant output. The session handler now settles the pending bubble, refreshes session metadata, and hydrates the active transcript from durable history.Foreground isolation remains intact: background sessions update their cached busy state and sidebar metadata without replacing the visible transcript.
The older #62504 and #41922 changes preserve assistant text that was already streamed into the renderer. This change covers the complementary cases where no final assistant text is visible and durable-history catch-up is required, or where the terminal event is missing entirely.
Related Issue
Fixes #88036
Type of Change
Changes Made
apps/desktop/src/app/session/hooks/use-message-stream/index.tsto hydrate durable history when an empty completion leaves an unresolved user tail.apps/desktop/src/app/session/hooks/use-message-stream/gateway-event.tsto recover any confirmed live turn that ends withoutmessage.complete, including turns with interim assistant output.interim-sealing.test.tsxandsession-info-side-effects.test.tsxfor both event sequences and active/background session isolation.How to Test
cd apps/desktop && npx vitest run src/app/session/hooks/use-message-stream.npm run typecheck,npm run lint, andnpm run buildfromapps/desktop.message.completeaftermessage.start, and amessage.interimfollowed bysession.info running=falsewithoutmessage.complete; verify the active transcript hydrates from stored history and the composer is released.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass (N/A: Desktop TypeScript-only change)Documentation & Housekeeping
docs/, docstrings) - N/Acli-config.yaml.exampleif I added/changed config keys - N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - N/AScreenshots / Logs