Repository navigation
Description
Problem
There is no way for an administrator to take Posit Assistant installation away from
users. Every session with Posit Assistant selected schedules a manifest fetch from
https://cdn.posit.co/posit-ai/manifest.json one second after deferred init
(onDeferredInit in SessionChat.cpp), the user can trigger a check at any time from
the Help menu, and the assistant itself can request one over ui/checkForUpdates. In
centrally managed and air-gapped deployments that outbound traffic is unwanted.
It also leaves an administrator's install unable to stay authoritative. Installs always
land in the per-user XDG data directory, and that tier is searched ahead of the
administrator's, so a user who accepts a single update prompt permanently shadows the
copy named by posit-assistant-path (#18688), the copy in the XDG system config
directory, or the copy bundled with Workbench — with no signal to either party. This is
deliberate: the answer is this setting, not a reordering of the search.
Proposed change
An administrator setting that turns off user-managed installation of Posit Assistant.
Default: allowed, today's behavior. When disabled, the session:
- uses only the administrator-controlled installation —
posit-assistant-path, the XDG
system config directory, or the copy bundled with Workbench; - ignores any user-level copy, including one left over from before the setting changed
or hand-copied into place to get around it (ignored, never cleaned up); - performs no manifest fetches at all;
- refuses the install, update, and uninstall RPCs;
- hides "Check for Posit Assistant Updates" and "Uninstall Posit Assistant".
Two surfaces in this repo
-
rsession.conf—posit-assistant-installation-enabled, default1, in the
paigroup ofsrc/cpp/session/session-options.jsonnext to
posit-assistant-enabled.Not an
allow-*option.generate-options.Remitsvalue || allowOverlay()
for every bool in theallowgroup, and open-source builds defineallowOverlay()
as unconditionallytrue— so anallow-posit-assistant-installationwould have
been force-allowed everywhere except Workbench. This has to work in open-source
RStudio Server. That is the same reasonposit-assistant-enabledlives in thepai
group rather than besideallow-posit-assistant. (An earlier revision of this issue
specified theallowgroup; it was wrong.) -
Environment variable —
RSTUDIO_DISABLE_POSIT_ASSISTANT_INSTALLATION
(non-empty = disabled), mirroringRSTUDIO_DISABLE_POSIT_ASSISTANT. Desktop
only, and not by a code gate:rserverbuilds each session's environment from
scratch rather than passing its own down, so the variable does not reach a server
session. Documented as Desktop for that reason. It can only ever restrict, never
permit, so there is no bypass concern in letting the session read it unconditionally.
A third surface, /etc/rstudio/profiles key assistant-installation-enabled with
per-user/group scoping, is the Workbench admin surface and lands in rstudio-pro
(rstudio/rstudio-pro#12534): it is translated to
--posit-assistant-installation-enabled 0|1 at session launch and so needs nothing
further here. The name is deliberately editor-neutral so Positron can consume the same
key later.
One helper, not a hand-synced pair
isPositAssistantInstallationEnabledByAdmin() in SessionModuleContext, beside
isPositAssistantEnabledByAdmin():
return options().positAssistantInstallationEnabled() &&
core::system::getenv("RSTUDIO_DISABLE_POSIT_ASSISTANT_INSTALLATION").empty();Every gate below and client_init call this one helper. The existing Posit Assistant
gate hand-syncs its logic between SessionClientInit.cpp and
SessionModuleContext.cpp; the new flag must not repeat that.
Effect on the search order
1. XDG user data dir <- SKIPPED when installs are disabled
2. posit-assistant-path set -> use it; if invalid, warn and stop
not set -> XDG system config dir, then bundled
The RSTUDIO_POSIT_AI_PATH tier that sat ahead of these is removed outright;
see part (a) item 3.
The gate lives inside locatePositAssistantInstallation(), so both consumers — the
chat backend and the NES agent — honor it through the one resolution point, and the
rule ("skip user-writable tiers when installs are disabled") carries over unchanged to
the versioned store in #18658.
With the Workbench bundle in place, disabled mode always finds something: the
administrator's pinned install if present, else the shipped copy. Air-gapped sites work
with zero manifest traffic.
Part (a): session-side enforcement
Complete and correct on its own — the UI degrades to error dialogs from the gated RPCs
until (b).
-
The option, the env var, and the helper, as above.
-
Resolution skips the user tier, as above. A user-level copy that is present but
skipped is logged once per session, since it silently changes which version runs and
may be a downgrade. -
RSTUDIO_POSIT_AI_PATHis removed entirely — the tier-1 branch and its logging
inChatInstallation.cpp, the search-order comment inChatInstallation.hpp, and
the now-dead env-path refusal branch inchat_uninstall_posit_assistant(the
read-only-install refusal below it already covers every remaining case), plus the
stale references inSessionAssistant.cppandSessionAssistantTests.cpp. The
variable is a development-only override: it is undocumented, unused by the e2e
suite, and a plain environment variable any user can set in.Renviron, which would
make this setting decorative. Removing it both closes that bypass and drops a tier
from an already complex resolution scheme. Developers testing a local build install
it into the XDG user data directory or pointposit-assistant-pathat it. -
chat_install_updaterefuses, with aclient_infomessage the UI renders.
Today it gates only onisPositAssistantWanted(), which the user controls. -
chat_uninstall_posit_assistantrefuses likewise, and the gate sits ahead of
the on-disk checks: in managed mode a leftover user copy may well exist, and it is
ignored rather than removed. -
No manifest traffic — gate
shouldFetchManifest(), not the call sites. Every
fetch funnels throughstartUpdateCheck(), whose three callers areonDeferredInit,
chatCheckForUpdates, andchatInstallUpdate, and which already has the branch this
needs:if (!shouldFetchManifest(force)) { resolveWithoutManifestFetch(); return; }
Making
shouldFetchManifest()return false in managed mode covers all three call
sites and any future one, and routes them through the existing local-state path so
the client still learns installed/not-installed without touchingcdn.posit.co. The
managed gate must take precedence overforce, whichchatInstallUpdatepasses as
true. (There are no periodic checks to suppress — checks are startup plus
user- and assistant-initiated, with throttle state persisted inmanifest-check.json.)resolveWithoutManifestFetch()needs widening. Its comment says it is reached
only when a compatible version is installed, which is why it reapplies only
persisted blocks. Managed mode reaches it with whatever the administrator provides
— possibly nothing, possibly a protocol-mismatched copy — so it must recompute the
mismatch locally and normalize a missing install to"0.0.0". On the throttled path
the mismatch is false by construction, so nothing changes there. -
The assistant-initiated
ui/checkForUpdatesis suppressed separately, since it
fetches nothing:handleCheckForUpdatesis a thin trigger that fires client event
210 to run the frontend command flow. Gate it, and stop advertising the capability so
the assistant hides its own update entry — capability negotiation already exists, so
no assistant-side change is needed. Note thatrstudioCapabilities()in
ChatConstants.cppreturns a reference to a function-local static and so cannot vary
by mode as written; the filtering belongs in a small pure function beside it
(negotiatedCapabilities(bool)) rather than inline inSessionChat.cpp, so the rule
is testable. -
The update-check result carries the managed state. This is the contract part (b)
builds on, so (a) fixes it: add a boolean (installationManaged) to the
chat_check_for_updatesresult alongsidemanifestUnavailable,unsupportedProtocol,
and the other discriminators.chat_check_for_updatesitself keeps succeeding in
managed mode rather than refusing — the prefs pane and the chat pane both need a
resolvable answer.chat_get_update_statusneeds no change, and
chat_set_update_check_overrideis already restricted to--automation-agent
sessions. -
sessionInfo["posit_assistant_installation_enabled"]set from the helper in
SessionClientInit.cpp, next toposit_assistant_enabled. -
The "installation not found" error must not name the user directory in managed
mode.startChatBackend()tells the user to install to the XDG user data directory,
which is the one location managed mode ignores and refuses.
Part (b): client reactions (GWT)
SessionInfoaccessor, exposed asPaiUtil.isPositAssistantInstallationEnabled().
The JSNI accessor must read an absent field as allowed: a session that predates
the setting sends no such field, and defaulting it to false would report managed mode
and remove an ability the session actually permits.PaneManager.manageChatCommands(): hidecheckForPositAssistantUpdatesand
uninstallPositAssistant. The current code deliberately never hides uninstall so a
leftover copy can be removed; managed mode is the carve-out, since the leftover copy
is inert anyway.- Chat pane (
ChatPresenter's init-timecheckForUpdates()): when managed and no
valid administrator or bundled install exists, show "Posit Assistant is managed by
your administrator and is not currently installed" with no install button. When
managed and installed, behave normally — no update prompt can appear, since there is
no manifest state. promptToInstallUpdate()'s client-side guard extends to the new flag.AssistantPreferencesPane: hide the install button and the
positAssistantUpdateCheckIntervalHourscontrol, replacing the latter with an
administrator notice ("Posit Assistant updates are controlled by your
administrator") using the sameInfoBartreatmentPackagesPreferencesPaneuses
for CRAN repositories modified outside package preferences.
checkPositAssistantInstallation()reports the managed state, and the
performPositAssistantInstall()/doInstall()path becomes unreachable — except via
onCheckFailed, which offers an install with no version info, so
showInstallUpdatePrompt()needs the guard too.PositAiInstallManager.dispatchUpdateCheck()is already a static, unit-testable
dispatcher — add the managed-mode outcome there, keyed off the flag (a) added to the
result. Read it with the file's existing convention for fields an older rsession may
omit (absent defaults to false) rather than adding it to the required-discriminator
set, so a mixed-version pairing degrades instead of reporting a malformed response.
Rank it 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. Tests go in the existing
src/gwt/test/org/rstudio/studio/client/workbench/views/chat/PositAiInstallManagerTests.java,
run byant unittest.installUpdate()'sonErrormust surface the backend'sclient_infostring, as the
uninstall path already does; otherwise the managed refusal shows as a generic
execution error.
Behavior summary
| Configuration | User install/update/uninstall | Effective install |
|---|---|---|
| Default | allowed | user copy, else admin path/system dir, else bundled |
rsession.conf (or profiles) disabled |
blocked; user copy ignored; no manifest traffic | admin path/system dir, else bundled |
| Env var set (Desktop) | same as above | same as above |
Docs and tests
session-options.json->Rscript scripts/generate-options.R-> regenerated
SessionOptions.gen.hpp. Thersession_conf.qmdhalf is a no-op in this repo
(outputDocFileis/dev/null; the qmd lives in the docs repo).environment-variables.qmd: the new variable next to
RSTUDIO_DISABLE_POSIT_ASSISTANT, scoped to Desktop.NEWS.mdin both repos. The unreleased 2026.09 entry for NES language server ignores RSTUDIO_POSIT_AI_PATH and system-wide installs #18597 advertises
RSTUDIO_POSIT_AI_PATH; reword it to keep only the system-wide-installation half.
The rstudio-pro entry needs the same edit.- Tests:
ChatInstallationTests.cpp(resolution skips the user tier when disabled, and
still finds the pinned, system, and bundled tiers),ChatConstantsTests.cpp
(capability negotiation),SessionModuleContextTests.cpp(the environment-variable
half of the gate), GWT dispatcher tests for the managed-mode outcome and both
precedence directions. - Removing
RSTUDIO_POSIT_AI_PATHcosts the tests their injection seam.
ChatInstallationTests.cppuses it both to neutralize ambient state and to point
locatePositAssistantInstallation()at temp directories; it is the only such seam
the function has. Replace it with a parameterized overload following the
bundledPositAssistantInstallPath(resourcePath)precedent from Locate a Posit Assistant copy bundled with RStudio #18690 — an
InstallSearchPathsstruct built bypositAssistantSearchPaths()— rather than
drivingRSTUDIO_DATA_HOME/XDG, which keeps the ambient-state hedging that makes the
current tests awkward.
Manual verification
The option is honored in open-source builds, so this can be exercised with
npm run rserver-dev. Delete ~/.local/share/rstudio/pai/manifest-check.json before
each run, or the throttle will skip the check and the two cases look alike.
With a user-level install present and posit-assistant-installation-enabled=1, expect
the user install to be used and manifest-check.json to be rewritten. With =0, expect
"Ignoring user-level AI installation at …: Posit Assistant installation is managed by
the administrator", no rewrite of manifest-check.json, and no cdn.posit.co reference
in the session log.
No unit test can catch a reintroduced allowOverlay() term — session::options()
is a process-global populated by program-options parsing, so a pure
composition(option, env) helper would still be handed true. That A/B is the guard.
Notes
- Existing installs change behavior. Anyone with both a user-level and an
administrator-level install switches to the administrator copy the first time the
setting is enabled, potentially a downgrade. Log it. - An administrator-managed install must ship its own
protocol.json, and so must a
Workbench bundle. A sideloaded, system-level, or bundled copy never goes through
RStudio's install path, andwriteProtocolVersionFileIfMissing()only ever runs
against the user-data install, so nothing backfills one into a read-only location. A
missing protocol counts as a mismatch, which is the correct outcome: a package with
no bundledprotocol.jsonpredates every supported Posit Assistant version, so
reporting it as incompatible is right rather than something to work around. In managed
mode this is fatal rather than noisy — there is no manifest, so no update can be
offered that would fix it. posit-assistant-test-manifestis moot in managed mode; the pre-release warning
banner should not fire.- Known limitation: an administrator install with no
package.jsondead-ends in
managed mode.verifyPositAiInstallation()does not requirepackage.json, so such
a directory resolves andstartChatBackend()would succeed, butgetInstalledVersion()
returns"", whichresolveWithoutManifestFetch()normalizes to"0.0.0". That sets
isInitialInstall, so the pane reports "managed by your administrator and is not
currently installed" and never starts the backend — no chat, despite a working
installation. Unmanaged mode escapes this by offering an install; managed mode has no
way out. Left as-is: it takes a malformed package (rstudio/rstudio-pro#12483 has the
packaging step assertpackage.jsonis present), and fixing it means giving the
update-check result a way to say "installed, version unknown", which"0.0.0"currently
doubles as. Revisit if the versioned store in Install Posit Assistant side-by-side in versioned directories #18658 reworks that result shape anyway. - A bundled install currently over-locks: the lock skip at
startChatBackendexempts
only the XDG system path, so with a bundle present every session running the
assistant holds the in-use lock. This setting is the pairing that makes that
harmless, since per-user install and update are refused outright.
Resolved questions
- The surviving bypass. Removing
RSTUDIO_POSIT_AI_PATHcloses the direct
override.RSTUDIO_CONFIG_DIR/XDG_CONFIG_DIRScan still redefine where "the
system install" resolves, and both are plain environment variables — out of scope:
policy comes fromrsession.confor profiles, which users cannot edit, and a user who
can redefine the system config dir can already redefine much more. - Refusal wording: "Posit Assistant installation is managed by your administrator
and cannot be changed from RStudio.", matching the style of the existing uninstall
refusals, delivered viaclient_info. - Managed-but-nothing-installed copy: one message. The session cannot reliably tell
"the administrator has not installed it yet" from "posit-assistant-pathis set but
invalid".
Related
- Builds on Add posit-assistant-path option for admin-managed installs #18688 (
posit-assistant-path) and Locate a Posit Assistant copy bundled with RStudio #18690 (bundled lookup), both merged.
Locate a Posit Assistant copy bundled with RStudio #18690 did the structural work this layers on: splitting
systemPositAssistantInstallPath()'s callers into "where would an administrator
install" and "is this install read-only", and finalizing the search order. - Install Posit Assistant side-by-side in versioned directories #18658 (versioned side-by-side installs) is a follow-up, not a prerequisite. This
work targets the current single unversionedpai/binlayout. Both the bundled tier
and this gate live in the one resolution function and express rules that carry over
to a store/selector layout unchanged. - rstudio/rstudio-pro#12483 bundles Posit Assistant with Workbench, adding the tier
disabled mode falls back to. - rstudio/rstudio-pro#12534 adds the Workbench profiles key
assistant-installation-enabled, which depends only on thersession.confoption
landing here.
Activity
[-]Add rsession.conf setting to disable Posit Assistant update checks[/-][+]Add a setting to disable user-managed Posit Assistant installs[/+]Make the installation setting a regular option, not an allow-* one
Stop pointing at the user directory when installs are managed
Don't claim Posit Assistant is missing when the check failed
Add a setting to disable user-managed Posit Assistant installs (#18691)