Repository navigation
Block Options apply while a Posit Assistant install check is pending - #18357
Merged
Merged
Conversation
Selecting a Posit Assistant code assistant or chat provider kicks off an async install/update check that later shows an install prompt. Confirming Global Options before that check resolved persisted the selection without installing the addon, leaving completions silently unavailable. AssistantPreferencesPane now tracks the in-flight check and blocks validate() (OK/Apply) until it resolves, so the install prompt is never skipped. Update the Playwright helpers to settle the prompt before confirming and to tolerate a briefly-blocked OK. Addresses #18350
Address review feedback on the install-check guard: - Use a count instead of a boolean so overlapping checks (chat selector, assistant selector, Install button) each hold apply until all resolve, rather than the first callback unblocking while another is pending. - Begin the check before assistantVerifyInstalled() for a user selection, so an immediate OK cannot close the dialog during the verify round-trip; the count is released on the verify stale/error paths or transferred to the update check without a gap. Addresses #18350
- Read every update-check flag null-safely in PositAiInstallManager so a malformed or version-skewed payload cannot throw before dispatching a callback; an exception there would skip endPositAiCheck() and strand the preferences apply guard (dialog stuck blocked). - Correct comments that overstated the counter reaching zero under overlapping checks and implied the OK button is disabled rather than gated in validate(); clarify the E2E install/update prompt helper. Addresses #18350
A null/missing required discriminator previously defaulted to false and resolved as onNoUpdateAvailable, which the preferences pane treats as already-installed -- letting Posit Assistant be persisted without a confirmed install. Missing required flags now dispatch onCheckFailed (which offers to install); only the genuinely optional isDowngrade and additionalProvidersAvailable fields still default to false. Addresses #18350
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
- Extract the chatCheckForUpdates response interpretation into a package-visible static dispatchUpdateCheck() and cover it with a GWTTestCase: malformed/null/non-boolean payloads route to onCheckFailed, optional flags default to false, and exactly one callback fires per path. These run under gwt-unit-tests; the @ai E2E tests that would otherwise exercise this do not run in ordinary PR CI. - Log a malformed update-check response before dispatching onCheckFailed, so a real backend/protocol defect leaves a trail (callers surface the failure differently and some do not log it). - Scope the comment's 'offers to install' claim to the preferences pane; the chat-pane callers show an error instead. Addresses #18350
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.
Closes #18350.
Problem
Selecting a Posit Assistant code assistant (or chat provider) starts an asynchronous install/update check that later shows an install prompt. Confirming Global Options with OK before that check resolved persisted the selection (
assistant = "posit") on an independent path, while the install prompt was orphaned -- so the addon was never installed (manifest-check.jsonpresent, nobin/) and completions failed silently with "Posit AI: No completions available."showProgressis a non-modal slide label, so it could not gate OK.Change
AssistantPreferencesPanetracks in-flight Posit install/update checks with a count;validate()refuses OK/Apply (with a "Checking for Updates" message) while the count is greater than zero, so the selection cannot be persisted before the install prompt appears. The count is incremented at each user-driven entry point -- the assistant selector (before theassistantVerifyInstalledround-trip), the chat selector, and the Install button -- and decremented in every terminal branch (the eightUpdateCheckCallbackmethods plus the verify call's stale-result and error paths). A count (rather than a boolean) keeps overlapping checks from unblocking apply too early.PositAiInstallManager.checkForUpdatesnow reads every response flag null-safely and routes a null/malformed payload (a missing required discriminator) toonCheckFailed-- which offers to install -- instead of throwing (which would skip every callback and strand the apply guard) or defaulting to "up to date" (which would let the selection persist without a confirmed install). Only the genuinely optionalisDowngradeandadditionalProvidersAvailablefields still default to false.e2e/rstudio/actions/assistant_options.actions.tssettles the install prompt before configuring the rest of the pane, and confirms OK with a retry that tolerates a briefly-blocked OK.Scope / follow-up
This covers the confirm/OK path (fresh-profile None -> Posit and the Posit chat provider). Switching the code assistant from GitHub Copilot to Posit persists
"posit"eagerly through a separate pre-existing path (disableCopilot) that this change does not cover; that is tracked in #18356.Verification
cd src/gwt && ant javac-- clean.cd e2e/rstudio && npm run typecheck-- clean.The
@aiPlaywright suite (which installs the addon and asserts ghost text / NES) is the end-to-end guard for this behavior but requires AI credentials and network, so it was not run locally -- manual verification of the install flow is recommended before merge.