fix(ui): reasoning spinner survived reasoning.end when a later card existed#358
Merged
fix(ui): reasoning spinner survived reasoning.end when a later card existed#358
Conversation
…xisted `splitCardStream` only treated the LAST card as live; everything before it was committed to Ink's `<Static>`. When the model streamed reasoning THEN content (or kicked off a tool card), the reasoning card was no longer last — so it got frozen into `<Static>` while still `streaming: true`. `reasoning.end` later set `streaming: false` on the cards array, but `<Static>` doesn't re-render frozen items, so the "reasoning…" header kept its spinner indefinitely. Fix: live-vs-committed split now scans for the FIRST unsettled card and keeps everything from there onward in the live tree. Cards only move into `<Static>` once they're settled AND every earlier card is too — preserving the in-order append contract `<Static>` requires. `suppressLive` semantic preserved: still hides the trailing live card when the modal owns the screen. Two new regression tests cover the reasoning + streaming case (must stay live) and the all-settled case (must commit in order).
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.
Summary
Reported by user: after a card finishes running, the
reasoning… ⠋header still shows the spinner — looks like a stuck card.Root cause:
splitCardStreamonly treated the last card as live. Everything before it went into<Static>. When the model streamed reasoning then content (or kicked off a tool card), the reasoning card was no longer last — so it was frozen into<Static>while stillstreaming: true.reasoning.endlater setstreaming: falseon the cards array, but<Static>doesn't re-render frozen items, so the spinner stayed forever.Fix
splitCardStreamnow scans for the first unsettled card and keeps everything from that index onward in the live tree. A card only commits to<Static>once it's settled AND every earlier card is too — preserving the in-order append contract<Static>requires.suppressLivesemantic preserved: the trailing live card is still hidden when a modal owns the screen.Test plan
tests/card-stream.test.ts— two new cases: reasoning + streaming both stay live mid-stream, then both commit once settlednpx vitest run— 165/165 test files, 2425 tests pass