Skip to content

Add Check for Posit Assistant updates command - #18332

Merged
gtritchie merged 9 commits into
mainfrom
feature/pa-update-command
Jul 23, 2026
Merged

gtritchie merged 9 commits into
mainfrom
feature/pa-update-command

Conversation

@gtritchie

Copy link
Copy Markdown
Member

Adds a "Check for Posit Assistant updates" command to the Help menu. It runs a forced update check and always reports the result in a modal dialog:

  • Up to date — informational.
  • Update (or initial install) available — offers to install it.
  • A newer Posit Assistant requires a newer RStudio (newer protocol / no compatible build / installed version unsupported with no update) — informational, OK only.
  • Error (network / manifest) — shows the detail when the backend supplies one.

Accepting an available update reuses the existing install engine (chat_install_update): it refuses with a clear message while another RStudio session is using Posit Assistant, stops the backend under a cross-process lock, swaps the installation, and restarts. The in-progress conversation is preserved by the existing resume signal (the &resume URL param the reloaded UI already sends), which the databot backend honors regardless of the launch-time persona flag.

Posit Assistant can trigger the command itself via a new ui/checkForUpdates JSON-RPC method, advertised through rstudioCapabilities() so it can decide whether to surface the option. The request fires a chat_check_for_updates client event that runs the same modal flow. The Posit Assistant side of this is not implemented in this PR.

Other details:

  • The command is bound via ChatTab.Shim (like Uninstall Posit Assistant) so it works before the delay-loaded chat presenter exists, and is visible whenever Posit Assistant is enabled.
  • When Posit Assistant is not selected as the chat provider or assistant, the install offer is suppressed (the backend would refuse it) and the user is directed to select it.
  • The existing "Check for Updates" menu item is relabeled "Check for RStudio Updates" to disambiguate it from the new command.
  • The branch also bundles small git-worktree development fixes (src/gwt/build.xml) found while working on this.

Testing

A Playwright suite (e2e/rstudio/tests/panes/posit-assistant-chat/check-for-updates-command.test.ts) drives each result dialog deterministically via the chat_set_update_check_override automation hook: up-to-date, update available, downgrade, RStudio-update-required, and manifest error, plus the guard that suppresses the install offer when Posit Assistant is not selected. The tests assert on the dialog text and buttons and stop at the confirmation dialog (the actual install needs a download and inter-session lock, covered by the existing C++ suites).

Fixes #18253.

The i18n regeneration step shells out to a gitignored Python venv
(src/gwt/tools/i18n-helpers/VENV) that only exists in the primary
checkout, so 'ant' in a fresh worktree that touched Commands.cmd.xml
failed with 'VENV/bin/python: No such file or directory'. Resolve
python.bin via set-if-exists, preferring the worktree's own venv and
falling back to the primary checkout's (mirroring node/gwtproject/
panmirror), with the OS-specific local path kept as a clear-error
default.

Also invoke the venv python directly from the i18n target (via
<exec executable> + <arg value>) instead of through cmd /c or
/bin/sh -c, so ant quotes each argument and paths containing spaces
are passed intact on every platform. This collapses the separate
Windows and Unix i18n targets into one.
Wire up the checkForPositAssistantUpdates Help-menu command to a handler
that runs a forced update check and always reports the result in a modal
dialog: up to date, an update/install is available (offer to install), a
newer Posit Assistant requires a newer RStudio (OK only), or an error.

Accepting an update reuses the existing install engine (chat_install_update),
which refuses with a clear message while another session is using Posit
Assistant, stops the backend and agent, swaps the installation, and restarts
-- preserving the in-progress conversation via the existing resume mechanism.

Also let Posit Assistant trigger the command via a new ui/checkForUpdates
JSON-RPC method, advertised through rstudioCapabilities() so it can decide
whether to surface the option. The request fires a chat_check_for_updates
client event that runs the same modal flow. The Posit Assistant side is not
implemented here.

Bind the command via ChatTab.Shim (like uninstallPositAssistant) so it works
before the delay-loaded presenter exists, gate its visibility on Posit
Assistant being enabled, and add the French command/dialog strings.

Addresses #18253.
Address review of the check-for-updates command:

- Only offer to install/update when Posit Assistant is selected as the chat
  provider or assistant (isPositAssistantWanted). chat_install_update refuses
  otherwise, so offering it would fail with a confusing error; instead direct
  the user to select Posit Assistant. Fixes the initial-install case where the
  feature is enabled but not selected.
- Present an available older recommended version (isDowngrade) as an explicit
  downgrade, with downgrade-specific messaging and an "Install Version X"
  confirmation label, rather than as an ordinary update.
Address review of the update-check guarding:

- Mirror the backend isPositAssistantWanted() gate exactly: the assistant
  (completions) half now checks the global assistant preference only, matching
  backend isPaiSelected(), while the chat-provider half stays project-aware.
  Previously the client used the project-aware assistant value, so it could
  offer an install the backend rejects (or block one it permits).
- In onUnsupportedVersionUpgradeRequired, switch the confirmation label to
  "Install Version X" when the recommended supported version is older than the
  installed one, so a downgrade isn't presented as a plain update.
Address review: when the installed Posit Assistant version is unsupported and
the recommended replacement is older, use a downgrade title and a message that
both explains the version is unsupported and warns the recommended version is
older, rather than only changing the confirmation label.
Title-case "Updates" and drop the ellipsis from the command label (the menu
label keeps it). Update the French label to match, and refresh the regenerated
command checksum.
Address findings from the multi-agent PR review of the check-for-updates
command:

- onCheckFailed no longer passes the raw (possibly empty/null) backend error
  straight to showErrorMessage, which renders nothing when empty and throws
  when null. It now always shows a framed chatCheckFailedMessage, appending the
  backend detail only when present.
- Wrap the check dispatch in try/catch and clear the guard before dismissing
  the progress indicator (with a null check), so a synchronous failure or a
  throwing dismiss can't strand updateCheckInProgress_ and permanently disable
  the command, or leave the progress overlay pinned.
- onManifestUnavailable now surfaces and logs its error detail (matching the
  startup flow) instead of discarding it; both error paths log via Debug.
- Only surface the chat pane on accept when Posit Assistant is the chat
  provider, avoiding the "not selected" screen in the completions-only case.
- Fix the misleading handleCheckForUpdates comment (the check runs in C++, not
  the frontend; success means the request was accepted for dispatch), correct
  the restart attribution comment, and fix Java import ordering.
Follow-up to the review-hardening pass:

- Always activate the chat pane when the user accepts an install/update.
  installUpdate() renders progress and result feedback there, so the previous
  completions-only guard made accepting appear to do nothing. The post-install
  "not selected" screen in the completions-only case is acceptable and better
  than silent feedback in a hidden pane.
- Set updateCheckInProgress_ only after showProgress() succeeds, so a failure
  creating the progress indicator can't strand the guard and disable the
  command.
Covers the command's modal result dialogs, driven deterministically via the
chat_set_update_check_override one-shot RPC (same mechanism as the blocking
suite): up to date, update available (offer to install), an older recommended
version presented as a downgrade, a newer Posit Assistant requiring a newer
RStudio (OK only), and a manifest error surfacing its detail. Also covers the
guard that suppresses the install offer when Posit Assistant is not selected
as the chat provider or assistant.

Asserts on the .gwt-DialogBox text and its buttons rather than the inline
chat.state, and dismisses install prompts with Cancel (the real install needs
a download + inter-session lock, covered below the UI by the C++ suites).

Addresses #18253.
@gtritchie gtritchie added this to the 2026.08 (Yellow Yarrow) milestone Jul 22, 2026
@posit-snyk-bot

posit-snyk-bot commented Jul 22, 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 22, 2026 21:01
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
1879 0 357 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 470 0 88 0
✅ desktop-macos 472 0 85 2
✅ desktop-windows 474 0 90 0
✅ server-linux 455 0 94 0
✅ setup 8 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 ca2e630e595903712fe97269e77d613e92ca6f84 - Run #303

@gtritchie
gtritchie merged commit 262c391 into main Jul 23, 2026
24 checks passed
@gtritchie
gtritchie deleted the feature/pa-update-command branch July 23, 2026 00:48
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.

Add "Check for Updates" command for Posit Assistant

2 participants