Skip to content

Fix Posit Assistant failing to start in a second RStudio instance on Windows - #18788

Closed
gtritchie wants to merge 2 commits into
mainfrom
bugfix/18787-pai-lock-owner-id-windows
Closed

gtritchie wants to merge 2 commits into
mainfrom
bugfix/18787-pai-lock-owner-id-windows

Conversation

@gtritchie

@gtritchie gtritchie commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Intent

Fixes #18787.

On Windows, every RStudio session named its Posit Assistant "in use" lock file pai/locks/sessions/.lock, so a second instance collided with the first and Posit Assistant refused to start with "A Posit Assistant update is in progress".

The owner id that names the file is a function-local static const std::string initialized by a conditional expression. MSVC 19.51 in C++20 mode (which the Windows build uses) initializes that static to an empty string; the same code is correct in C++17 mode, as a non-static local, or when the initializer is wrapped in a lambda. The static was introduced by #18573, which is why 2026.08 is unaffected.

Approach

  • Compute the owner id inside an immediately-invoked lambda with plain locals.
  • InstallLock::acquireInUse refuses an empty owner id with a real error, so a regression surfaces as "Unable to verify the Posit Assistant installation state" instead of silently sharing one file and reporting an update in progress.
  • Expose InstallLock::ownerId() as a test seam.

Automated Tests

The lock tests were entirely #ifndef _WIN32, so nothing exercised owner-path naming on Windows. This PR moves the tests' common includes out of the POSIX-only block and adds three tests that compile everywhere:

  • the session lock file is named <owner>.lock
  • an empty owner id is refused without creating .lock
  • the production accessor's owner id is non-empty (fails on the previous initializer under MSVC, passes with the fix)

QA Notes

Verified on Windows 11 with the local dev build; QA notes added to the issue.

Documentation

None; no user-facing behavior beyond the bug fix. NEWS entry added.

Checklist

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

MSVC in C++20 mode initializes a function-local static std::string whose
initializer is a conditional expression to an empty string, so every
Windows session named its in-use lock file `sessions/.lock` and a second
RStudio instance refused to start Posit Assistant with "A Posit Assistant
update is in progress". Compute the id in a lambda instead, expose it for
tests, and move the lock tests' common includes out of the POSIX-only
block so owner-path tests compile on Windows.

Addresses #18787
An empty owner id names the session lock file `.lock`, which every
session with the same defect shares, and the resulting contention reads
as an update in progress. Fail the acquisition with a real error instead
so a regression surfaces instead of silently sharing one file.

Addresses #18787
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
2744 0 195 12
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
✅ desktop-linux 692 0 38 3
✅ desktop-macos 689 0 42 3
✅ desktop-windows 695 0 41 3
✅ server-linux 638 0 44 3
✅ 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 bf49ac25008e4b04eef841566308f0b6decb6f12 - Run #943

@gtritchie

Copy link
Copy Markdown
Member Author

Will be redoing this against rel-autumn-hawkbit branch for patch 1.

@gtritchie

Copy link
Copy Markdown
Member Author

Superseded by #18790, which carries the same two commits based on rel-autumn-hawkbit for the 2026.09.1 patch.

@gtritchie gtritchie closed this Sep 11, 2026

This branch was previously deployed

1 inactive deployment
e2e-playwright — bf49ac25 Deployed Sep 11, 2026 by gtritchie via windows / e2e-desktop-windows (5) #943
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.

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

1 participant