Repository navigation
Don't prompt to save the workspace right after a session restart - #18785
Merged
Merged
Conversation
A quit, project close, or project switch issued shortly after a session
restart prompted "Save workspace image to <path>/.RData?" even with
save_workspace set to never.
The client learned the save action only from the asynchronous
save_action_changed event, defaulting to "ask" until one arrived, and the
session published its own kSaveActionAsk placeholder at client init --
s_lastSaveAction was only recomputed by the first detect-changes pass. So
every session emitted {action: -1} followed by {action: 0}, and a close
issued before that batch reached the client used "ask".
Report the action in SessionInfo, which client_init delivers before the
workbench is interactive, and compute it in onClientInit so the event
carries the real value too. The client now falls back to the reported
action and only prompts when the session has told it nothing.
For an interactive user this was one dismissible prompt, but unattended
automation cannot answer the modal, so the close never completed -- which
is how this surfaced, as a 30s timeout in restart-under-agent.test.ts
waiting on project.isActive() === false.
Also name the blocking dialog when closeProjectIfOpen times out, instead
of reporting a bare waitForFunction timeout.
Addresses #18784.
The new test's header cited #18394, the session-shutdown wedge that restart-under-agent.test.ts guards, rather than #18784, the save-action race this test actually covers. In closeProjectIfOpen, test the dialog text after normalizing it: a visible but textless modal made the untrimmed string truthy, so the failure reported an empty dialog name and discarded the original TimeoutError. It now falls through to that error, and the informative case carries it as `cause`.
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:40 — with
GitHub Actions
Inactive
gtritchie
had a problem deploying
to
e2e-playwright
September 11, 2026 17:40 — with
GitHub Actions
Failure
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:45 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:45 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:50 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:50 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:56 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:56 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:56 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:56 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:56 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 17:56 — with
GitHub Actions
Inactive
RStudio E2E - all platforms1 test(s) failed
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 |
…ion-at-session-init
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 22:17 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 22:17 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 22:21 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 22:21 — with
GitHub Actions
Inactive
…ion-at-session-init
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:38 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:38 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:42 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:42 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:46 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:46 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:55 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:55 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:55 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:55 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:55 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 11, 2026 23:55 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 16:44 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 16:44 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 16:45 — with
GitHub Actions
Inactive
gtritchie
had a problem deploying
to
e2e-playwright
September 13, 2026 16:45 — with
GitHub Actions
Failure
closeProjectIfOpen sweeps the "Save workspace image?" prompt away before waiting on project.isActive(), so the regression test passed whether or not the prompt was shown. It now returns whether the sweep fired, and the test asserts false. Rewrite the dismissSaveWorkspacePrompt doc comment: it described the pre-fix saveAction_ race as current behaviour. Addresses #18784 Claude-Session: https://claude.ai/code/session_01NBtWFu2jK5pnFUk2aLw3rw
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:01 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:01 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:05 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:05 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:09 — with
GitHub Actions
Inactive
gtritchie
had a problem deploying
to
e2e-playwright
September 13, 2026 18:09 — with
GitHub Actions
Failure
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:15 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:15 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:15 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:15 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:15 — with
GitHub Actions
Inactive
gtritchie
temporarily deployed
to
e2e-playwright
September 13, 2026 18:15 — with
GitHub Actions
Inactive
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
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.
Intent
Fixes #18784.
A quit, project close, or project switch issued shortly after a session restart prompted "Save workspace image to
<path>/.RData?" even withsave_workspaceset tonever.The client learned the save action only from the asynchronous
save_action_changedevent, andApplicationQuit.saveAction_was initialized toSaveAction.saveAsk()until one arrived. The action was not part ofSessionInfo, so there was nothing else to fall back on. On the session side,s_lastSaveActionstarts atkSaveActionAskandonClientInitpublished that placeholder as-is; only the firstonDetectChangespass recomputed it. Every session therefore emittedsave_action_changed {action: -1}followed by{action: 0}, and a close issued before that batch reached the client used "ask".Approach
SessionInfonow carriessave_action, whichclient_initdelivers before the workbench is interactive, andonClientInitcomputes the action before publishing so the event carries the real value too. Both read one function,modules::dirty::saveAction(), so the two channels cannot disagree.On the client,
saveAction_starts null and is read through asaveAction()accessor that falls back to the valueclient_initreported. "Ask" is now used only when the session has reported nothing at all.Impact
For an interactive user this was one dismissible prompt, and every path that reaches it is user-initiated (quit, restart/update RStudio, switch R version, new project, close project, switch projects) -- nothing background can trigger it. A secondary effect was silent rather than dismissible: inside the same window, Restart R derived
saveChangesfromSAVEASK != NOSAVE, so a restart could write.RDatawithsave_workspaceset tonever.Unattended automation cannot answer the modal, so the close never completed. That is how this surfaced:
e2e/rstudio/tests/panes/posit-assistant-chat/restart-under-agent.test.tstimed out after 30s waiting onwindow.rstudio.project.isActive() === falsewhile the prompt sat unanswered, on six consecutive Windows runs of the Posit Assistant release gate.This is not a regression.
saveAction_ = SaveAction.saveAsk()dates to 2011 (4993b7e7e3d) ands_lastSaveAction = kSaveActionAskto 2013 (57a301581a1), and both are present unchanged onrel-autumn-hawkbit. What changed was the delivery time of the first event batch, not RStudio.Verification
Added
e2e/rstudio/tests/projects/close_project_after_open.test.ts, which opens a project and closes it with no console command in between, so nothing forces the R-side detect-changes pass. It assertssave_workspaceisneverfirst, so it cannot pass vacuously underask, and asserts thatcloseProjectIfOpendid not have to dismiss the save prompt -- that helper sweeps the prompt away for the other project tests, so without this assertion a regression would go unnoticed. It is untagged, so it runs in normal PR CI rather than only in the release gate.Verified on a Windows dev desktop build:
client_initreportssave_action=0, across the project open and the following close.save_action_changedevents emitted are{action: 0}; the-1placeholder is gone. Pre-fix CI payloads show-1then0in every session.tests/projects/passes in full (24 passed).The sub-second window depends on a loaded CI worker, so the original failure was not reproducible locally; the checks above verify the mechanism instead. Final confirmation is a gate run.
closeProjectIfOpenalso now names the modal blocking a close instead of reporting a barewaitForFunctiontimeout.Follow-up
DesktopHooks.getSaveAction()has the same event-only staleness, but it is exported to JS and uncalled -- a Qt-desktop leftover. Left alone here rather than deleting an exported symbol.