Skip to content

Locate a Posit Assistant copy bundled with RStudio - #18690

Merged
gtritchie merged 3 commits into
mainfrom
feature/bundled-posit-assistant
Aug 30, 2026
Merged

gtritchie merged 3 commits into
mainfrom
feature/bundled-posit-assistant

Conversation

@gtritchie

Copy link
Copy Markdown
Member

Open-source companion to rstudio/rstudio-pro#12483, which bundles Posit Assistant with Workbench. The runtime lookup lives here so the diff between the two repos stays limited to the install rule; open-source builds ship no bundle, the directory never exists, and the search falls through as before.

installation::bundledPositAssistantInstallPath() resolves options().resourcePath()/bin/posit-assistant when it holds a valid installation, and options().resourcePath()/posit-assistant otherwise -- the macOS app-bundle layout, where the directory sits beside bin rather than inside it. That mirrors the Copilot Language Server rule in src/cpp/session/CMakeLists.txt, which is where the pro-side install(DIRECTORY ...) lands. There is no new session option: posit-assistant-path remains the single administrator override, for both the system-wide and the bundled location.

Search order:

1. RSTUDIO_POSIT_AI_PATH                  (development and testing)
2. XDG user data dir  (pai/bin)           (manifest-installed, per user)
3. posit-assistant-path set -> use it; if invalid, warn and stop
   not set                 -> XDG system config dir, then bundled

Bundled ranks last. A manifest-installed update lands in the user data directory and an administrator's own install is deliberate, so both outrank the copy that shipped with RStudio. posit-assistant-path skips the bundled copy entirely: a pinned path that turns out to be invalid already ends the search rather than reverting to the XDG system location, and answering a typo or an unmounted share with the shipped version would be the same silent downgrade.

The uninstall refusal now resolves the installation instead of re-testing the system location, so it reports the copy actually in use and has wording of its own for the bundled case. The lock-skip check at startChatBackend is unchanged: a bundled install over-locks the way the env-var and posit-assistant-path overrides already do.

Testing

Unit tests cover the bin-then-root candidate rule, including a partial directory beside the session binary falling through to a usable bundle at the resource root. The search order itself is not unit-testable -- the generated Options class exposes only CLI parsing, with no setter a test could drive, the same limitation noted in #18688. Both branches were instead verified against the real rsession binary with a throwaway probe: with a staged bundle and no user install, the search resolved to <resourcePath>/posit-assistant; with --posit-assistant-path=/nonexistent/pinned, it returned empty and logged the warn-once message, leaving the staged bundle unused.

To exercise it in a development build, options().resourcePath() resolves to build/src/cpp, so stage an unpacked package at build/src/cpp/posit-assistant and point XDG_DATA_HOME at an empty directory so a per-user install does not shadow it.

No NEWS entry: this is the open-source companion to a pro change and has no effect in an open-source build.

Commercial builds will ship Posit Assistant alongside the session binary,
in ${RSTUDIO_INSTALL_BIN}/posit-assistant (or beside bin/ in the macOS app
bundle, mirroring the Copilot Language Server rule). This adds the runtime
half of that lookup so the diff against rstudio-pro stays limited to the
install rule itself; open-source builds ship no bundle, so the new location
never exists and the search falls through as before.

The bundled copy ranks last. A manifest-installed update lands in the user
data directory and an administrator's own install is deliberate, so both
outrank whatever version shipped with RStudio. posit-assistant-path skips
the bundled copy entirely: a pinned path that holds no installation already
ends the search rather than falling back to the XDG system location, and
answering a typo or an unmounted share with the shipped version would be
the same silent downgrade.

The uninstall refusal now resolves the installation instead of re-testing
the system location, so it reports the copy actually in use and can tell
the bundled case apart from an administrator's install. The lock-skip check
at startChatBackend is unchanged: a bundled install over-locks the way the
env-var and posit-assistant-path overrides already do.

No NEWS entry: this is the open-source companion to the rstudio-pro
bundling change and has no effect in an open-source build.
bundledPositAssistantInstallPath() chose the directory beside the session
binary on existence alone, so a partial directory there — a half-removed
bundle from an earlier layout, say — masked a usable bundle at the resource
root and reported Posit Assistant as not installed. Verify that candidate
instead, which also makes the header's claim that both locations are
checked true.
The "no valid installation" log called bundledPositAssistantInstallPath()
a second time, re-verifying the bin candidate. DLOG formats its arguments
before the logger applies level filtering, so the extra stat calls were
paid on every status, verify, and chat request even with debug logging
off. Reuse the path resolved a few lines above instead.
@github-actions

github-actions Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
2531 0 184 4
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
✅ desktop-linux 634 0 38 1
✅ desktop-macos 639 0 33 2
✅ desktop-windows 639 0 39 1
✅ server-linux 589 0 44 0
✅ 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 05b28e6208439dcdcc3bdc4b4745ac673b3865d4 - Run #759

@gtritchie
gtritchie merged commit 60372b0 into main Aug 30, 2026
51 of 52 checks passed
@gtritchie
gtritchie deleted the feature/bundled-posit-assistant branch August 30, 2026 02:23

This branch was previously deployed

1 inactive deployment
e2e-playwright — 05b28e62 Deployed Aug 30, 2026 by gtritchie via macos / e2e-desktop-macos (1) #759
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