fix(ui): prevent spinner cycling causing early exit in model selection#2086
Merged
tusharmath merged 8 commits intomainfrom Dec 12, 2025
Merged
fix(ui): prevent spinner cycling causing early exit in model selection#2086tusharmath merged 8 commits intomainfrom
tusharmath merged 8 commits intomainfrom
Conversation
Fixes an issue where dialoguer prompts would exit early during model selection after provider activation. Root cause: The finalize_provider_activation function was calling self.get_models() which starts/stops a spinner, followed by on_model_selection() which calls get_models() again, creating rapid spinner cycling (start→stop→start→stop) before showing the dialoguer prompt. This terminal manipulation corrupted the terminal state, causing dialoguer to exit prematurely. Solution: Changed to call self.api.get_models() directly for the availability check, bypassing the spinner. This ensures only one spinner cycle occurs (during the actual model selection), preventing terminal state corruption. This issue was introduced in PR #1958 (commit c58fec0) and only affects v1.9.0. Co-Authored-By: ForgeCode <noreply@forgecode.dev>
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
amitksingh1490
commented
Dec 12, 2025
laststylebender14
pushed a commit
that referenced
this pull request
Dec 16, 2025
#2086) Co-authored-by: ForgeCode <noreply@forgecode.dev> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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.
Problem
Some users reported that model selection prompts can exit immediately without user input (as if ESC/Ctrl+C) after provider activation. This appears timing/environment dependent.
Root Cause (confirmed)
SpinnerManager::start()spawns a background tracker task that periodically updates the progress bar message.Previously,
SpinnerManager::stop()dropped the tracker taskJoinHandlebut did not abort it. In Tokio, dropping aJoinHandledetaches the task, so the tracker could continue running afterstop()and keep updating the terminal concurrently with interactive prompts (dialoguer/ForgeSelect). This kind of concurrent terminal output can lead to flaky prompt behavior.Proof (deterministic regression test)
A new unit test demonstrates the issue:
stop().stop().Solution
stop().Notes
ui.rschange (callingself.api.get_models()directly to avoid a double spinner cycle) has been reverted. With the tracker properly stopped, the spinner cycling itself should no longer leave a detached background task running.Testing
cargo test -p forge_spinnercargo check -p forge_mainCo-Authored-By: ForgeCode noreply@forgecode.dev