Fix slow kernel startup on Windows with antivirus software#14773
Open
jmcphers wants to merge 4 commits into
Open
Fix slow kernel startup on Windows with antivirus software#14773jmcphers wants to merge 4 commits into
jmcphers wants to merge 4 commits into
Conversation
|
E2E Tests 🚀 |
samclark2015
approved these changes
Jul 9, 2026
samclark2015
left a comment
Contributor
There was a problem hiding this comment.
LGTM!
Manually verified:
- Launched Positron against Kallichore paired PR
- Ensured the new handshake socket route was used
- Ensured sessions persisted across relaunches of Positron
- Ensured new handshake path worked also on a server build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13388
Summary
The goal of this change is primarily to address some pathological slow-boot problems observed in Windows corporate environments with aggressive AV software. It also increases the security and performance of the kernel supervisor subsystem for everyone.
To do this, it replaces the connection-file handshake between Positron and the Kallichore kernel supervisor (kcserver) with a same-user-locked handshake socket, eliminating the temp file entirely.
Previously, Positron picked a temp path, launched kcserver with
--connection-file <path>, and polled the filesystem until kcserver wrote the connection details (transport, address, bearer token) there. On Windows with aggressive antivirus, the freshly-written file could be invisible to Positron for up to ~32s while it was held for scanning, and the bearer token -- which gates an API that runs arbitrary code as the launching user -- sat on disk protected only by file permissions.This inverts the handoff. Positron now creates and listens on a handshake socket (Unix domain socket / Windows named pipe) first, launches kcserver with
--handshake-socket <path>, and kcserver connects once and writes a single JSON payload (the sameKallichoreServerStateshape as the old connection file), then closes. No file at rest for AV to scan, no polling race, and the token travels over an OS-protected same-user socket instead of disk.Two launch paths are handled:
extensions/positron-supervisor/src/HandshakeSocket.ts).src/server-supervisor-handshake.tsacts as an in-memory broker -- it receives kcserver's payload, caches it, and re-serves it to each window's extension host over the socket. Only the socket path crosses the env boundary (POSITRON_SUPERVISOR_HANDSHAKE_SOCKET, renamed fromPOSITRON_SUPERVISOR_CONNECTION_FILE); the token stays in memory.Note
This represents a breaking change in the way that we connect to Kallichore and requires the accompanying Kallichore PR for testing. Build posit-dev/kallichore#73 alongside this change for testing.
Release Notes
New Features
Bug Fixes
Validation Steps
This change is on the critical path for every kernel session, so the existing e2e suite exercises it end to end on each run across platforms. No new user-visible behavior is introduced; the coverage story is unit tests for the new helper + broker, plus the existing suite as cross-platform regression coverage.
Unit tests:
npm run test-extension -- -l positron-supervisor --grep HandshakeSocket(desktop path)npx vitest run src/server-supervisor-handshake.vitest.ts(server broker)E2e regression (existing tags -- supervisor startup is implicit in all of these):
@:console @:sessions @:interpreter
Manual checks worth doing before merge, since they're hard to assert in CI:
kallichore-*.jsonconnection file is created in the temp dir during startup.