fix(terminal): fall back to HTTP output when WS replay is blank - #385
Open
RonenMars wants to merge 1 commit into
Open
fix(terminal): fall back to HTTP output when WS replay is blank#385RonenMars wants to merge 1 commit into
RonenMars wants to merge 1 commit into
Conversation
A session parked on a question/permission card replays only blank ring-buffer rows over the WS terminal_replay. The handler treated any replay as a successful load, latching replayReceivedRef and clearing the 2s HTTP fallback timer, so the terminal stayed blank forever even though GET /api/sessions/:id/output still held the full transcript. Only accept a replay that carries at least one non-blank line; otherwise leave the fallback timer armed so /output fills the screen.
RonenMars
added a commit
that referenced
this pull request
Jul 23, 2026
RonenMars
added a commit
that referenced
this pull request
Jul 24, 2026
RonenMars
added a commit
that referenced
this pull request
Jul 26, 2026
RonenMars
added a commit
that referenced
this pull request
Jul 28, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Opening a live session that is parked on a question/permission card showed a permanently blank terminal ("Active", prompts counted, but empty body) and repeatedly "failed to load".
The session and server are healthy: the live registry reports
ptyAttached: true/waiting_input, andGET /api/sessions/:id/outputreturns the full 48 KB transcript that renders as 57 lines through the mobileVirtualTerminal.Root cause
A card-parked session replays only blank ring-buffer rows over the WS
terminal_replay.The
terminal_replayhandler inuseTerminalStreamtreated any replay as a successful load — it setreplayReceivedRefand cleared the 2s HTTP-fallback timer unconditionally.So a blank replay stranded the terminal empty forever and the richer HTTP
/outputfallback (which had the full transcript) was never fetched — confirmed in the server logs, where/outputwas never hit for the affected session.Fix
Only accept a
terminal_replaythat carries at least one non-blank line.An empty replay is ignored, leaving the fallback timer armed so
GET /api/sessions/:id/outputfills the screen.Tests
New
__tests__/unit/hooks/useTerminalStream.emptyReplay.test.tsx:/output(previously failing — reproduces the bug),Full
useTerminalStreamsuite green (32 tests); no type errors on the changed files.Compatibility
Mobile-only, additive behavior change to a client-side fallback path.
No server, API, or WS-contract changes.