Skip to content

Add a setting to disable user-managed Posit Assistant installs #18443

Closed

Description

@gtritchie

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

  1. rsession.conf — posit-assistant-installation-enabled, default 1, in the
    pai group of src/cpp/session/session-options.json next to
    posit-assistant-enabled.

    Not an allow-* option. generate-options.R emits value || allowOverlay()
    for every bool in the allow group, and open-source builds define allowOverlay()
    as unconditionally true — so an allow-posit-assistant-installation would have
    been force-allowed everywhere except Workbench. This has to work in open-source
    RStudio Server. That is the same reason posit-assistant-enabled lives in the pai
    group rather than beside allow-posit-assistant. (An earlier revision of this issue
    specified the allow group; it was wrong.)

  2. Environment variable — RSTUDIO_DISABLE_POSIT_ASSISTANT_INSTALLATION
    (non-empty = disabled), mirroring RSTUDIO_DISABLE_POSIT_ASSISTANT. Desktop
    only
    , and not by a code gate: rserver builds 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).

  1. The option, the env var, and the helper, as above.

  2. 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.

  3. RSTUDIO_POSIT_AI_PATH is removed entirely — the tier-1 branch and its logging
    in ChatInstallation.cpp, the search-order comment in ChatInstallation.hpp, and
    the now-dead env-path refusal branch in chat_uninstall_posit_assistant (the
    read-only-install refusal below it already covers every remaining case), plus the
    stale references in SessionAssistant.cpp and SessionAssistantTests.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 point posit-assistant-path at it.

  4. chat_install_update refuses, with a client_info message the UI renders.
    Today it gates only on isPositAssistantWanted(), which the user controls.

  5. chat_uninstall_posit_assistant refuses 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.

  6. No manifest traffic — gate shouldFetchManifest(), not the call sites. Every
    fetch funnels through startUpdateCheck(), whose three callers are onDeferredInit,
    chatCheckForUpdates, and chatInstallUpdate, 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 touching cdn.posit.co. The
    managed gate must take precedence over force, which chatInstallUpdate passes as
    true. (There are no periodic checks to suppress — checks are startup plus
    user- and assistant-initiated, with throttle state persisted in manifest-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.

  7. The assistant-initiated ui/checkForUpdates is suppressed separately, since it
    fetches nothing: handleCheckForUpdates is 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 that rstudioCapabilities() in
    ChatConstants.cpp returns 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 in SessionChat.cpp, so the rule
    is testable.

  8. 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_updates result alongside manifestUnavailable, unsupportedProtocol,
    and the other discriminators. chat_check_for_updates itself keeps succeeding in
    managed mode rather than refusing — the prefs pane and the chat pane both need a
    resolvable answer. chat_get_update_status needs no change, and
    chat_set_update_check_override is already restricted to --automation-agent
    sessions.

  9. sessionInfo["posit_assistant_installation_enabled"] set from the helper in
    SessionClientInit.cpp, next to posit_assistant_enabled.

  10. 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)

  1. SessionInfo accessor, exposed as PaiUtil.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.
  2. PaneManager.manageChatCommands(): hide checkForPositAssistantUpdates and
    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.
  3. Chat pane (ChatPresenter's init-time checkForUpdates()): 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.
  4. promptToInstallUpdate()'s client-side guard extends to the new flag.
  5. AssistantPreferencesPane: hide the install button and the
    positAssistantUpdateCheckIntervalHours control, replacing the latter with an
    administrator notice ("Posit Assistant updates are controlled by your
    administrator") using the same InfoBar treatment PackagesPreferencesPane uses
    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.
  6. 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 by ant unittest.
  7. installUpdate()'s onError must surface the backend's client_info string, 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. The rsession_conf.qmd half is a no-op in this repo
    (outputDocFile is /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.md in 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_PATH costs the tests their injection seam.
    ChatInstallationTests.cpp uses 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
    InstallSearchPaths struct built by positAssistantSearchPaths() — rather than
    driving RSTUDIO_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, and writeProtocolVersionFileIfMissing() 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 bundled protocol.json predates 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-manifest is moot in managed mode; the pre-release warning
    banner should not fire.
  • Known limitation: an administrator install with no package.json dead-ends in
    managed mode.
    verifyPositAiInstallation() does not require package.json, so such
    a directory resolves and startChatBackend() would succeed, but getInstalledVersion()
    returns "", which resolveWithoutManifestFetch() 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 assert package.json is 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 startChatBackend exempts
    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_PATH closes the direct
    override. RSTUDIO_CONFIG_DIR / XDG_CONFIG_DIRS can still redefine where "the
    system install" resolves, and both are plain environment variables — out of scope:
    policy comes from rsession.conf or 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 via client_info.
  • Managed-but-nothing-installed copy: one message. The session cannot reliably tell
    "the administrator has not installed it yet" from "posit-assistant-path is set but
    invalid".

Related

Activity

  1. added theissue type on Aug 4, 2026
  2. self-assigned this
    on Aug 13, 2026
  3. changed the title [-]Add rsession.conf setting to disable Posit Assistant update checks[/-] [+]Add a setting to disable user-managed Posit Assistant installs[/+] on Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions