Repository navigation
Fix two e2e test bugs and report why an RStudio launch failed - #18740
Merged
gtritchie merged 8 commits intoSep 8, 2026
Merged
Conversation
The "Run examples" link this test clicks is emitted by R, not RStudio.
tools::Rd2HTML writes it only when `dynamic && enhancedHTML && !Rhtml &&
!is.null(firstAlias)`, and enhancedHTML is part of the enhanced HTML help
introduced in R 4.2.0 ("Changes in R 4.2.0" in R's NEWS: "The HTML help
system has several new features... can be disabled by setting
_R_HELP_ENABLE_ENHANCED_HTML_ to a false value").
On older R the link never renders, so RStudio's interception in
SessionHelp.cpp is unreachable from the help pane and the test has nothing
to exercise. It failed both attempts on the macOS 14 arm64 certification
cell -- the only cell on R 4.1.3 -- while passing on every cell with R
4.2.3 or newer. The captured page snapshot there showed classic-style help
with an Examples section and no link, so the fixture package had installed
correctly.
Probe the version in beforeAll and skip rather than build and install the
fixture package for a test that cannot run.
Verified against the installed 2026.09.0+174 desktop build on R 4.6.1: the
test still runs and passes (1.4s), and with the threshold temporarily
raised above the local version it reports as skipped instead of failing,
with the package install skipped too.
The test never called test.setTimeout, so it fell back to the 120s global budget in playwright.config.ts while its own assistant-turn poll asks for 300s -- it could only ever use 40% of the budget it declares, and a slow turn surfaced as a bare "Test timeout exceeded" rather than the poll's diagnostic. beforeAll already opts up to 300s for the package install; the test body was the gap. The 120s cap was the binding constraint, not the work. Across the cells that ran this test in the 2026.09.0+174 certification run, whole-test durations were 90s (rocky-10-arm64, macos14), 96s (macos26, ubuntu-24 desktop, fedora43), 102s (debian-13-arm64, ubuntu-24 server, rocky9-x86_64) and 108s (fedora44-arm64) -- nine cells packed into the last quarter of the budget -- and ubuntu-26-arm64 went over it. Name the poll's budget and derive the test timeout from it, matching chat-guardrails.test.ts (inner budget + 60s) and restart-under-agent.test.ts (120s * cycles). The 120s margin covers conversation setup plus the 90s of post-poll Viewer assertions (30s iframe + 30s title + 10s slider + 4 * 5s buttons), so the poll still expires first and reports its own error. Verified: tsc --noEmit clean, and the spec collects cleanly. The new budget itself is not exercised locally -- requireAiCredentials skips the test without Posit AI credentials.
The #18522 class of failure -- RStudio stops becoming reachable over CDP partway through a shard and every later launch fails the same way -- has stayed unexplained partly because the fixture could not describe what the process it spawned actually did. Two gaps did that: - A signal death was discarded. The exit handler only flagged `code !== null && code !== 0`, because `code === null` is also what our own killProcessTree produces. But killProcessTree only runs after we have already decided to fail, so before CDP is up a signal death is external (OOM killer, segfault) -- and it read as a 30s connect timeout instead. - Child output was thrown away. `stdio` is only set in dev mode, so on the installed-binary CI path Electron's stdout/stderr went to pipes nobody read. Beyond losing the only account of a pre-CDP death, an unread pipe stops the child once it fills (~64KB on Linux). Track whether CDP came up, treat a pre-CDP signal death as the launch failure it is, and drain both streams into a bounded 4KB tail. On failure, report the child's state (exited with code / killed by signal / still running), whether anything holds the CDP port, and that tail. Before, from the 2026.09.0+174 certification run on ubuntu-26-arm64: Failed to connect to CDP at http://127.0.0.1:10076 within 30000ms: browserType.connectOverCDP: connect ECONNREFUSED 127.0.0.1:10076 After, from a local launch redirected at a stub that writes to stderr and then SIGKILLs itself: RStudio process (...) was killed by SIGKILL before CDP became reachable [launch-state] process was killed by SIGKILL; nothing was listening on the CDP port [launch-output] last 79 char(s) of stdout/stderr: fake RStudio: about to be killed GPU process exited unexpectedly: exit_code=139 That case also now fails in 1ms rather than waiting out the full 30s. The reporting lives in its own module so it can be tested without the RStudio binary; tests/harness/launch-diagnostics.test.ts pins the three process states apart, the tail's bound and tail-ness, and uncaptured output against a child that wrote nothing, using real child processes. This makes the failure diagnosable; it does not claim to fix its cause. Verified: tsc --noEmit clean; the 6 harness tests pass; real launches unaffected (help and sandbox specs still pass, sandbox in 5.2s).
The previous commit raised this test's assistant-turn budget to 300s, which is exactly the default idle window of the no-output watchdog in scripts/run-with-heartbeat.mjs (PW_HEARTBEAT_TIMEOUT_SECONDS, default 300). pollWithAllowDialogs only logs when it acts on a dialog, so a stuck turn is silent -- and at 300s the watchdog would terminate the whole shard rather than this one test failing with the poll's own diagnostic. Five of the six e2e engines run on that default; only os-test-e2e-rstudio-desktop-linux.yml sets the variable. Before the previous commit the exposure did not exist, because the 120s global timeout capped silence well under the window. 240s keeps the budget over twice the observed turn time (whole-test durations were 90-108s across the cells that ran it) while leaving 60s of clearance, and the comment records why it cannot simply be raised again. Verified: tsc --noEmit clean. The test still skips locally for want of Posit AI credentials, so the budget itself is exercised only in CI.
Node documents 'exit' as firing while the child's stdio streams may still be
open -- 'close' is the event that means they are done. The launch diagnostics
read the tail straight off the 'exit'-driven launchError, so a fatal message
written on the way out could be dropped, or reported as "wrote nothing",
which is the opposite of what the diagnostic is for.
captureOutputTail now returns { text(), settled() }. settled() resolves once
both streams end, bounded (500ms) because a stream that errors may never end,
and short-circuits for a child that is still running or whose streams have
already ended -- so the CDP-timeout path is not padded. Both launch-failure
sites await it before describing the state.
Honest scope note: I could not reproduce the race on macOS. A probe writing
12B, 8KB, 200KB and 2MB to stderr and exiting had all output delivered before
'exit' in every case, so there is no regression test for the race itself --
the fix follows the documented contract rather than an observed failure. The
new harness test instead pins settled()'s one deterministic property, that a
live child short-circuits rather than burning the bounded wait, which would
otherwise add 500ms to every CDP-timeout failure.
Verified: tsc --noEmit clean; 7 harness tests pass; real launches unaffected
(sandbox spec passes in 6.2s).
The 60s of clearance between the 240s turn budget and the 300s watchdog window assumed the watchdog timer had just been reset when the poll began. It counts from the last output, not from poll start, so any silent setup between the previous log line and the poll ate into that margin. Log the wait before polling. The watchdog resets on any child output, so the remaining silence is now bounded by the poll itself and the margin is exact rather than a guess. The line also says what a long silence is waiting for. Verified: tsc --noEmit clean. Still skipped locally without Posit AI credentials.
a2111a0 shipped settled() with no test for the behavior it exists for. I had tried and removed one: a spawned child that writes and exits delivers all its output before 'exit' on macOS at 12B, 8KB, 200KB and 2MB, so the test passed with settled() disabled and proved nothing. Driving it with streams we control makes it deterministic. A PassThrough pair plus a pre-set exitCode stands in for a child that has gone but whose streams have not ended; the test asserts settled() is still pending at that point, then that ending the streams both resolves it and yields the trailing output. Confirmed it fails ("Expected: false, Received: true") with settled()'s wait short-circuited, and passes with it. captureOutputTail's parameter narrows to the four members it touches, matching describeLaunchState's existing Pick style, so the fake needs no cast. Real ChildProcess still satisfies it. Verified: tsc --noEmit clean; 8 harness tests pass; sandbox spec passes (5.2s).
The test ended both streams back-to-back, so it would still have passed if settled() resolved on the first 'end' rather than when both had ended -- a blind spot in a test whose only job is to be effective. End stdout alone, await its 'end' event, and assert settled() is still pending before the marker goes through stderr. Awaiting the event rather than sleeping keeps it deterministic: captureOutputTail's listener is attached first, so the implementation has already processed that end by the time the test's own listener resolves. Checked against both mutations, each failing with "Expected: false, Received: true" and passing on the real implementation: - dropping the `=== 0` guard, so any single 'end' resolves settled() - short-circuiting settled()'s wait entirely Verified: tsc --noEmit clean; 8 harness tests pass; sandbox spec passes (6.2s).
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 8, 2026 21:40 — with
GitHub Actions
Inactive
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 |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test-suite fixes from the 2026.09.0+174 certification run
(34260015710).
Test-only; no product code changes, so no NEWS entry.
Guard the help "Run examples" test on R >= 4.2.0. The link it asserts is
emitted by R (
tools::Rd2HTMLenhanced HTML help, new in 4.2.0), not byRStudio, so the test can never pass on the macOS 14 cell's R 4.1.3. It now
skips there with a reason.
Give
shiny-app-ra timeout that clears its own turn budget.test.setTimeoutwas set inbeforeAllonly, so the body ran under the 120sglobal while its poll asked for 300s. Budget is now 240s with a 360s test
timeout, kept below the 300s no-output watchdog in
run-with-heartbeat.mjs,and the poll logs once before it waits so the watchdog timer resets at a
known point.
Report why a launch failed instead of a bare
ECONNREFUSED. Addressese2e Windows shard consumes the full job timeout when every RStudio launch fails instead of failing fast #18522. A signal death before CDP is up is no longer treated as normal
teardown, and the child's stdout/stderr are drained instead of discarded.
Both failure paths now print a
[launch-state]line (exit code / signal /still-running PID, plus the CDP port owner) and a
[launch-output]tail.The logic sits in
fixtures/launch-diagnostics.tswith unit coverage intests/harness/launch-diagnostics.test.ts, so it runs without the RStudiobinary. This does not fix e2e Windows shard consumes the full job timeout when every RStudio launch fails instead of failing fast #18522; it makes the next occurrence readable.