Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide predictable startup ordering #5959

Merged
merged 33 commits into from
Jan 13, 2025
Merged

Conversation

jmcphers
Copy link
Collaborator

This change eliminates the disorienting startup experience that can occur when multiple affiliated runtimes exist (or multiple sessions are running).

Prior to the change, every runtime start or reconnect resulted in the new session taking over the Console and Variables panes and becoming the active session. Practically speaking this meant that startup often showed some flickering as different sessions booted and Positron switched between them on its own, and the session you wound up with when startup was finished might not be the one you wanted or expected.

After the change, sessions and affiliated runtimes are ordered, and only one console session gets to become active. The other sessions are still started -- they just start in the background. The result is (hopefully) a calmer startup experience.

Right now, there is no explicit ordering -- we just go by whichever one was last used. So if you were using Python when you exited, that's what you should see when you open Positron again; same deal with R.

The implementation works as follows:

  • plumb an activate flag everywhere we deal with session start events to keep track of whether the session should be focused/activated after it starts
  • remember the last used time for both sessions (for reconnect/reload) and affiliations (for new windows)
  • start/reconnect to sessions in descending order of last use (i.e. most recent first)
  • at startup, only flag sessions to activate if they are the most recently used

Addresses #1044 and part of #1143.

Release Notes

New Features

Bug Fixes

  • N/A

QA Notes

  • Both affiliations (for new windows) and sessions (for reloading existing windows) should be checked.
  • For a runtime to become the "last used runtime", you generally need to make a gesture that you want to use the runtime, such as switching to it in the Console or running some code in the Console

jmcphers and others added 30 commits January 6, 2025 08:50
Co-authored-by: sharon <[email protected]>
Signed-off-by: Jonathan <[email protected]>
@jmcphers jmcphers requested a review from timtmok January 10, 2025 23:59
Copy link

github-actions bot commented Jan 10, 2025

E2E Tests 🚀  ?
This PR will run tests tagged with: @critical

@jmcphers jmcphers marked this pull request as draft January 11, 2025 00:29
@jmcphers jmcphers marked this pull request as ready for review January 13, 2025 15:53
*
* Returns a promise that resolves to the session ID of the new session.
*/
startNewRuntimeSession(runtimeId: string,
sessionName: string,
sessionMode: LanguageRuntimeSessionMode,
notebookUri: URI | undefined,
source: string): Promise<string>;
source: string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a duplicate from a merge?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting that, the history of this branch is a little wonky because it was split off from the persistence work due to overlaps! Addressed now.

@timtmok
Copy link
Contributor

timtmok commented Jan 13, 2025

This is a feature that I didn't realize that I wanted!

@jmcphers jmcphers requested a review from timtmok January 13, 2025 18:43
Copy link
Contributor

@timtmok timtmok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jmcphers jmcphers merged commit b0ba2b3 into main Jan 13, 2025
12 of 14 checks passed
@jmcphers jmcphers deleted the feature/runtime-startup-ordering branch January 13, 2025 20:15
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants