Repository navigation
fix grey-screen dead-end when set_user_state fails during bootstrap - #18031
Conversation
The workbench bootstrap in Application.java chains initializeWorkbench() behind UserState.writeState() and UserPrefs.writeUserPrefs(). UserState's onError only logged the error and never invoked the completion continuation, so a transient set_user_state RPC failure (e.g. ERR_CONNECTION_FAILED during startup) silently dead-ended bootstrap: initializeWorkbench() never ran and the user was left with an unrecoverable grey screen, and the prefs layers stayed in the incomplete "loaded without sessionInfo" state. Make UserState.writeState's onError invoke onCompleted.execute(false), matching UserPrefs.writeUserPrefs, so the chain continues and the workbench is built (and the prefs layers refreshed) even when the RPC fails. As defense-in-depth, also guard the index-based pref accessors in Prefs.java (getGlobalValue, getProjectValue, setGlobalValue, etc.) against not-yet- populated layers via a layerValues() helper, so reading a pref before the layers are fully populated falls back to the default instead of throwing a TypeError on an undefined layer. Addresses #18019
🍎 macOS Desktop E2E · ARM64❌ 1 test(s) failed
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · macos-26 ARM64 · commit |
🪟 Windows Desktop E2E · Server 2025 x64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · Windows Server 2025 x64 · commit |
Code review findingsActionable items from an automated multi-agent review. Strengths, dismissed findings, and ratings are omitted. Important
Suggestions
|
- Prefs.java: log a warning instead of silently dropping setGlobalValue/ setProjectValue writes when the target layer is absent; narrow the layerValues() comment to the fixed-index positional accessors it covers - Application.java: document the deliberate proceed-on-RPC-failure during workbench bootstrap - SessionInfo.java: getUserStateLayer() now measures and indexes the same array (user_state, not user_prefs); clamp all three layer accessors to the last valid index so an incomplete layer array falls back to the last layer instead of indexing past the end and throwing - PrefsTests.java: cover the missing-layer (null slot) branch and the remove* accessors; reference UserPrefsAccessor.LAYER_* instead of 3/4
|
Thanks for the thorough review. Addressed in d31075b (also merged latest 1 / 3 ( 2 (silent dropped writes) -- 4 (bootstrap ignores the completion boolean) -- added a comment documenting the deliberate proceed-on-failure: a transient persistence failure must not dead-end startup, and the RPC error is already logged. Kept it silent rather than adding a user-facing notification (separate UX call). 5 / 6 (test coverage + magic numbers) -- added a partially-populated fixture (null user/project slots) that exercises the 7 (
|
Summary
On RStudio Desktop, a transient
set_user_stateRPC failure during workbench bootstrap could leave the user with an unrecoverable grey screen (title/menu bars present, empty grey content), with no retry or error UI. See #18019 for the full analysis.The bootstrap in
Application.javachainsinitializeWorkbench()behindUserState.writeState()and thenUserPrefs.writeUserPrefs().UserState.writeState'sonErroronly logged the error and never invoked the completion continuation, unlike the analogousUserPrefs.writeUserPrefs. So whenset_user_statefailed at the TCP level (ERR_CONNECTION_FAILED):initializeWorkbench()never built or painted the IDE (permanent grey screen); andwriteUserPrefs()never ran, so its leadingupdatePrefs(getPrefs())never refreshed the pref layers, leaving them in the incomplete "loaded without sessionInfo" state. That in turn caused a secondaryCannot read properties of undefined (reading 'values')TypeError on quit, when index-based pref accessors dereferenced a not-yet-populated layer.Changes
UserState.writeState: invokeonCompleted.execute(false)inonError, mirroringUserPrefs.writeUserPrefs, so bootstrap continues (and the pref layers get refreshed) even when the RPC fails.Prefs.java(defense-in-depth): route the index-based accessors (getGlobalValue,getProjectValue,setGlobalValue,removeGlobalValue,hasProjectValue,setProjectValue,removeProjectValue) through a newlayerValues()helper that returnsnullfor an absent layer, so reading a pref before the layers are fully populated falls back to the default instead of throwing.PrefsTestscovering the incomplete-layers accessor behavior.Testing
ant javacandant unittestpass (507 tests).Addresses #18019