Repository navigation
Add Check for Posit Assistant updates command - #18332
Merged
Merged
Conversation
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.
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 |
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.
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:
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&resumeURL 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/checkForUpdatesJSON-RPC method, advertised throughrstudioCapabilities()so it can decide whether to surface the option. The request fires achat_check_for_updatesclient event that runs the same modal flow. The Posit Assistant side of this is not implemented in this PR.Other details:
ChatTab.Shim(like Uninstall Posit Assistant) so it works before the delay-loaded chat presenter exists, and is visible whenever Posit Assistant is enabled.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 thechat_set_update_check_overrideautomation 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.