Skip to content

Posit Assistant discovery should pick the highest version, and prefer bundled/admin installs when user installs are disabled #18774

Description

@gtritchie

Summary

locatePositAssistantInstallation() currently returns the first installation it finds in a fixed tier order rather than the best one. That produces two surprising outcomes:

  1. A stale per-user install permanently shadows a newer bundled (or admin-managed) install. A user who installed Posit Assistant before bundling existed keeps getting the old version indefinitely, even after upgrading RStudio — and "Help > Diagnostics > Uninstall Posit Assistant" is the only way out.
  2. When user-managed installs are disabled, the bundled install is only used if the admin also sets the assistant path option, so admins have to do extra configuration to get a working assistant.

Current behavior

Search order in src/cpp/session/modules/chat/ChatInstallation.cpp:96-161:

  1. Per-user install (~/.local/share/rstudio/pai/bin) — only when user installs are enabled (src/cpp/session/modules/chat/ChatInstallation.cpp:100-107)
  2. System/admin install — from posit-assistant-path, else XDG config dir (src/cpp/session/modules/chat/ChatInstallation.cpp:119-123)
  3. Bundled copy — skipped entirely when posit-assistant-path is set (src/cpp/session/modules/chat/ChatInstallation.cpp:139-145)

Tiers and flags are assembled in positAssistantSearchPaths() (src/cpp/session/modules/chat/ChatInstallation.cpp:86-93); the admin gate is isPositAssistantInstallationEnabledByAdmin() (src/cpp/session/SessionModuleContext.cpp:1609-1613).

Requested behavior

When user-managed installs are enabled (default): choose max_version(bundled, admin-installed, per-user) instead of unconditionally preferring the per-user install. This mirrors how out-of-band Positron upgrades are resolved on the Workbench side (max_version(bundled, manually installed)), and means a per-user install only wins while it is actually newer.

When user-managed installs are disabled: fall back to admin-installed || bundled rather than admin-installed || nothing. Today an admin locking down installs must also point the assistant path option at the bundled directory to get a usable assistant, which is easy to miss. Admins who genuinely want no assistant at all already have the separate assistant-enabled option for that.

Notes

• Mostly a Workbench/Pro scenario, but the locating and loading code is here in the open-source codebase, so the fix belongs here.
• Requires a version comparison across install tiers; related to #16888 (assistant doesn't know its own version) and #18658 (side-by-side versioned install directories), which may make the comparison cheaper/cleaner.• Also related: #18443 (setting to disable user-managed installs) and #18687 (admin-configurable installation path), which introduced the tiers this issue refines.

See Also

Two existing issues worth a look before implementing: #18658 (side-by-side versioned install dirs) and #16888 (assistant doesn't know its own version — a prerequisite for version comparison).

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions