Skip to content

Read admin Posit Assistant versions beside the bundled copy - #18998

Merged
gtritchie merged 7 commits into
mainfrom
feature/posit-assistant-bundled-versions
Sep 30, 2026
Merged

gtritchie merged 7 commits into
mainfrom
feature/posit-assistant-bundled-versions

Conversation

@gtritchie

@gtritchie gtritchie commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Addresses #18973.

Administrator-installed Posit Assistant versions now live in the directory that holds the copy bundled with Workbench, <resource>/bin/posit-assistant (/usr/lib/rstudio-server/bin/posit-assistant on Linux), in the same layout as a user's own pai directory. The posit-assistant-path session option is no longer used.

Layout

/usr/lib/rstudio-server/bin/posit-assistant/
  dist/  package.json  protocol.json   <- bundled copy, where Workbench installs it today
  versions/<slot>/                      <- administrator-installed versions
  selected.json                         <- {"selected": {"<protocol>": "<slot>"}}
  • The bundled copy stays at the directory's root, so rstudio-pro's install rule does not change.
  • versions/ and selected.json are read through the existing slot and selector code (ChatSlots, ChatSelector). selected.json is optional. A missing or stale entry falls back to the newest verifying slot for this protocol. RStudio never writes anything in this directory.
  • The package owns neither versions/ nor selected.json, so Linux package upgrades leave them in place.

Resolution

Three candidates compete under the existing ranking: matching protocol first, then newest version.

  1. The user's selected slot, when user installation is enabled.
  2. The administrator's selected slot.
  3. The bundled copy.

Ties keep that order. A selection older than the bundled copy or the user's slot loses to them, so selected.json chooses among the administrator's versions but cannot hold users below a newer Workbench bundle. posit-assistant-installation-enabled=0 removes the user's slot from the competition, as before.

userInstallWouldBeSelected() ranks an offered version against the administrator's slot and the bundled copy. runsUserSlot() is unchanged in behavior.

posit-assistant-path

The option shipped in 2026.09.0, and rsession rejects an rsession.conf that contains an unknown key. So the option stays registered as a hidden, deprecated option (deprecatedPositAssistantPath_, following external-copilot-agent-path). Sessions ignore it, and log one warning naming the versions/ directory. Because that warning only reaches each user's session log, rserver also scans the rsession.conf sessions use (the rsession-config-file override, or the standard XDG lookup) at startup, and logs a warning when the option is set to a non-empty value. Commented-out lines are skipped. SessionOptions.gen.hpp is regenerated. Because hidden options are not documented, regenerating the rstudio-pro rsession.conf reference removes the entry.

Other changes

  • bundledPositAssistantInstallPath() is replaced by systemStorageDir(), which returns <resource>/bin/posit-assistant. The macOS app-bundle fallback is removed: only Workbench on Linux ships a bundled copy.
  • InstallSearchPaths::adminDir and bundledPath are replaced by systemStorageDir. kBundledPositAiDirName becomes kSystemPositAiDirName.
  • In managed mode, the "installation not found" message names the versions/ directory. Otherwise it points the user at the Posit Assistant pane.
  • runsUserSlot() reads the user's storage directory directly instead of building the full search paths while holding the resolution lock.
  • A -Wdangling-else warning in ChatConstantsTests.cpp is fixed.

Tests

ChatInstallationTests.cpp is rewritten against the new layout. It covers:

  • the three sources competing, and tie order;
  • the administrator's selector: followed; not holding back a newer bundled copy; resolved around when stale; never rewritten or created;
  • administrator slots for another protocol;
  • installations outside versions/ not being read;
  • the bundled copy and administrator slots sharing the directory;
  • managed mode;
  • userInstallWouldBeSelected() against an administrator slot.

ChatStaticFilesTests.cpp serves through the bundled copy.

GTEST_FILTER='Chat*' ./build/src/cpp/rstudio-tests --scope rsession

All 239 tests pass. An rsession.conf that sets posit-assistant-path still parses, and one with an unknown key is still rejected, checked against the built rsession.

NEWS

The two unreleased #18973 entries are rewritten: one under New for the location and ranking, one under Deprecated / Removed for posit-assistant-path and /etc/rstudio/pai.

Related

  • rstudio/rstudio-pro#12981 tracks the admin guide updates.
  • An rstudio-server upgrade subcommand that installs versions into this layout is planned as a separate rstudio-pro change.

The session now reads administrator-installed Posit Assistant versions
from the posit-assistant directory beside the session binary, in the
same layout as the user's own storage: slots under versions/, selected
per protocol by selected.json, which RStudio never writes. The bundled
copy moves under bundled/ in that directory.

The selected administrator slot, the bundled copy and the user's slot
compete as before: compatible protocol first, then newest version, ties
going to the user's slot, then the administrator's.

posit-assistant-path shipped in 2026.09.0, so it stays registered as a
hidden, deprecated option that is ignored with a warning; removing it
would make rsession reject any rsession.conf that still sets it.

Addresses #18973
The bundled copy stays where Workbench installs it today, at
bin/posit-assistant itself, and the administrator's versions/ and
selected.json live inside it. The package owns neither, so an upgrade
leaves them in place, and rstudio-pro's install layout is unchanged.

bin/posit-assistant is preferred over the macOS location only when it
holds a bundled copy or a versions/ directory, so a stray directory
there no longer masks a usable one.

Addresses #18973
bin/posit-assistant is the default. The location beside bin/ is used
only when bin holds neither a bundled copy nor an administrator's slot
for this protocol and it does, so an empty versions/ directory there no
longer masks a usable copy.

Addresses #18973
The macOS app-bundle fallback copied the Copilot Language Server rule,
but only Workbench on Linux ships a bundled Posit Assistant, so
systemStorageDir() is now <resource>/bin/posit-assistant with no
probing. That also removes the extra slot scans and log lines the probe
added to every positAssistantSearchPaths() call.

runsUserSlot() reads the user's storage directory directly instead of
building the full search paths while holding the resolution lock.

The managed-mode not-found message names the versions/ directory an
administrator installs into, and NEWS and the header no longer claim
more than the code does.

Addresses #18973
@gtritchie gtritchie added this to the 2026.10 (Blue Mistflower) milestone Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
3363 0 200 3
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
✅ desktop-linux 847 0 39 0
✅ desktop-macos 843 0 43 1
✅ desktop-windows 847 0 44 1
✅ server-linux 796 0 44 1
✅ setup 28 0 20 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 c065b7bca86577d96c1235b6f77258ae8faad483 - Run #1297

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor findings are open; nothing is blocking.

Open

  1. The posit-assistant-path deprecation warning only reaches per-user session logs. (ChatInstallation.cpp:156) The RS_ONCE WLOG in positAssistantSearchPaths() fires in each user's rsession log when Posit Assistant first resolves an installation. An administrator who set the option in 2026.09.0 sees sessions switch to the bundled copy with nothing in rserver's log. A warning at rserver startup, when rsession.conf sets the key, would reach them.

  2. No test covers the deprecated option or the new managed-mode message. (ChatInstallation.cpp:156, SessionChat.cpp:5085) No test sets posit-assistant-path and checks that resolution ignores it and warns once. installationNotFoundMessage()'s managed branch changed its wording and the path it names, also without coverage. A regression that re-reads the option or drops the warning would pass.

Withdrawn

  • Removed macOS <resource>/posit-assistant fallback (ChatInstallation.cpp:138). Desktop builds don't bundle Posit Assistant, and RStudio Server ships only for Linux, so no build uses that layout.
  • Desktop reads the system directory, and the managed-mode message points inside the app bundle (SessionChat.cpp:5085). Withdrawn for the same reason.
  • Launcher session containers don't see versions installed on the Workbench host (ChatInstallation.cpp:138). make-session-package copies bin/posit-assistant into the session tarball, so containerized sessions resolve the image's copy. Session images get a different approach, tracked in rstudio/rstudio-pro#13006, so this is out of scope here.
  • selected.json can't pin a version below the bundled copy or the user's install (ChatInstallation.cpp:238). Intended: customers run at least the version bundled with their Workbench release, and a problem in a bundled version is fixed by an urgent Workbench patch with an updated bundle.

Sessions ignore the option and warn only in each user's session log, so
an administrator who set it in 2026.09.0 saw sessions switch copies with
nothing in the server log. rserver now scans the rsession.conf sessions
use at startup and warns when the option is set, naming the versions/
directory to install into instead.

Addresses #18973
@gtritchie

Copy link
Copy Markdown
Member Author

Responding to the review:

  1. Deprecation warning only reaches per-user session logs: fixed in c065b7b. At startup, rserver now scans the rsession.conf that sessions use (the rsession-config-file override, or the standard XDG lookup) and logs a warning when posit-assistant-path is set to a non-empty value. The warning names the versions/ directory to install into and says to remove the option. It uses the same path as rserver's existing deprecation warnings, so it goes to the rserver log, or to stderr when run from a terminal. Commented-out lines, empty values and similarly named keys don't trigger it. I checked this with rserver --check-config against sample rsession.conf files. The per-session warning is unchanged.
  2. No test covers the deprecated option or the managed-mode message: intentionally not addressed in this PR.

@gtritchie
gtritchie merged commit 1bdc9a9 into main Sep 30, 2026
34 checks passed
@gtritchie
gtritchie deleted the feature/posit-assistant-bundled-versions branch September 30, 2026 18:26
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.

1 participant