Skip to content

Avoid 'dancing consoles' at startup#12563

Open
jmcphers wants to merge 3 commits intomainfrom
bugfix/dancing-consoles
Open

Avoid 'dancing consoles' at startup#12563
jmcphers wants to merge 3 commits intomainfrom
bugfix/dancing-consoles

Conversation

@jmcphers
Copy link
Collaborator

@jmcphers jmcphers commented Mar 17, 2026

This PR makes Positron startup much calmer when multiple affiliated runtimes exist. The changes are pretty simple:

  • When firing events that indicate that a runtime will start, note whether we plan to activate the runtime at startup, and use that in the Console to decide whether to flip to the "Preparing" state for the runtime.
  • Don't make every session that starts the foreground session; only do this if the session is marked for activation.
  • When selectLanguageRuntime is called during startup, do not allow it to override the runtime selection process that happens at startup. (The Python extension does this.)

With these changes, you will also notice fewer unwanted Pythons starting in R environments. Since these changes make it possible for the Python console to go completely unused (never focused) in a Positron session, the dormant logic that switches off unused languages can come back into play.

There is a big caveat here, however, which is that the Python extension is still aggressively starting Python in workspaces that don't want or need it. Depending on the timing, this can negate much of the benefits of the above changes; once startup is complete from Positron's perspective, it allows the Python extension to start a new Python if it wants to, and this will focus the new Python session and establish an affiliation. I didn't try to tackle this problem since it is scheduled for work soon in #12116.

Addresses #10929.

Release Notes

New Features

  • N/A

Bug Fixes

QA Notes

This change specifically addresses startup issues for workspaces that have affiliated runtimes (that is, we know ahead of time which to start). If you observe problematic behavior, use the Runtime Startup Diagnostics report. If you see this, you should have a "calm" startup:

Runtime Name Mode State Start Reason Created
Python 3.12.10 (Pyenv) Python 3.12.10 (Pyenv) console idle Affiliated Python runtime for workspace 11:23:14 AM
R 4.5.0 R 4.5.0 console idle Affiliated R runtime for workspace 11:23:14 AM

If you see Python starting due to "extension requested" activation, then you may still experience some dancing at startup.

Test tags: @:console @:sessions

@github-actions
Copy link

github-actions bot commented Mar 17, 2026

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

readme  valid tags

@jmcphers jmcphers requested a review from juliasilge March 17, 2026 18:31
Copy link
Contributor

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

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

This improves the experience when you have multiple affiliated runtimes A LOT. 🙌

With these changes and 3 affiliated runtimes, I don't see them grabbing focus from each other as they come online.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants