Repository navigation
Description
Two shards of the same CI run (30472858712, on PR #18390) were killed by the heartbeat watchdog with the identical signature -- 300 seconds of total output silence -- in the same test neighborhood (the tests/projects/ serial region), on two different platforms and modes:
windows / e2e-desktop-windows (4) (job)
17:25:44 ok 132 [desktop-windows] > tests\projects\project_editor_theme.test.ts:199:7 > ... project without EditorTheme keeps global theme (20.2s)
17:30:44 ##[error]run-with-heartbeat: no output for 300s -- treating the run as hung and terminating it.
The hang began inside (or entering) the file's third test, project_editor_theme.test.ts:255 "project EditorTheme is not applied when project appearance settings are ignored". That test passed on linux-server the same day in ~31s.
linux-server / e2e-server-ubuntu (2) (job)
17:28:29 ok 255 [server-linux] > tests/projects/project_editor_theme.test.ts:255:7 > ... (passed)
17:28:48 ok 256 [server-linux] > tests/projects/project_trust_dialog.test.ts:329:7 > No trust dialog when no project is open @server_only @serial (12.3s)
17:29:00 Project created at: /tmp/workdir_45692ac203bb/trust_test_project
17:34:00 ##[error]run-with-heartbeat: no output for 300s -- treating the run as hung and terminating it.
17:34:30 ##[error]Process completed with exit code 124.
The Project created at: line is project_trust_dialog.test.ts:364, inside "Trust dialog appears and "Don't Trust" enables restricted mode" (:358) -- so createProjectViaUI and getWorkingDir succeeded, and the wedge is somewhere in the subsequent writeRprofile / restartRExpectingDialog stretch, before any of the bounded dialog-visibility probes.
Why this is a runner-level wedge, not a slow test
The suite's per-test timeout is 120s (playwright.config.ts). A hang inside a test body produces a Playwright timeout failure -- output -- at 120s, and the run continues. 300s of zero output means the worker process wedged hard enough that the reporter emitted nothing: neither shard ever printed a test-timeout failure for the test it died in.
Notes
- The two hangs are in different tests (
project_editor_theme.test.ts:255on Windows desktop;project_trust_dialog.test.ts:358on Linux server). The trust-dialog suite is@server_only, so the Windows hang cannot involve that file at all. What they share is thetests/projects/serial region, project create/open/restart traffic, and the total-silence failure mode. - Unrelated to treat an empty PW_RSTUDIO_R_LIBS_USER as unset #18390's change on that run: Windows passes a real
PW_RSTUDIO_R_LIBS_USERpath and Linux Server never sets the variable (its log shows the harness-default library, fully populated, at 17:00). - The watchdog kill (exit 124) takes the entire remaining shard with it, so a single wedge costs ~35 minutes and every not-yet-run test on the shard.
- Both jobs uploaded their artifacts after the kill, so blob reports/traces from the killed shards should be available on the run for triage.
Activity
kevinushey commentedon Jul 30, 2026
Root-caused far enough to act. Summary of findings from the July occurrences (annotation sweep of all failed runs), the pw-sandbox/test-results artifacts of two killed shards (linux-desktop run 30580373239, windows run 30472858712), and a code trace of the shutdown/relaunch paths.
Occurrences
Every hit is in the
tests/projectsserial region, at a project open/close/switch (= session restart):project_trust_dialog:358project_editor_theme:255) + linux-server shard 2 (project_trust_dialog:358)createAndOpenProject(GlobalOverride)createAndOpenProject(ProjectId)project_id:101project_id:101(A 7/06 Fedora pair with the same exit code was a different thing entirely: >300s of silence while compiling R packages from source during the
[r-libs]setup phase.)Why 300s of total silence (proven)
The killed linux-desktop shard's
test-resultsartifact contains anerror-context.mdfor the wedged test with BOTHTest timeout of 120000ms exceededandTest timeout of 120000ms exceeded while running "afterEach" hook. So Playwright's 120s timeout fired (silently), then the afterEach safety net hung against the dead session for another 120s, then fixture teardown kept going. The reporter only prints a result once the test fully finalizes, so the 300s heartbeat always wins, kills the shard, and the blob report is never written. Not a reporter bug -- just a consequence of hung teardown.What is actually wedging
The wedged workers (and only those) were running the Posit Assistant chat backend + NES agent in every session:
positai.login both sandboxes shows the backend starting with each session restart, then at the wedge moment:Received shutdown request from rsession->Shutdown reason: close, grace period: 1000ms->RStudio session services disposing-> end of log. (The backend's shutdown handler callsprocess.exit(0)before its final log line and has a 900ms force-exit backstop, so an abruptly-ending log is expected even for a healthy backend exit -- the backend is probably NOT the stuck process.).Rproj.userand no new rsession ever logs anything: the replacement session was never launched.exitevent (session-launcher.ts:721), and a project switch uses a fresh port. For the relaunch never to happen, rsession itself must never have exited.connect()succeeds (kernel backlog),SessionUnavailablerecovery never fires, no new session is launched, and the proxied request has no deadline (ServerSessionProxy.cpp).Every wait in rsession's shutdown sequence is nominally bounded (
stopAgentSync<= 10s inSessionAssistant.cpp:615, the 1s grace loop inSessionChat.cpp:6388, 1s supervisor wait inSessionMain.cpp:1480) -- EXCEPT that the assistant/chat wait loops pumpmodule_context::onBackgroundProcessing(false)andr::session::event_loop::processEvents()on every iteration. That dispatches the full background machine (supervisor poll, file monitor, every module's background handler, scheduled commands, arbitrary R callbacks) in the middle of teardown. Any blocking item in those queues wedges the loop forever, silently (all progress logging on these paths is DLOG). This is the only unbounded path, and it is only reachable when an agent/backend is running at shutdown -- which matches the trigger timeline below.Why it started when it did
positsince Jan 2026;detachSessionspawn since Nov 2023). What changed is that CI started exercising it:--grep-invert @aifrom the E2E workflow callers, and Add Playwright auth setup project for Posit AI credentials #17680 landed the Playwright auth setup for Posit AI credentials. From then on, the chat tests run in PR CI, and settling the install prompt installs the pai backend into that worker's data-home. Sinceassistant/chat_providerdefault toposit, every subsequent session restart in that worker starts the backend + agent -- including all of thetests/projectsregion if it lands on the same shard after the chat tests.Fixes in flight
@chat/@aisuites, so unrelated tests stop restarting sessions with a live agent (also removes ~2 agent start/stop cycles of overhead per restart).processSupervisor().poll()(all they need to observe the reap) instead of the full background-processing machine + R event loop.core::system::terminateProcessis SIGTERM-only, andterminateAllChildProcessesis off by default in the session).workbenchInitializedis stale-true and suppresses the launch error page (session-launcher.ts:458); reset it when relaunching.Worth a follow-up look (not in this PR): the server session proxy never sets a request deadline, and the local-stream acceptor lacks
FD_CLOEXEC(an orphan inheriting it can starve session relaunch indefinitely); the Windows acceptor handle is similarly inheritable (bInheritHandles = TRUEwith noSetHandleInformationon the acceptor).session: pin the supervisor-poll semantics the shutdown waits rely on
e2e: select the chat provider explicitly in suites that open the chat…
fix session shutdown wedge with an active posit assistant (#18417)
kevinushey commentedon Aug 12, 2026
Update 2026-08-12: the wedge is still occurring after #18417 (merged Aug 4), now confined to linux-server. Fresh sweep of the PR-triggered e2e workflow (~150 runs):
project_trust_dialog:358, after project createproject_editor_theme:255project_editor_theme:255project_trust_dialog:358, after project createproject_trust_dialog:358, after project createproject_trust_dialog:358, after project createproject_trust_dialog:358, after project createproject_editor_theme:255project_editor_theme:90project_editor_theme:255(both)Reading of the table:
Agent process exited with status 143, keytar errors) in that worker's sessions right up to minutes before the wedge.rserver.log's mtime freezes at exactly the hang start. So the remaining server wedge either bypasses the assistant stop-waits that fix session shutdown wedge with an active posit assistant #18417 bounded, or is a different blocking point in the same shutdown/relaunch window. The July follow-ups (no deadline on the proxied session request; the local-stream acceptor lackingFD_CLOEXEC) remain open and are still the mechanism by which a not-yet-exited session black-holes the client indefinitely.From the one artifact the kill leaves behind (
error-context.mdon 31547344591): the test hit its 120s timeout andTearing down "perTestReset" exceeded the test timeout-- the teardown's first step is an unboundedpage.evaluate(drainClientExceptions), so once the page is stuck on the never-answered navigation, setup/teardown stages silently stack past the 300s heartbeat and the shard dies with no blob report, no trace (trace: 'off'), and no attachments.Harness mitigations going up in a PR shortly:
PW_RSTUDIO_SERVER_URLserver shares prefs across workers, and that path stays excluded). This removes the remaining wedge trigger from the projects region on the affected shard.page.url()distinguishes a never-committing navigation from a frozen renderer; a CDP screenshot; both attached to the failing test). A wedge then becomes one fast, well-diagnosed test failure -- Playwright restarts the worker and the rest of the shard survives with its report intact, instead of a heartbeat SIGKILL taking the whole shard.e2e: fail fast with diagnostics when a session transition wedges the …
Don't prompt to save the workspace right after a session restart (#18785