← Back to PRs

#20516: fix(tui): preserve streamed text on finalize for pure text responses

by MisterGuy420 open 2026-02-19 01:47 View on GitHub →
commands size: S trusted-contributor
Fixes #20453 ## What changed - Modified to preserve streamed text when final text blocks are a prefix/suffix subset of streamed text, regardless of whether non-text content was present - Updated the test to reflect the correct expected behavior ## Why it fixes the issue The previous fix (#15573) only protected against boundary text block drops when there were non-text content blocks (like tool calls). This variant (#20453) occurs with pure text responses where the final payload drops boundary text blocks that were streamed. The fix extends the protection to all cases where the final text is a prefix/suffix subset of the streamed text. ## AI-assisted contribution This fix was generated by an AI agent (OpenClaw cron: gh-issues-fix) - Testing depth: validated with pnpm build && pnpm check && pnpm test - The fix addresses the root cause described in the issue by checking for all text responses, not just those with non-text content blocks <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR contains two separate fixes: 1. **TUI stream assembler fix**: Extended the text preservation logic to handle pure text responses where the final payload drops boundary text blocks. The previous fix only protected against this when non-text content blocks (like tool calls) were present. Now it preserves streamed text whenever the final text blocks are a prefix or suffix subset of the streamed blocks, regardless of content type. 2. **Configure wizard UX improvement**: Made ESC key go back to the configuration menu instead of exiting the entire wizard. This is achieved by wrapping section configuration logic in a try-catch that handles `WizardCancelledError` and continues the loop instead of propagating the error. Both changes are logical improvements with appropriate test updates for the TUI fix. <h3>Confidence Score: 5/5</h3> - Safe to merge with no identified issues - Both fixes are well-contained with clear logic. The TUI fix extends existing boundary-drop protection to pure text responses (a natural extension of the previous fix), and includes a test update that validates the new behavior. The wizard fix improves UX by properly handling ESC keypresses with appropriate error handling. No logical errors, security issues, or unintended side effects detected. - No files require special attention <sub>Last reviewed commit: 3818f85</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs