Skip to content

Can't start Posit Assistant in more than one RStudio instance on Windows #18787

Closed

Description

@gtritchie

System details

RStudio Edition : Desktop
RStudio Version : 2026.09.0+174 "Autumn Hawkbit" Release (works in 2026.08.x)
OS Version      : Windows-11 (so far have only reproduced on Windows)
R Version       : any

Steps to reproduce the problem

  • Start RStudio desktop, show Posit Assistant (install if necessary), sign in, etc.
  • Start a second instance of RStudio (e.g. Session > New Session, or other ways)

Describe the problem in detail

The Posit Assistant pane fails to load, showing "Error: Failed to start Chat backend: A Posit Assistant update is in progress. Please try again in a moment."

Describe the behavior you expected

Second window's Posit Assistant starts.

Image

Activity

  1. added theissue type on Sep 11, 2026
  2. self-assigned this
    on Sep 11, 2026
  3. gtritchie commented on Sep 11, 2026

    @gtritchie
    MemberAuthor

    Root cause

    Every Windows session names its Posit Assistant "in use" lock file pai/locks/sessions/.lock because the lock owner id comes out as an empty string. The second instance then collides with the first on that one file and reports the contention as "update in progress". From rsession-<user>.log:

    Failed to acquire lock: C:/Users/<user>/AppData/Local/RStudio/pai/locks/sessions/.lock
    ERROR system error 39 (The disk is full) [lock-file: .../pai/locks/sessions/.lock,
      description: A Posit Assistant update is in progress. Please try again in a moment.]
    

    The owner id is built in installLock() (src/cpp/session/modules/SessionChat.cpp):

    static const std::string ownerId =
       module_context::activeSession().id().empty()
          ? core::system::generateUuid(false)
          : module_context::activeSession().id() + "-" + core::system::generateUuid(false);

    MSVC (19.51.36248, VS 2026 v145) in -std:c++20 mode, which cmake/compiler.cmake selects on Windows only, initializes that function-local static to "". Confirmed three ways:

    • Instrumented dev build: inside installLock() the UUID printed non-empty while the static printed empty, and InstallLock's constructor received "".
    • A standalone 30-line program with the same shape: empty under -std:c++20 at both /Od and /O2; correct under -std:c++17, correct as a non-static local, and correct when the initializer is wrapped in an immediately-invoked lambda.
    • InstallLock itself produces the right <id>.lock name when handed a real id, so the lock protocol is not at fault.

    Why 2026.09 and not 2026.08

    The lock shipped in 2026.08 (#18276) with the id passed straight to the constructor as an expression. #18573 (2026.09 only) hoisted it into a static const std::string initialized by the conditional operator, which is the shape MSVC gets wrong. Windows has built with C++20 since December 2025, so the compiler mode did not change.

    Why it wasn't caught

    ChatInstallLockTests.cpp is wrapped in #ifndef _WIN32, so nothing on Windows exercised the owner-path naming. The "The disk is full" text is a side effect of rendering errc::no_lock_available (39) through the Windows system error category and is misleading but harmless.

    Fix

    Compute the id in an immediately-invoked lambda with plain locals (verified correct with the same compiler), refuse an empty owner id in InstallLock so a regression fails loudly instead of silently sharing one file, and add tests that compile on Windows.

  4. gtritchie commented on Sep 11, 2026

    @gtritchie
    MemberAuthor

    QA Notes

    Windows only (macOS and Linux were never affected).

    1. Start RStudio Desktop, open Posit Assistant, and sign in.
    2. Session > New Session (or launch a second RStudio instance any other way) and open Posit Assistant in the second window.
    3. Expected: Posit Assistant starts in both windows. Before the fix the second window shows "Error: Failed to start Chat backend: A Posit Assistant update is in progress. Please try again in a moment."
    4. While both are running, %LOCALAPPDATA%\RStudio\pai\locks\sessions should contain one <launcher-token>-<uuid>.lock file per running session and no file named just .lock.
    5. Close one window; its lock file should disappear and the other window's Posit Assistant should keep working.
  5. gtritchie commented on Sep 11, 2026

    @gtritchie
    MemberAuthor

    Upstream compiler bug

    This is a regression in MSVC 19.51 (Build Tools v14.51, Visual Studio 2026 18.6 and later). The repro passes on every MSVC release from 19.29 (VS 2019 16.11) through 19.50 (VS 2026 18.2) on Compiler Explorer, under both /std:c++17 and /std:c++20, and fails only on 19.51. RStudio's Windows CI image pins VS 2026 18.7.3, which carries 14.51.

    Microsoft tracks it as Developer Community ticket 11093947, "MSVC 14.51 codegen: ternary picks wrong =default constructed branch for std::string class", listed as fixed in the v14.52 preview in MSVC Build Tools Preview updates - July 2026. As of 2026-09-11, v14.52 is preview only (19.52.36725, September 2026 preview notes); the GA toolset through VS 2026 18.10 is still 14.51 with no servicing fix listed in the release notes. So no shipped toolset has the fix yet, and the source-level workaround is needed regardless.

    Affected shape, from local characterization: copy-initializing a static-storage class object (static T x = cond ? a : b;, local or namespace scope) where an operand is a temporary. std::string, std::wstring, and an aggregate holding a string break under C++20; std::shared_ptr breaks under C++17 and C++20. Direct-init static T x(cond ? a : b);, lvalue operands, an IIFE lambda, if/else, and non-static locals are all fine. A sweep of src/cpp on main and rel-autumn-hawkbit found no other instance of the pattern.

  6. gtritchie commented on Sep 12, 2026

    @gtritchie
    MemberAuthor

    Fixed in 2026.09.1 patch branch, and pulled into main via usual merge process.

  7. gtritchie commented on Sep 13, 2026

    @gtritchie
    MemberAuthor

    Verified fixed in patch build 2026.09.1+180. Note this is not yet an official release, but the only change in this build versus the official release is this fix. Download from: https://dailies.rstudio.com/rstudio/autumn-hawkbit/.

    We will be issuing an official patch release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions