Skip to content

harden the flakes from run 34637770965; fix console keybinding race and unbounded python discovery - #18797

Merged
gtritchie merged 6 commits into
mainfrom
bugfix/e2e-flakes-run-34637770965
Sep 14, 2026
Merged

gtritchie merged 6 commits into
mainfrom
bugfix/e2e-flakes-run-34637770965

Conversation

@kevinushey

@kevinushey kevinushey commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Triage of the 9 flaky rows in PR #18789's own all-platforms run (report). Two are test-side gaps, two turned out to be product bugs. A second CI run added one more of each kind, plus a launcher fix that fell out of verifying them.

Test-side

code_suggestions.test.ts (6 rows, Posit AI Pass, all four platforms). The failure screenshots show the status bar at "Posit AI Pass: No completions available." -- the terminal state #18789 already re-requests for ghost text, but the four NES waits and acceptNesRename still waited blindly. The loop now lives in SourcePaneActions.waitForSuggestion and is used for both ghost text and NES.

The first version re-requested with assistantRequestCompletions for both. Run 34711642587 showed that is a no-op for Posit AI next-edit suggestions: that command only ever asks for an at-cursor completion, and its empty-result fallback to a next-edit request is Copilot-only (shouldFallbackToNes() is !isPositAi), so the loop fired twice and the status bar just re-read "No completions available" (server-1 and mac-1, both NES specs; retries in a fresh session passed in ~14s). NES waits now re-ask with assistantAcceptNextEditSuggestion, which with nothing on screen calls requestNextEditSuggestions() directly -- the same request the automatic document-change path makes. Ghost text keeps assistantRequestCompletions.

spelling_language_switch.test.ts "rechecks an open detached editor" (desktop-linux, both attempts, and the same in #18766's own run). The trace shows the satellite page event and, 70ms later, AceEditor throwing "No Ace editor found containing marker" -- waitForLoadState('domcontentloaded') is satisfied by the popup's initial document, and expect.poll propagates a throwing callback instead of retrying it (Playwright's pollMatcher calls the generator outside its try/catch). The spec now waits for the source-window URL and retries the whole content check with toPass().

build_pane_testthat.test.ts (desktop-windows). The project switch navigated to the new session, rstudio.nocache.js loaded, then the main *.cache.js failed with net::ERR_NO_BUFFER_SPACE, leaving a blank window the bridge would never appear in. openProject now reloads once if ready has not flipped after a 20s grace period and the automation bridge was never installed; a merely slow session is left alone.

test:desktop-dev / test:server-dev GWT check. Verifying the spelling fix from a worktree launched Electron against an empty src/gwt/www, because the launcher's "is GWT ready" check only asked whether any RStudioSuperDevMode process existed -- one was running for a different worktree -- and then burned two 30s attempts before failing with "window.rstudio.ready never became true". checkGwtBuildReady now reads the checkout out of each devmode's classpath (<checkout>/src/gwt/src is its first entry) and only counts one for this checkout, reports others as unable to serve this tree, and exits before launching when there is no bootstrap or only a Super Dev Mode stub with no matching code server.

Product

console_editor_keybindings.test.ts "applied at startup" (desktop-linux). Not a timing flake: after the reload, the trace shows read_config_json for addins.json and rstudio_bindings.json only -- editor_bindings.json was never read in the whole 20s retry window. EditorCommandManager registers its EditorLoadedEvent handler inside the AceEditor.load() callback, and ExternalJavaScriptLoader drains its callbacks one per scheduler tick, so the Console's editor can attach and fire the event first. EditorCommandManager now also loads its bindings on SessionInitEvent (or immediately, if Ace finishes loading after the session is already up); rebindCommand fires SetEditorCommandBindingsEvent, which live editors already honor. The first version of this PR loaded eagerly from finishInit, which on the server sent read_config_json before client_init had returned; the session rejected it with INVALID_CLIENT_ID and the client disconnected itself. That is what failed both linux-server shards and the two DebouncedCommandTests in the Jenkins GWT unit tests on the first CI run.

global_prefs_panels.test.ts Python interpreters (server-linux). python_find_interpreters never returned within 60s ("Finding interpreters..." the whole time). Discovery ran every interpreter probe and conda env list via system2() with no timeout. Each probe is now bounded (rstudio.python.probeTimeout, default 10s; conda gets 3x); a probe that times out is listed as invalid, and a conda timeout skips conda environments with a warning instead of failing the scan.

Fixes #18793.
Addresses #18794.

Verified locally: tsc --noEmit for e2e, ant javac, R parse + ASCII check; spelling_language_switch.test.ts green on desktop from the worktree (after ant draft there and a rebuilt main session -- the launcher check above is what surfaced both). The NES specs need Posit AI credentials, so their coverage comes from CI.

…exposed

Test-side:
- code_suggestions: the NES waits still waited blindly on a provider that
  had answered "No completions available"; share the re-requesting wait
  (now SourcePaneActions.waitForSuggestion) with the NES sites and
  acceptNesRename.
- openProject: reload once if the switched-to session never installs the
  automation bridge (GWT bootstrap has no retry; Windows hit
  net::ERR_NO_BUFFER_SPACE on the main cache.js).

Product:
- EditorCommandManager registered its EditorLoadedEvent handler only after
  the async Ace load, so the Console could fire the event first and saved
  editor bindings were never loaded. Load once in finishInit as well.
  Addresses #18793
- Python interpreter discovery ran each probe with no timeout, so a hung
  interpreter or conda left the Python options panel stuck at "Finding
  interpreters...". Bound every probe. Addresses #18794
@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
2922 0 186 3
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
✅ desktop-linux 735 0 38 0
✅ desktop-macos 740 0 33 1
✅ desktop-windows 737 0 41 1
✅ server-linux 680 0 44 1
✅ 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 6778ec3872f740e8cef8783d7550f86d87422546 - Run #997

The eager loadBindings() in finishInit() sent read_config_json before
client_init had returned. On the server (fresh login through rserver, or
any project switch) that request carried no client id, the session
rejected it with INVALID_CLIENT_ID, and RemoteServer disconnected the
client, leaving the workbench behind a glass pane. The same early send
also threw inside the GWT unit test harness (empty CSRF header).

Load on SessionInitEvent instead, or immediately if the session is
already up when ace finishes loading.

Claude-Session: https://claude.ai/code/session_01E9g2VQQ2BTypGPabh1NBkP
@gtritchie
gtritchie merged commit 65abf11 into main Sep 14, 2026
34 checks passed
@gtritchie
gtritchie deleted the bugfix/e2e-flakes-run-34637770965 branch September 14, 2026 21:03
gtritchie added a commit that referenced this pull request Sep 17, 2026
* e2e: name the dialog blocking a project close

Cherry-picked from the e2e half of f54aaf2 (#18785) on main; the
product fix in that PR (shipping the save action in SessionInfo) is not
backported, so the "Save workspace image?" prompt this branch's sessions
can still raise stays a real possibility here.

closeProjectIfOpen waits on project.isActive() === false, and every wait
before it is satisfiable by the still-open project's console -- so a modal
the close itself raised lands there as a bare 30s waitForFunction timeout
with nothing naming the dialog. Read the visible dialog's text on timeout
and report it, carrying the original error as `cause`.

closeProjectIfOpen now returns whether dismissSaveWorkspacePrompt fired,
so a caller can assert on the prompt rather than have the sweep hide it.

* e2e: skip ai suites when the provider service is unreachable

Cherry-picked from c0f6bd8 (#18806) on main. Test-side only.

The AI gate proved the sandbox held credentials but never that the
provider could be reached, so an outage or blocked egress on the runner
failed inside the feature's own timeout instead of skipping. Probe each
provider's services from Node (utils/network.ts) as part of
requireAiCredentials, with the host list next to the provider table so
the gate, the beforeAll guard and the external-server check cannot
disagree. Under PW_AI_AUTH_STRICT an unreachable service fails instead.

For a network that degrades after the gate passed, aiServiceOutageReason
re-probes: code_suggestions turns a ghost-text or NES timeout into a
retroactive skip only when a host has since stopped answering, and
rethrows untouched otherwise. The Posit AI list includes the install
manifest on cdn.posit.co, since a timed-out manifest download leaves the
agent NotSignedIn and reads as a completion timeout.

beforeAll returns early without credentials, so the assistant setup does
not spend a minute on install prompts for tests beforeEach then skips.

* e2e: share the suggestion re-request and recover a lost bridge on open

Cherry-picked from the test-side half of 65abf11 (#18797) on main.
The two product fixes in that PR (EditorCommandManager binding load,
bounded Python discovery) are not backported, nor is the dev-launcher
GWT gating, which only affects local runs.

The re-requesting wait that #18789 gave ghost text is now
SourcePaneActions.waitForSuggestion, shared with the next-edit sites and
acceptNesRename: they still waited blindly on a provider that had already
answered "No completions available", which is terminal, so a declined
context burned the whole budget and reported as flake on every platform
at once. The re-request command has to match the kind of suggestion --
assistantRequestCompletions only asks for an at-cursor completion and its
fallback to a next-edit request is Copilot-only -- so the NES sites
re-ask through assistantAcceptNextEditSuggestion.

SourcePane.nesIndicator gives the four NES presentations one definition
in place of the or()-chain the specs each repeated.

openProject reloads once when the switched-to session never installs the
automation bridge. GWT's bootstrap has no retry, so a failed fetch of the
main cache.js leaves the window blank forever; a session that is merely
slow (bridge installed, ready still false) is left alone.

* e2e: wait for project session readiness before continuing

Cherry-picked from ff7bc1c (#18837) on main. Test-side only.

openProject's ready wait can be satisfied by the outgoing session, whose
deferred initialization completes during the switch; the incoming session
then publishes its project path before its own deferred initialization
has finished, so a helper that polls ready and the path separately can
return into a session that is still initializing. Observe both in one
predicate.

closeProjectIfOpen has the mirror problem: the project can already be
inactive while ready is still false, and returning in that interval lets
the next open race the previous session's initialization. Gate on ready
too, and move the console-idle check after it -- the earlier checks can
observe the outgoing session's console.

project-readiness.test.ts drives both helpers against a stubbed workbench
that separates project identity from deferred initialization the way a
desktop session switch does; both tests fail without the changes above.

This branch was previously deployed

1 inactive deployment
e2e-playwright — 6778ec38 Deployed Sep 14, 2026 by kevinushey via windows / e2e-desktop-windows (6) #997
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.

Custom Editor keybindings are sometimes not applied to the Console at startup

2 participants