Repository navigation
Description
Current behavior
A session looks for an administrator-provided Posit Assistant in two ways, and neither is what administrators need:
- An implicit default location.
<systemConfigDir>/pai(/etc/rstudio/paion Linux,C:/ProgramData/rstudio/paion Windows) is always searched. Since Resolve Posit Assistant from versioned install slots #18892 that means itsversions/slots throughselected.jsonand its legacy unversionedbin/, on Server and Desktop alike. Whatever is there competes by version (Posit Assistant discovery should pick the highest version, and prefer bundled/admin installs when user installs are disabled #18774) with the user's own copy and the bundled copy, even though no administrator ever configured it. posit-assistant-pathinrsession.conf(Allow administrators to configure the Posit Assistant installation path #18687, shipped in 2026.09). It pins one unversioned installation directory. It cannot use theversions/+selected.jsonlayout, so an administrator who configures it gives up side-by-side installs and choosing a version.
Relevant code, all in src/cpp/session/modules/chat/ unless noted:
ChatInstallation.hpp:InstallSearchPaths(systemStorageDir,pinnedPath), plus the doc comments onInstallSearchPathsandlocatePositAssistantInstallation(const InstallSearchPaths&).ChatInstallation.cpp:positAssistantSearchPaths(),systemSlot(),legacySystemInstall(),rankedCandidates(),locatePositAssistantInstallation(const InstallSearchPaths&),userInstallWouldBeSelected(const InstallSearchPaths&, ...).src/cpp/session/modules/SessionChat.cpp: the "installation not found" messages, which name<systemConfigDir>/pai/binor the pinned path.src/cpp/session/session-options.json: theposit-assistant-pathdescription.src/cpp/session/include/session/SessionModuleContext.hpp: the comment onisPositAssistantInstallationEnabledByAdmin().
Expected behavior
An administrator-provided installation exists only when an administrator configures one with posit-assistant-path. When they do, it always runs.
When posit-assistant-path is unset
<systemConfigDir>/pai is not read at all: not its versions/, selected.json, or bin/. The only sources are:
- the user's slots (
<userDataDir>/pai/versionsvia<userDataDir>/pai/selected.json), skipped when user installation is disabled (posit-assistant-installation-enabled=0/RSTUDIO_DISABLE_POSIT_ASSISTANT_INSTALLATION); - the bundled copy (only Workbench ships one; open-source Server, Desktop and Desktop Pro do not).
They compete under the existing #18774 rules: a compatible protocol first, then the highest version, with ties going to the user's copy.
Desktop doesn't read rsession.conf, so on Desktop the option is never set, and there is no bundled copy there. Desktop therefore runs only the user's own copy. That needs no Desktop-specific code; it follows from the rules above.
When posit-assistant-path is set to a directory P
P supplies the administrator's candidates:
- Slots:
P/versions/<slot>, resolved withselector::resolveSlot(P, kProtocolVersion, SelectorRepair::Disabled). The slot named byP/selected.jsonis used when it verifies. Otherwise the newest verifying slot for this protocol is used, andP/selected.jsonis never written. Pitself as a single installation directory (the directory containingdist, checked withverifyInstallDir()). This keeps 2026.09 configurations working.P/binis not read.
If both exist, they compete with each other under the #18774 rules (compatible protocol, then version; ties go to the slot).
If P contributes a candidate, the best one runs. Nothing else is considered. It beats the user's copy and the bundled copy whatever their versions, which lets an administrator hold users on a version older than the bundled one. The user's copy is ignored (not removed) even when user installation is enabled; keep the existing once-per-session warning when one exists. If the administrator's copy declares a different protocol, it still runs, and the session reports the protocol mismatch as it does for any incompatible install. It does not fall back to another copy.
When P holds no valid installation
P holds no valid installation when it contributes no candidate: it doesn't exist, is empty, or contains neither a verifying slot for this build's protocol nor a directory that passes verifyInstallDir(). (An empty option value means the option is unset.)
- The bundled copy is not considered. A typo or an unmounted share must not quietly run whatever version shipped with Workbench.
- The user's slot is still used when user installation is enabled (as
UsesUserSlotWhenPinnedPathIsInvalidasserts today): the user's own install is not a silent downgrade. - Log a warning once per session naming
P. - Otherwise Posit Assistant is reported as not installed.
Update and reinstall offers
userInstallWouldBeSelected() returns false whenever P contributes a candidate (the user's install could never run). When P is invalid, it is true if user installation is enabled. When P is unset, the user's install competes against the bundled copy as today.
"Installation not found" messages (SessionChat.cpp)
These can no longer point at <systemConfigDir>/pai/bin:
Pset: namePas the expected location, in both the managed and the unmanaged message.Punset, installation managed: say installation is managed by the administrator and none has been configured. Don't name a path.Punset, installation enabled: tell the user to install it from the Posit Assistant pane. Drop the "or have an administrator install it at …" clause.
Compatibility
This drops the default location that 2026.09 and earlier read. Both of these need a NEWS entry:
- Server administrators who populated
/etc/rstudio/pai/binmust setposit-assistant-path=/etc/rstudio/pai/bin, which is the unversioned-directory form. Pointing it at/etc/rstudio/paireads slots under/etc/rstudio/pai/versionsinstead. - Desktop no longer reads an administrator-provided copy from
<systemConfigDir>/pai. Users install their own.
Implementation notes
- Replace
InstallSearchPaths::systemStorageDirandpinnedPathwith a single administrator directory (P, empty when unset). Don't keep the old fields alongside it.systemSlot()andlegacySystemInstall()become the slot and unversioned lookups againstP. rankedCandidates()/locatePositAssistantInstallation(): whenPis set, return the best ofP's candidates, or fall through to the user slot alone. When it is unset, rank the user slot against the bundled copy. Update the "No valid AI installation found" debug listing to match.- Remove anything left unused. For example, check whether
kLegacyInstallDirNameis still needed outside the test that asserts the user's legacypai/binis never read. - Rewrite the doc comments on
InstallSearchPaths,locatePositAssistantInstallation(),rankedCandidates(), andisPositAssistantInstallationEnabledByAdmin()(which says a disabled install uses "only an administrator-managed installation"; it can also be the bundled copy). session-options.json: rewrite theposit-assistant-pathdescription. It is the directory holding the administrator-provided Posit Assistant, either versioned installs underversionsselected byselected.json, or a single installation directory (the one containingdist). When it holds a valid installation, that installation is always used. RegenerateSessionOptions.gen.hpp.
Tests
ChatInstallationTests.cpp has many tests that stage installations in systemStorageDir or legacySystemDir(), or set pinnedPath. Each needs rewriting against P, or deleting where it covers behavior that no longer exists (a default-location copy competing by version):
FallsBackToSystemSlot, FallsBackToLegacySystemInstallation, FollowsTheSystemSelector, ResolvesAroundAStaleSystemSelectorWithoutRewritingIt, PrefersNewerSystemSlotOverStaleUserSlot, PrefersNewerLegacySystemOverStaleUserSlot, PrefersNewestInstallation, PrefersCompatibleProtocolOverHigherVersion, FallsBackToHighestVersionWhenNoneIsCompatible, TreatsMissingProtocolFileAsIncompatible, RanksVersionlessInstallationLowest, BreaksVersionTiesBySource, SkipsUserSlotsWhenInstallsAreManaged, PinnedInstallationWinsOverNewerUserSlot, UsesUserSlotWhenPinnedPathIsInvalid, SkipsReadOnlySourcesWhenSystemPathIsPinned, FindsPinnedInstallationWhenInstallsAreManaged, UserInstallWouldBeSelectedOverVersionlessReadOnlyInstall, UserInstallWouldNotBeSelectedBelowNewerSystemSlot, UserInstallWouldNotBeSelectedUnderValidPinnedPath, ChatInstallation.BundledPathSkipsIncompleteBinSubdirectory, ChatInstallationHeld.DoesNotRunUserSlotForReadOnlyCopies, ChatInstallationHeld.ReportsNothingForALegacyInstallWithoutProtocol.
ChatStaticFilesTests.cpp sets pinnedPath to serve one installation (ChatStaticFilesResolution::serve() and ServesFromTheHeldInstallationUntilItIsCleared). Switch these to P as an unversioned directory.
Cases the suite must cover:
Punset: copies at the default<systemConfigDir>/pai(slots andbin/) are never used, even when nothing else exists; the user slot and the bundled copy compete by version, with ties going to the user.- A slot under
Pselected byP/selected.jsonresolves; a stale or unusable selection falls back to the newest verifying slot without rewritingP/selected.json. Pitself as a 2026.09-style unversioned install resolves;P/binis not read.Pholding both a slot and an unversioned install: the higher compatible version wins, and on a tie the slot wins.- A valid
Pbeats a newer compatible bundled copy and a newer user slot, with user installation enabled or disabled. - A valid
Pwhose only candidate has a mismatched protocol still runs rather than falling back. Pnonexistent, empty, or holding only slots for another protocol: bundled is not used; the user slot is used when enabled; nothing resolves when user installation is disabled.userInstallWouldBeSelected(): false under a validPregardless of version; true whenPis invalid and installation is enabled; false when installation is disabled; ranked against bundled whenPis unset.
Docs
NEWS.md, 2026.10 section: add an entry for this change, including the two compatibility points above. Also revise the unreleased entries it contradicts. The Install Posit Assistant side-by-side in versioned directories #18658 entry says "An administrator can provide the same layout under the system configuration directory", and the Posit Assistant discovery should pick the highest version, and prefer bundled/admin installs when user installs are disabled #18774 entry lists "installed system-wide" among the competing copies and says a per-user copy "no longer shadows a newer bundled or system-wide copy".- The Workbench administrator documentation is maintained separately and will be updated to match.
Verification
Build, then run the chat unit tests, for example as #18892 did:
GTEST_FILTER='Chat*' ./build/src/cpp/rstudio-tests --scope rsession
Activity
[-]posit-assistant-path should relocate the administrator's Posit Assistant slots, not pin one install[/-][+]Read administrator Posit Assistant installs only from posit-assistant-path, and let it win[/+]Move posit-assistant-path removal note to Deprecated / Removed
Read admin Posit Assistant installs only from posit-assistant-path (#…
Warn in the rserver log when rsession.conf sets posit-assistant-path
Read admin Posit Assistant versions beside the bundled copy (#18998)