Repository navigation
Add a setting to disable user-managed Posit Assistant installs - #18691
Merged
Merged
Conversation
…installs Adds allow-posit-assistant-installation (rsession.conf, default 1) and the RSTUDIO_DISABLE_POSIT_ASSISTANT_INSTALLATION environment variable, read together by module_context::isPositAssistantInstallationEnabledByAdmin(). The allow-* family generates "|| allowOverlay()", so Desktop force-allows the option; the environment variable is the Desktop surface. This commit adds the setting and reports it to the client as sessionInfo["posit_assistant_installation_enabled"]. The gates that act on it follow. Addresses #18443
The variable was a development-only override: undocumented, unused by the e2e suite, and a plain environment variable any user can set in .Renviron. That last property would make an administrator setting that disables user-managed installation decorative, so it goes rather than gaining a gate of its own. Developers testing a local build install it into the XDG user data directory or point posit-assistant-path at it. It was also the only injection seam locatePositAssistantInstallation() had: the tests used it both to neutralize ambient state and to point the search at temp directories. Replace it with an InstallSearchPaths struct resolved by positAssistantSearchPaths() and passed to an overload of the locate function, following the bundledPositAssistantInstallPath(resourcePath) precedent. getInstalledVersion() and getInstalledProtocolVersion() gain path-taking overloads for the same reason. The search-order tests now assert the tiers directly rather than hedging on whatever happens to be installed on the machine running them. Addresses #18443
locatePositAssistantInstallation() is the one resolution point both the chat backend and the NES agent go through, so gating it there makes both honor the setting. An installation already in the user data directory -- left from before the setting changed, or copied there to get around it -- is ignored rather than removed, and logged once per session because it silently changes which version runs and can be a downgrade. Addresses #18443
chat_install_update and chat_uninstall_posit_assistant now refuse when the administrator has disabled user-managed installation, delivering the reason via client_info so the frontend can show it verbatim. The uninstall gate sits ahead of the on-disk checks: a leftover user-level installation may exist in managed mode, and it is ignored rather than removed. Addresses #18443
shouldFetchManifest() now returns false in managed mode, ahead of the throttle and ahead of `force`. That covers all three callers of startUpdateCheck() -- the startup kickoff, chat_check_for_updates, and chat_install_update -- and routes them through resolveWithoutManifestFetch() so the client still learns installed/not-installed without touching cdn.posit.co. resolveWithoutManifestFetch() previously assumed its throttled-skip caller's precondition (a compatible version is installed). Managed mode reaches it with whatever the administrator provides, so it now recomputes the protocol mismatch and normalizes a missing install to "0.0.0". An administrator copy with a missing or mismatched protocol.json reports as unsupported, which is the correct outcome: no update can be offered that would fix it. chat_check_for_updates keeps succeeding in managed mode and reports the mode as installationManaged, so the pane and the preferences dialog get a resolvable answer. The test-manifest banner no longer fires, since managed mode reads no manifest. Addresses #18443
ui/checkForUpdates fetches nothing itself -- it is a thin trigger for the frontend command flow -- so the manifest gate does not cover it. Drop the capability from the handshake response so Posit Assistant hides its own update entry through the negotiation that already exists, and refuse the request as "method not found" if a peer sends it anyway. The capability list is filtered where the handshake response is built: rstudioCapabilities() returns a reference to a function-local static and so cannot vary by mode. Addresses #18443
chat_install_update delivers its refusal wording via client_info, but PositAiInstallManager.installUpdate() reported error.getMessage(), so the user saw a generic execution error instead. Extract the client_info string first, as the uninstall path already did, and share that extraction between the two. Addresses #18443
The client learns the mode two ways: sessionInfo tells it up front, for the commands and the preferences layout, and chat_check_for_updates reports it per check, for the pane. - PositAiInstallManager.dispatchUpdateCheck() gains an onInstallationManaged outcome. It ranks below the blocking outcomes -- an administrator copy with a mismatched protocol has a more specific message -- and above the install and update ones, which managed mode can never act on. The flag is read with the file's optional-field convention, so an older rsession that omits it degrades rather than reporting a malformed response. - The chat pane starts the backend normally when the administrator's copy resolves, and otherwise says Posit Assistant is managed and not installed, with no install button. - Check for Posit Assistant Updates and Uninstall Posit Assistant are hidden. Uninstall is otherwise always available so a leftover copy can be removed; in managed mode that copy is ignored anyway. - The preferences pane replaces the update-check interval with an administrator notice, stops offering the Install button, and reports the mode rather than prompting for an install the backend would refuse. Addresses #18443
The handshake filter was an inline loop in handleGetProtocolVersion, which needs the process plumbing to reach. Move it to chat::constants::negotiatedCapabilities(bool), so the rule -- withhold ui/checkForUpdates in managed mode, advertise everything else unchanged -- is covered directly. Addresses #18443
The pane's new "installation-managed" state is exposed through window.rstudio.chat like every other one, so list it in the ChatPresenter doc comment and in the ChatBridge union the Playwright helpers type against. Addresses #18443
A session that predates posit_assistant_installation_enabled sends no such field, and the JSNI accessor read that as false -- reporting installation as administrator-managed, hiding the install and uninstall commands, and refusing installs the session would in fact have permitted. Read an absent field as allowed instead, matching the option's default and the way PositAiInstallManager already treats fields an older rsession may omit. Addresses #18443
rserver builds each session's environment from scratch rather than passing its own down: an rserver started with RSTUDIO_DISABLE_POSIT_ASSISTANT_- INSTALLATION set launches an rsession without it. Server administrators use the allow-posit-assistant-installation option in rsession.conf, so say that rather than claiming a Server surface the variable does not have. Addresses #18443
isPositAssistantInstallationEnabledByAdmin() is the entry point for every gate in this change and the only surface a Desktop administrator has, but nothing exercised it: the resolution tests take the flag as an argument by design. A misspelled variable name would have gone unnoticed. Addresses #18443
Timestamped scratch output from a browser session used while verifying this change; it was swept in by a wildcard add and does not belong in the tree.
The guard inferred "was unset" from an empty value, so a variable that was set to the empty string would have been unset on scope exit. Track presence with the two-argument core::system::getenv() instead. Addresses #18443
Open-source builds define allowOverlay() as unconditionally true, and every allow-* accessor is "value || allowOverlay()", so allow-posit-assistant-installation is force-allowed there. The option takes effect in Posit Workbench, which is also where the profiles key that drives it lands. Addresses #18443
The allow-* family generates "value || allowOverlay()", and open-source builds define allowOverlay() as unconditionally true, so allow-posit-assistant-installation was force-allowed everywhere except Posit Workbench. This setting has to work in open-source RStudio Server. Rename it to posit-assistant-installation-enabled and move it to the pai group, beside posit-assistant-enabled -- which is the option in that pair that is honored everywhere, for the same reason. The accessor loses the allowOverlay() term and the option now takes effect wherever rsession.conf is read. The environment variable is unchanged and remains the Desktop surface: rserver builds each session's environment from scratch, so it does not reach a server session. Addresses #18443
The "installation not found" error named the XDG user data directory as a place to install to. In managed mode that is the one location the session ignores and refuses to install into, so name only the administrator's location there. Addresses #18443
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 18:28 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 18:28 — with
GitHub Actions
Inactive
The managed-mode guard in showInstallUpdatePrompt() reused the "Not Installed" wording, but it is reachable only from onCheckFailed -- the dispatcher routes managed sessions to onInstallationManaged before any prompting outcome, and the unsupported-version prompt needs an update to offer, which managed mode never has. On that path the RPC failed, so whether the administrator's copy resolves is unknown: a managed session with a working install would have been told it was not installed. Use wording that states the mode without asserting install state. The original pair stays in use in onInstallationManaged(false), where the installation is known to be absent. Addresses #18443
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 18:38 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 18:38 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 19:44 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 19:44 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 19:48 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 19:48 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 19:51 — with
GitHub Actions
Inactive
gtritchie
had a problem deploying
to
e2e-playwright
August 30, 2026 19:51 — with
GitHub Actions
Failure
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 20:07 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 20:07 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 20:07 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 20:07 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 20:07 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
August 30, 2026 20:07 — with
GitHub Actions
Inactive
RStudio E2E - all platforms1 test(s) failed
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 was referenced Sep 15, 2026
This branch was previously deployed
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 an administrator setting that turns off user-managed installation of Posit Assistant. Default is today's behavior. When disabled, the session uses only an administrator-managed or bundled installation, ignores any user-level copy, makes no manifest requests, refuses the install/update/uninstall RPCs, and hides the corresponding UI.
Two surfaces:
posit-assistant-installation-enabledinrsession.conf(default1), in thepaigroup besideposit-assistant-enabled. Honored everywherersession.confis read, including open-source RStudio Server.RSTUDIO_DISABLE_POSIT_ASSISTANT_INSTALLATION(non-empty = disabled), mirroringRSTUDIO_DISABLE_POSIT_ASSISTANT. Desktop only, sincerserverbuilds each session's environment from scratch rather than passing its own down.Both are read by one helper,
module_context::isPositAssistantInstallationEnabledByAdmin(), so no gate hand-syncs the logic.Not an
allow-*optionThe issue specified
allow-posit-assistant-installationin theallowgroup. That turned out to be wrong:generate-options.Remitsvalue || allowOverlay()for every bool in that group, and open-source builds defineallowOverlay()as unconditionallytrue, so the option would have been force-allowed everywhere except Posit Workbench. It has to work in open-source Server, so it is a regular option in thepaigroup instead — the same reasonposit-assistant-enabledlives there rather than besideallow-posit-assistant.RSTUDIO_POSIT_AI_PATHis the other half of that story: as a plain environment variable any user could set in.Renviron, it would have made the setting decorative.Session side
locatePositAssistantInstallation()— the single point both the chat backend and the NES agent go through. A leftover user copy is ignored, never removed, and logged once per session because it silently changes which version runs.chat_install_updateandchat_uninstall_posit_assistantrefuse, with the reason inclient_info. The uninstall gate sits ahead of the on-disk checks, since a leftover copy may exist.shouldFetchManifest()returns false in managed mode, ahead of the throttle and ahead offorce. That covers all three callers ofstartUpdateCheck()and routes them throughresolveWithoutManifestFetch(), so the client still learns installed/not-installed.fetchManifestAsync()has exactly one call site, behind that gate, and thecdn.posit.coURLs appear only inside it.resolveWithoutManifestFetch()previously assumed its throttled-skip caller's precondition (a compatible version is installed). Managed mode reaches it with whatever the administrator provides, so it now recomputes the protocol mismatch and normalizes a missing install to0.0.0. An administrator copy with a missing or mismatchedprotocol.jsonreports as unsupported — correct, since no update can be offered that would fix it.ui/checkForUpdatesfetches nothing itself, so it is suppressed separately: the capability is withheld from the handshake (so Posit Assistant hides its own update entry through the negotiation that already exists) and the request is refused as method-not-found if sent anyway.chat_check_for_updateskeeps succeeding and reportsinstallationManaged.sessionInfocarriesposit_assistant_installation_enabled.RSTUDIO_POSIT_AI_PATHis removedIt was a development-only override: undocumented, unused by the e2e suite, and the bypass described above. It was also the resolver's only injection seam, so it is replaced by an
InstallSearchPathsstruct passed to an overload oflocatePositAssistantInstallation(), following thebundledPositAssistantInstallPath(resourcePath)precedent. The search-order tests now assert the tiers directly instead of hedging on whatever is installed on the machine running them. Developers testing a local build install it into the XDG user data directory or pointposit-assistant-pathat it.The unreleased 2026.09 entry for #18597 advertised the variable; it is reworded to keep only the system-wide-installation half. The rstudio-pro NEWS entry still advertises it and needs the same edit.
Client side
PositAiInstallManager.dispatchUpdateCheck()gains anonInstallationManaged(boolean installed)outcome, ranked below the blocking outcomes (an administrator copy with a mismatched protocol has a more specific message) and above the install and update ones. The flag is read with the file's optional-field convention, so an older rsession that omits it degrades rather than reporting a malformed response.installation-managed.AssistantPreferencesPanereplaces the update-check interval with an administrator notice, stops offering the Install button, and reports the mode rather than prompting for an install the backend would refuse.Decisions on the issue's open questions
RSTUDIO_CONFIG_DIR/XDG_CONFIG_DIRSbypass: out of scope. Policy comes fromrsession.conf, which users cannot edit; a user who can redefine the system config dir can already redefine much more.posit-assistant-pathis set but invalid".Verification
Exercised end to end against a dev server, with
pai/manifest-check.jsonremoved before each run so the throttle could not skip the check:posit-assistant-installation-enabled~/.local/share/rstudio/pai/bin1manifest-check.jsonrewritten0cdn.posit.coreferences in the session logThat A/B fails if the option ever regains an
allowOverlay()term, which no unit test can catch:session::options()is a process-global populated by program-options parsing, and with the overlay restored a purecomposition(option, env)helper would still be handedtrue.Automated: full backend build clean;
rstudio-tests --scope rsession538 passed;ant javac,ant unittest581 passed;npm run typecheckine2e/rstudioclean. New tests cover the search-order tiers with and without the gate (ChatInstallationTests), the environment-variable half of the gate (SessionModuleContextTests), capability negotiation (ChatConstantsTests), and the managed dispatcher outcome with both precedence directions and the absent-flag default (PositAiInstallManagerTests).ProcessTest.MultipleAsyncProcessesResultsfails in thecorescope, on this machine, before and after: it spawns 1000 concurrent processes and no file undersrc/cpp/coreis touched here.Notes
Rscript scripts/generate-options.RregeneratesSessionOptions.gen.hpp; thersession_conf.qmdhalf is a no-op in this repo (outputDocFileis/dev/null— the qmd lives in the docs repo).rserverdoes not pass its environment to sessions, the existingRSTUDIO_DISABLE_POSIT_ASSISTANTrow inenvironment-variables.qmdclaiming "Desktop, Server" looks wrong for open-source Server too. The new row is scoped to Desktop.assistant-installation-enabledtranslating to--posit-assistant-installation-enabled 0|1(rstudio-pro#12483), and the versioned side-by-side install store (Install Posit Assistant side-by-side in versioned directories #18658), whose resolution carries this rule over unchanged.Addresses #18443.