Repository navigation
Conversation
Replace the single pai/bin installation with the ordered source list from the versioned-installs design: RSTUDIO_POSIT_AI_PATH, then the per-user pai/versions slots chosen by protocol through selected.json, then the admin-managed system install. Each source is a separate function so the list can be gated and extended without disturbing the others. An install now downloads, verifies, extracts into a private staging directory and publishes a slot, then records it in the selector. Nothing already on disk is modified, so the ai.prev backup and every restore branch are gone, and the backend is stopped after the install rather than before it -- a failed install leaves a working assistant running. A version already on disk in a verifying slot skips the download and just updates the selector. Resolution happens once per session and is pinned for the process lifetime, so an install in another session never changes what this one is executing; the pin is cleared when this session's own install publishes a slot. The existence-only verifyPositAiInstallation() is replaced by verifyInstallDir(), which also rejects the zero-byte main.js a truncated extraction leaves behind, and by the manifest-backed slot verification for the versioned source. Addresses #18658
PW_SEED_PAI trees are laid out the way an install leaves them -- versions/<version> carrying its own slot manifest, named by selected.json -- because a versioned-aware RStudio never reads the unversioned pai/bin. A bare copy would resolve to nothing and the suite would silently download and test the official package instead of the build that was asked for. The seed's bin/ is not copied for the same reason. The version-under-test report follows the selector rather than a fixed path, and a sandbox-layout test asserts the seeded shape. A C++ test pins the manifest wire format the TypeScript seeder writes, so a change to the format fails a build rather than quietly degrading seeded runs. Addresses #18658
The archive is SHA-256 checked against the manifest entry chosen for this protocol, so a package declaring another version or protocol is mis-published rather than corrupt -- but installing it anyway recorded a slot against a different protocol's selection, changing what another RStudio release resolves, and reported an update this session could not run and would be offered again on every check. Report install failures through the error description rather than getMessage(), which for these errors is only the bare errno string.
A package version is not a path. The seeder used it as one, so a malformed or hostile version wrote the tree outside versions/ and recorded a selector entry RStudio ignores -- which fails as a silent download of the official package rather than as a broken seed. Reject a version that cannot name a slot, using the same rules as slots::isUsableSlotName(). Report all selected installs rather than the first. A seed the IDE finds incompatible leaves two selector entries, and which one the session ran depends on the protocol compiled into the IDE, which is not readable from disk -- so naming a single build was liable to name the one that was not under test. Add a harness self-test for the seeder, so a drift in what it produces fails there rather than degrading every seeded run.
|
Closing: too risky to land against the current release timeline. The branch State at close: three commits (resolver switch + install rewrite, Playwright slot seeding, two rounds of review fixes). 537 rsession tests pass, and the seeded layout was verified end to end against a dev server. One open question is recorded in the PR discussion -- |
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
PR 3 of the five-PR sequence in #18658: the resolver switch and the install path
rewrite. This is the behavior-changing one -- the layout PR 2 built is now what
RStudio installs into and runs from.
Addresses #18658.
Resolution
locatePositAssistantInstallation()becomes the ordered list of independentsources from the issue, each its own function so the list can be gated and
extended without disturbing the others (#18443 disables the user-writable
sources; rstudio/rstudio-pro#12483 appends a fourth):
RSTUDIO_POSIT_AI_PATHpai/versionsviaselected.json, chosen by protocol<systemConfigDir>/pai/binSources 1 and 3 are unversioned directories, not slots. They carry no install
manifest and are not named for a version, so they get
verifyInstallDir()--the expected paths exist and are non-empty -- and nothing more. Neither is
chosen by protocol, and what they declare is reported downstream to the update
check rather than gating them here: an override or a system install is taken on
the authority of whoever put it there, and a system install predating
protocol.jsonstill resolves and reports the legacy empty protocol the updatecheck already handles.
A session resolves once and holds the answer for the process lifetime, so an
install elsewhere never changes what it is executing. Its own install clears
the pin so the components it restarts come back on the new version.
getInstalledVersion()andgetInstalledProtocolVersion()report from thepinned install.
Install
installPackage()andperformInstall()become download -> verify SHA-256 ->stage -> publish a slot -> select it. A version already on disk in a verifying
slot skips the download and just updates the selector.
The
ai.prevbackup and every restore branch are gone: a slot only reaches afinal name after
allocateSlot()has recorded its manifest and verified theresult, so there is no torn install for a backup to restore.
The backend and agent are stopped after the install rather than before it.
Nothing on disk is mutated, so stopping is only about picking up the new
version -- and a failed install now leaves a working assistant running. The
waitForOwnComponentsReaped()reap-wait and its "a process is still shuttingdown" failure path go away with the reason they existed.
The download is SHA-256 checked against the manifest entry for this protocol,
but the extracted package's own declared version and protocol are still checked
before anything is published: a mis-published package would otherwise write
another protocol's selector entry, changing what a different RStudio release
resolves, and report an update this session cannot run.
Verification replaced, not duplicated
verifyPositAiInstallation()and thepackage.json/protocol.jsonreadersin
ChatInstallation.cppare deleted rather than left beside the slotequivalents. The existence-only check they implemented accepted a zero-byte
main.js;verifyInstallDir()does not, andslots::verifySlot()builds themanifest-backed check on top of it.
ChatInstallationTests.cppis reworkedaround the new surface.
Playwright sandbox
PW_SEED_PAItrees are now laid out the way an install leaves them --versions/<version>carrying its own slot manifest, named byselected.json-- because a versioned-aware RStudio never reads the unversioned
pai/bin. Abare copy would resolve to nothing and the suite would silently download and
test the official package instead of the build that was asked for. The seed's
own
bin/is not copied for the same reason, and the version-under-test reportfollows the selector rather than a fixed path.
check-for-updates-command.test.tsneeds no change: it drives the update-checkdialogs and dismisses before any install.
Decision: the lost-selection downgrade case is accepted
The selector is advisory and
selectSlot()is an unserializedread-modify-write, so two sessions recording different protocols at once can
drop an entry. Resolution recovers by converging on the newest verifying slot
for the protocol, not on what the entry said. That is the same answer while a
selection only records the version just installed, but this PR wires up the
manifest-serves-a-lower-version case (
isVersionDowngrade), where a lost entryresolves up to a newer slot.
Accepted, not made durable. It needs two sessions on different protocols
installing in the same instant; the session then runs a newer package the same
protocol already accepted; and the next update check re-selects the manifest's
version with no download, since it is still on disk. Making it durable would
mean either serializing the selector write -- locking, which this effort exists
to remove -- or recording a "prefer the older one" intent inside the slot,
which is the retention policy #18658 defers to the manage-installs work.
Deviation from the task's recommended split
waitForOwnComponentsReaped()is deleted here rather than with the lock inPR 4. It is a free function in an anonymous namespace, so leaving it unused
would emit
-Wunused-function.ChatInstallLockand theMutationScopecallsite stay for PR 4.
The Windows access-denied install message ("close all other instances of
RStudio and try again") is also gone: it described a directory swap losing to
another session's open handles, which no longer happens, so the advice would be
wrong.
Testing
rstudio-tests --scope rsession: 537 pass. New coverage for each resolversource in isolation, precedence between them, a present-but-unverifying
source falling through, the pin being held and cleared, reporting from the
resolved install, and the staged -> published -> selected sequence composing
into something the resolver returns.
selectInstalledVersion()coversskip-if-already-installed, including a reinstall slot matched by the version
it holds rather than its name.
ChatSlotstest pins the manifest wire format the TypeScript seederwrites, so a change to the format fails a build rather than quietly making
every seeded run download the official package.
open-chat-pane.test.tsandcheck-for-updates-command.test.tsagainsta dev server with
PW_SEED_PAIset: 11 passed. The preserved sandbox heldpai/versions/1.2.2andselected.jsonand nopai/bin, and the backendstarted from the slot.
Note for the assistant repo
npm run deploy:rstudiowrites~/.local/share/rstudio/pai/bin, which aversioned-aware RStudio no longer reads. Developers can point
RSTUDIO_POSIT_AI_PATHat that directory (source 1), or the deploy script canbe taught to write a slot -- worth a follow-up there.