Supervisor: Windows That Connect Before the Handshake Completes Start Their Own Supervisor
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python, typescript
Research direction
Start with server-main.ts, which the issue identifies as setting POSITRON_SUPERVISOR_HANDSHAKE_SOCKET after the pre-warmed kcserver reports in; trace how windows and extension hosts start during that interval. The issue suggests waiting for the pre-warm to settle, but notes that publishing the path early breaks the broker's first-connection behavior. Done when windows use the same supervisor after both successful and failed pre-warm startup, and the reproduction no longer leaves the active session uncounted.
Written by the indexing model from the issue text.
Description
System details:
Positron and OS details:
Positron dev build at 2b039bb54f, server (web) mode, MacOS. kcserver 0.1.78.
Session details:
Python 3.12.8
Describe the issue:
In server mode, server-main.ts only sets POSITRON_SUPERVISOR_HANDSHAKE_SOCKET once the pre-warmed kcserver reports in, but the server is already accepting windows by then. A window whose extension host starts in that gap doesn't get the variable, so it launches its own per-window supervisor while the pre-warmed one sits unused.
This matters for Posit Workbench, since the Workbench session agent reads the same variable to poll kcserver's /status for idle detection (rstudio/rstudio-workbench-vscode-ext#544). Depending on when the agent's terminal is created, it either gets no poller at all, or (worse) it gets the variable and polls the pre-warmed kcserver, which has no sessions. In that second case busy kernels are never counted as activity and nothing is logged, so Workbench can kill a session mid-computation.
Before #14773 the connection file variable was set before kcserver was spawned, so the window/supervisor mismatch couldn't happen.
The natural window is small (I measured ~40-70ms between "Web UI available" and "handshake complete"), so this needs a slow kcserver start (cold container, AV, loaded host). I could only reproduce it by delaying kcserver.
Steps to reproduce the issue:
- Delay the pre-warm kcserver spawn in
server-main.tsby ~8s (I used aNODE_OPTIONS=--importpreload that wraps the spawn insleep 8) - Start the server and open a window as soon as "Web UI available" prints
- Extension host env has no
POSITRON_SUPERVISOR_HANDSHAKE_SOCKET; two kcserver processes are running - Start a Python console and run
import time; time.sleep(30) - Read the handshake socket from a terminal created after "handshake complete" and query that kcserver's
/status:sessions=0 busy=falsefor the whole sleep
Expected or desired behavior:
Every window should end up on the same supervisor that POSITRON_SUPERVISOR_HANDSHAKE_SOCKET points to. Perhaps extension host startup (or window connections) could wait for the pre-warm to settle, success or failure? Publishing the path earlier doesn't work since the broker treats its first connection as kcserver's report-in.
Were there any error messages in the UI, Output panel, or Developer Tools console?
No. The extension host just starts its own supervisor.
Related: #15896
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 207
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 308
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from posit-dev/positron
-
area: assistant area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
accessibility area: plots area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: plots area: ui bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: kernels lang: r
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
posit-dev/positron#17575 · 2 comments ·
Maintainers usually reply within 1 day
-
Memory meter counts page cache as used memory under a cgroup limitPossibly taken @jmcphers claimed this 10 days ago. Openarea: workbench bug memory-use support
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
posit-dev/positron#17414 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in posit-dev/positron
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Vessel9817/onion-site-template#512 ·
Maintainers usually reply within 1 day
-
nightly-tests
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
Maintainers usually reply within 1 day
-
approved
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
fritzprix/libr-agent#3266 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
better-auth/better-auth#13101 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day