Remote: Reattach to (adopt) running kernel supervisors

Open
#17,653 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
backend, desktop

Research direction

Start by locating the remote connection and “Show Running Kernel Supervisors” command entry points; the issue does not name files or tests. Read how Positron currently starts or reconnects to a remote supervisor, then trace how supervisors report whether a window is attached. Done means detached supervisors can be offered for reattachment on startup and through the command, with the specified warnings and active sessions restored.

Written by the indexing model from the issue text.

Description

area: kallichore area: remote host

Thanks to recent improvements in technology, it's now possible to see an overview of all the running kernel supervisors on a machine, using Show Running Kernel Supervisors.

image

However, there is no direct way to reattach to a supervisor. The only tool we offer to return to the session is "open workspace", which ... should open a window that is associated with the supervisor, and cause the supervisor's sessions to be attached to it.

image

This only helps, however, if all the machinery binding the supervisor to the workspace is working correctly. Anecdotally, users have reported sessions getting orphaned, such that there really isn't any way to attach them to Positron again. You can see that they're running, but that's it.

Proposal

Offer a set of tools to help users load sessions into Positron if they become orphaned or simply don't fit the expected access lifecycle pattern.

On Startup

When Positron opens a connection to a remote host, and

... no supervisor is running => start a supervisor (current behavior)
... a supervisor is running for the current project => it connects to it (current behavior)
... a detached supervisor is running for a different project => a dialog appears offering to reopen the project
... multiple detached supervisors are running => a dialog appears with a list of projects in progress, with offers to rejoin any

Since we know whether the supervisor is attached to any window (there's a heartbeat), we can avoid stealing another window's supervisor; we only offer to rejoin supervisors that are not connected to other windows.

Adoption

The "Show running kernel supervisors" command should get a new option that will allow users to forcibly adopt orphaned supervisors.

This command:

  • shows a warning if adopting sessions from another project/workspace (usually better to open that workspace first)
  • shows an even bigger warning if adopting a supervisor that already appears to be connected to another window
  • shuts down the current supervisor, if any
  • attaches to the adopted supervisor as though it were its own and begins sending it its own heartbeats
  • opens consoles, notebooks, etc. corresponding to each session the supervisor has active
Dominant language
TypeScript
Stars
4.4k
Forks
207
Avg merge
1d 16h
Merged PRs (30d)
308

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from posit-dev/positron

All issues in posit-dev/positron

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.