Skip to content

NES language server ignores RSTUDIO_POSIT_AI_PATH and system-wide installs #18597

Closed

Description

@gtritchie

Summary

paiLanguageServerPath() hardcodes the Posit Assistant install location instead of resolving it the way the rest of the assistant code does. As a result the NES language server ignores both RSTUDIO_POSIT_AI_PATH and the system-wide install location, while the chat backend honors both.

https://github.com/rstudio/rstudio/blob/main/src/cpp/session/modules/SessionAssistant.cpp#L453-L471

FilePath paiLanguageServerPath()
{
   FilePath languageServerDir = xdg::userDataDir().completePath("pai/bin/dist/nes");
   ...
}

Everything else resolves the install through locatePositAssistantInstallation() (src/cpp/session/modules/chat/ChatInstallation.cpp:48), which checks three locations in order:

  1. RSTUDIO_POSIT_AI_PATH
  2. <XDG_DATA>/pai/bin
  3. <XDG_SYSTEM_CONFIG>/pai/bin (e.g. /etc/rstudio/pai/bin)

paiLanguageServerPath() only ever looks at (2).

Impact

Two cases where completions silently diverge from chat:

  • RSTUDIO_POSIT_AI_PATH set to a dev build. Chat runs the dev build; NES runs whatever happens to be in <XDG_DATA>/pai/bin/dist/nes, or nothing at all. Mixing a dev chat backend with a stale language server is a confusing state to debug, since nothing reports the mismatch.
  • System-wide install only (/etc/rstudio/pai/bin, no per-user install). Chat works; completions never start. paiLanguageServerPath() returns an empty path and logs at debug level only, so the failure is invisible unless assistant logging is turned up.

Note that the adjacent copilotLanguageServerPath() does provide an override (RSTUDIO_COPILOT_JS_FOLDER, SessionAssistant.cpp:474), so the escape hatch exists for Copilot but not for Posit Assistant.

Suggested fix

Derive the NES directory from locatePositAssistantInstallation() and append dist/nes, so both halves of the assistant resolve to the same installation.

Reproduction

  1. Install Posit Assistant normally so <XDG_DATA>/pai/bin exists.
  2. Set RSTUDIO_POSIT_AI_PATH to a different valid install (containing dist/client/index.html and dist/server/main.js) and start a session.
  3. The chat pane loads from the override path; the NES language server still loads from <XDG_DATA>/pai/bin/dist/nes.

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions