feat: add retry button to TUI error messages#3253
Merged
Merged
Conversation
RunStream re-emits a UserMessageEvent for the trailing session message before StreamStarted; on retry this duplicated the user bubble or rendered tool/assistant content in a spurious user bubble. Suppress pre-StreamStarted UserMessageEvents while still forwarding genuine mid-run messages. Assisted-By: Claude
Sayt-0
approved these changes
Jun 26, 2026
aheritier
added a commit
that referenced
this pull request
Jun 27, 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.
What
Adds a clickable ↻ retry button to error messages in the TUI. When an agent turn fails (fatal model error, hook block, loop detection, tool-setup failure), the user can click the button to resume the conversation from where it left off — without retyping the last message.
Why
Previously, when the TUI showed an error in the messages view, there was no way to continue the conversation after a failure. The user had to re-enter their message manually. This adds a one-click recovery path.
How
pkg/tui/types/types.go: newErrorRetryLabel("↻ retry") constant.pkg/tui/components/message/message.go: error messages render the retry affordance on a trailing line.pkg/tui/messages/edit.go: newRetryMsgevent.pkg/tui/components/messages/messages.go:isRetryLabelClickdetects clicks on the label and emitsRetryMsg.pkg/app/app.go: newApp.Retryre-runsRunStreamon the existing session (no new user message), so the conversation continues from where it stopped.pkg/tui/page/chat/chat.go: handlesRetryMsg— starts a fresh cancel context, resets stream tracking, shows the working spinner, and callsApp.Retry. Guards against read-only sessions and in-flight turns.Notable bug fixed during review
RunStreamre-emits aUserMessageEventfor the trailing session message beforeStreamStartedwheneverSendUserMessageis set. On retry this would duplicate the user bubble already on screen — or, when the tail is a tool/assistant message, render non-user content inside a spurious user bubble.App.Retrynow suppresses anyUserMessageEventobserved beforeStreamStarted, while still forwarding genuine mid-run user messages (steer / follow-up) that arrive afterward.Testing
TestErrorMessageShowsRetryAffordance(message rendering)TestMouseClickOnRetryLabelEmitsRetryMsg(click detection)TestApp_Retry_SuppressesReEmittedUserMessage(re-emission suppression)task lint→ 0 issuestask test→ all green