Repository navigation
fix(tui): stabilize terminal startup and streaming rendering - #618
Merged
san-ci[bot] merged 2 commits intoOct 12, 2026
Merged
Conversation
Signed-off-by: Meng Yan <yanmxa@gmail.com>
|
[REVIEW NOTIFIER] This PR requires a review from @ldpliu. Once this PR has been reviewed and has the |
|
[REVIEW NOTIFIER] This PR requires a review from @ldpliu. Once this PR has been reviewed and has the |
Signed-off-by: Meng Yan <yanmxa@gmail.com>
Contributor
|
/lgtm |
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.
What & why
Starting the first assistant reply moved the first user message upward and left a gap before the response spinner. Streaming history handoffs could also briefly hide reply text or move it up and back down.
Match welcome spacing across live and settled messages, show the waiting spinner immediately, and enqueue nonblocking sends before cancellation can run. Write each temporary redraw and history insert together, and cache parsed history rows instead of reparsing the remainder for every inserted row. Preserve resize, clear, and output-error handling.
The output wrapper also forwards the full terminal-file interface (
Read,Write,Close, andFd). Bubble Tea requires that interface to detect a real TTY and its window size; preserving onlyFdleft ordinary interactive startup with a zero-size frame. The terminal-file regression test checks the exact interface and forwarded operations.Type of change
Testing
Terminal-frame tests cover first-turn row positions, streaming handoffs with synchronized output enabled and disabled, native-history integrity, and clearing during an insert. A live-session test covers cancelling before inference and then sending the next message. Allocation-growth and resize tests cover the cached history rows.
The compiled binary was also launched in a real PTY with a 100x40 window, without supplying Bubble Tea a fixed window size. Repeated launches showed the input prompt in about 0.16-0.31 seconds and exited normally on Ctrl+D. Startup also passed when the terminal did not answer capability queries. Visual validation in the user's terminal application is pending.
The 2,048-row history-drain benchmark took about 0.47 seconds locally on Apple M5. This measures local rendering and queue processing.
Checklist
git commit -s)