Repository navigation
Description
This concerns the Playwright E2E suite (e2e/rstudio) and how AI provider
credentials (Posit AI and GitHub Copilot) are provisioned for tests.
Describe the problem
The auth.setup project provisions AI credentials into a per-run sandbox home
($PW_SANDBOX/user-home), and the credential gate reads that sandbox. This
works in Desktop mode, where the IDE reads the sandbox home. In Server mode it
does not: rserver builds each rsession's environment from scratch and takes
the session's HOME from the system password database (getpwnam -> pw_dir),
i.e. the logged-in OS user's real home directory, not the sandbox. So the
credentials written to the sandbox never reach a server rsession, and the AI
features behave as signed-out even though setup reported success.
This affects both providers and pre-dates the Copilot work (it shipped with the
Posit AI credential provisioning in #17680). PR #18342 only surfaces it: the
setup now prints a warning in Server mode that the sandbox credentials will not
reach the session.
Steps to reproduce the problem
On a machine where the logged-in user's real home directory is not signed in to
the provider:
- Run a Copilot feature test in server-dev mode:
npm run test:server-dev -- tests/panes/editor/code_suggestions.test.ts -g "GitHub Copilot"- The
auth.setupproject signs in and writes the store to the sandbox, and
the setup test passes.
- The
- The credential gate reads the sandbox, finds it authenticated, and does not
skip, so the feature test runs. - The feature fails: Copilot ghost text times out, and Posit Assistant chat
loads but the response comes back empty (or a sign-in overlay blocks it),
because the rsession read the real home, which has no credentials.
If the logged-in user's real home directory is itself already signed in to the
provider, the tests pass, but only because the rsession reads that pre-existing
local sign-in, not the credentials the setup provisioned into the sandbox. A
green result in that case does not mean the provisioning reached the session.
Confirmed live on an external RStudio Server (Fedora VM) and via
test:server-dev on macOS.
Describe the behavior you expected
Sandbox-provisioned AI credentials should reach the server rsession so the
feature tests exercise real credentials.
What addressing it would involve
Getting sandbox-provisioned credentials to a server rsession, e.g. writing them
into the location the rsession's real HOME resolves to, running the rsession
under a user whose home is the sandbox, or forwarding the credential dirs the
way RSTUDIO_CONFIG_HOME/XDG vars are already forwarded. Likely its own effort,
and it must cover both providers.
Activity
ronblum commentedon Jul 24, 2026
Traced the exact mechanism behind this while verifying PR #18342.
fixtures/server.fixture.tssetsHOME,RSTUDIO_CONFIG_HOME, andRSTUDIO_DATA_HOMEon therserverprocess it spawns, pointing into the sandbox. Butrservernever hands that environment to the rsession it forks for the authenticated user. Incore/system/PosixSystem.cpp,runProcess()(lines 2696-2703) builds that child's environment from scratch: it copies onlyPATH,MANPATH, andLANGfrom the parent, then explicitly setsHOMEfromuser.getHomePath()(the passwd entry) -- none of the sandbox overrides survive.Confirmed the effect directly: running
code_suggestions.test.tsagainsttest:server-dev, GitHub Copilot failed with the real UI showing"Copilot: Not signed in.", even though the sandbox's own auth.setup step had just completed a real, successful Copilot device-flow sign-in. The credential gate (requireAiCredentials) only checks the sandbox store, so it reported "authenticated" and let the test run instead of skipping -- the mismatch only surfaces downstream, as a feature failure rather than a clean skip.ronblum commentedon Aug 7, 2026
Completed via #18458.
e2e: consolidate R package provisioning in the os-e2e-deps action - #…