Skip to content

Block Options apply while a Posit Assistant install check is pending - #18357

Merged
gtritchie merged 7 commits into
mainfrom
bugfix/assistant-addon-install-race
Jul 27, 2026
Merged

gtritchie merged 7 commits into
mainfrom
bugfix/assistant-addon-install-race

Conversation

@gtritchie

@gtritchie gtritchie commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

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.json present, no bin/) and completions failed silently with "Posit AI: No completions available." showProgress is a non-modal slide label, so it could not gate OK.

Change

  • Block apply while a check is pending. AssistantPreferencesPane tracks 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 the assistantVerifyInstalled round-trip), the chat selector, and the Install button -- and decremented in every terminal branch (the eight UpdateCheckCallback methods plus the verify call's stale-result and error paths). A count (rather than a boolean) keeps overlapping checks from unblocking apply too early.
  • Harden update-check parsing. PositAiInstallManager.checkForUpdates now reads every response flag null-safely and routes a null/malformed payload (a missing required discriminator) to onCheckFailed -- 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 optional isDowngrade and additionalProvidersAvailable fields still default to false.
  • Keep the Playwright helpers deterministic. With OK now blocked during the check, e2e/rstudio/actions/assistant_options.actions.ts settles the install prompt before configuring the rest of the pane, and confirms OK with a retry that tolerates a briefly-blocked OK.
  • Adds a NEWS entry and two localized strings for the warning dialog.

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 @ai Playwright 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.

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
@gtritchie gtritchie added this to the 2026.08 (Yellow Yarrow) milestone Jul 24, 2026
@posit-snyk-bot

posit-snyk-bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gtritchie
gtritchie requested a review from kevinushey July 24, 2026 22:31
@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
1882 0 366 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 470 0 88 0
✅ desktop-macos 464 0 94 1
✅ desktop-windows 474 0 90 0
✅ server-linux 454 0 94 1
✅ setup 20 0 0 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit 76f67873f76ca84dc618a311ea77bb023d391741 - Run #341

- 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
@gtritchie
gtritchie merged commit e9200e6 into main Jul 27, 2026
26 checks passed
@gtritchie
gtritchie deleted the bugfix/assistant-addon-install-race branch July 27, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selecting a code assistant that needs an addon update can leave it uninstalled with no error shown

2 participants