Revert "fix: prevent partial config write when model selection is cancelled d…"#2752
Merged
tusharmath merged 1 commit intomainfrom Mar 31, 2026
Conversation
…celled d…" This reverts commit 6a36b83.
Comment on lines
+2689
to
+2697
| async fn on_provider_selection(&mut self) -> Result<()> { | ||
| // Select a provider | ||
| // If no provider was selected (user canceled), return early | ||
| let any_provider = match self.select_provider().await? { | ||
| Some(provider) => provider, | ||
| None => return Ok(false), | ||
| None => return Ok(()), | ||
| }; | ||
|
|
||
| self.activate_provider(any_provider).await?; | ||
| Ok(true) | ||
| self.activate_provider(any_provider).await |
Contributor
There was a problem hiding this comment.
Logic Error: Loss of cancellation signal
Changing return type from Result<bool> to Result<()> removes the ability to signal user cancellation. When select_provider() returns None (line 2694), this function returns Ok(()), making it indistinguishable from successful completion.
Impact: Callers like on_model_selection_wrapper() (line 2030) can no longer detect if the user cancelled provider selection, potentially leading to unexpected behavior.
Fix: Restore the boolean return type to preserve cancellation signaling:
async fn on_provider_selection(&mut self) -> Result<bool> {
let any_provider = match self.select_provider().await? {
Some(provider) => provider,
None => return Ok(false), // Signal cancellation
};
self.activate_provider(any_provider).await?;
Ok(true) // Signal success
}
Suggested change
| async fn on_provider_selection(&mut self) -> Result<()> { | |
| // Select a provider | |
| // If no provider was selected (user canceled), return early | |
| let any_provider = match self.select_provider().await? { | |
| Some(provider) => provider, | |
| None => return Ok(false), | |
| None => return Ok(()), | |
| }; | |
| self.activate_provider(any_provider).await?; | |
| Ok(true) | |
| self.activate_provider(any_provider).await | |
| async fn on_provider_selection(&mut self) -> Result<bool> { | |
| // Select a provider | |
| // If no provider was selected (user canceled), return early | |
| let any_provider = match self.select_provider().await? { | |
| Some(provider) => provider, | |
| None => return Ok(false), | |
| }; | |
| self.activate_provider(any_provider).await?; | |
| Ok(true) | |
| } | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
This was referenced Mar 31, 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.
Reverts #2728