Recover spinner goroutine panics without wedging spinner state#31162
Merged
Recover spinner goroutine panics without wedging spinner state#31162
Conversation
Closed
4 tasks
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix spinner background goroutine panic recovery in CLI
Recover spinner goroutine panics without wedging spinner state
May 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Improves resilience of the console spinner by recovering from panics inside the Bubble Tea render goroutine and ensuring spinner lifecycle state is reset, with a regression test to prevent the running flag from getting wedged.
Changes:
- Add
recover()handling aroundProgram.Run()in the spinner goroutine. - Reset
SpinnerWrapper.runningon goroutine exit to allow subsequentStart()calls. - Add a unit test that simulates a Bubble Tea model panic during startup and verifies
Start()can be called again.
Show a summary per file
| File | Description |
|---|---|
| pkg/console/spinner.go | Adds panic recovery and resets running when the spinner goroutine exits. |
| pkg/console/spinner_test.go | Adds a regression test to ensure spinner state is not wedged after a Bubble Tea panic. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
Comment on lines
+142
to
+146
| defer func() { | ||
| s.mu.Lock() | ||
| s.running = false | ||
| s.mu.Unlock() | ||
| }() |
Collaborator
|
@copilot Merge main and recompile |
…oroutine-panic-recovery Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
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.
maininto the PR branch