Resolve conflicts from upstream's Effect-service normalization batch while
preserving the WSL parallel-backend feature set.
Key resolutions:
- ipc/methods/window.ts: adopt the DesktopIpc.makeIpcMethod /
DesktopIpc.makeSyncIpcMethod namespace convention; keep our plural
getLocalEnvironmentBootstraps and the getLocalEnvironmentBearerToken
method.
- app/DesktopState.ts: adopt upstream's Context.Service class with
backendReady + quitting. The window keeps its own backendReadyRef, so
state.backendReady is unused but harmless.
- app/DesktopObservability.ts: keep our per-instance
DesktopBackendOutputLogFactory (per-instance backend logs are required
for parallel backends). Drop upstream's newly-extracted single-instance
DesktopBackendOutputLog.ts: zero consumers in this tree, fully
superseded by the factory (primary maps to forInstance(primary), same
server-child.log path).
- backend/DesktopBackendManager.test.ts: keep our factory-based harness.
Upstream's side provisioned the removed DesktopBackendManager.layer
service model (DesktopState / DesktopWindow / DesktopBackendConfiguration
deps), which no longer exists in this tree.
- Adapt DesktopObservability.ts + ipc/methods/wsl.test.ts to upstream's
removal of the standalone DesktopEnvironmentShape export: use
DesktopEnvironment.DesktopEnvironment["Service"] (the normalized form).
Verified: web + desktop typecheck clean; affected desktop tests pass
(DesktopObservability, DesktopBackendPool, DesktopBackendManager, wsl).
Brings in upstream's desktop-auth to Clerk-bridge migration (#3092) plus 9 other
commits. Resolution preserves the WSL parallel-backends work while adopting the
new primary-auth flow.
Contracts / IPC: keep our plural getLocalEnvironmentBootstraps; add upstream's
new getLocalEnvironmentBearerToken (primary bearer token) across the bridge,
preload, and the IPC channel / method / handlers.
Desktop:
- DesktopLocalEnvironmentAuth (upstream's new primary-auth service) now reads the
primary instance from our DesktopBackendPool instead of the removed legacy
DesktopBackendManager.
- main.ts composes both our WSL backend layer and the new local-environment-auth
and Clerk layers.
- DesktopWindow adopts upstream's local-client window loading (getDesktopUrl /
t3:// scheme) rather than loading the backend URL, dropping the now-obsolete
backend-URL plumbing. The "Connecting to WSL" splash is kept, re-pointed onto
the existing backend-ready latch (upstream's DesktopState.backendReady addition
did not land in this merge; the backend pool drives readiness through
handleBackendReady / handleBackendNotReady).
Web: keep our Layer.effect platform source (primary plus WSL secondaries); the
primary now authenticates via upstream's primaryEnvironmentHttpLayer and the
secondaries via FetchHttpClient.
Verified: typecheck (web, desktop), web tests (connection / provider /
authBootstrap / desktopAuth), desktop tests (DesktopWindow splash,
DesktopLocalEnvironmentAuth), and lint all pass.
Re-integrates the WSL parallel-backends renderer onto upstream's rewritten
connection/RPC architecture (#2978), which deleted the saved-env / environmentApi
/ serverState / wsConnectionState subsystem this branch was built on.
Core (packages/client-runtime/connection):
- Add dynamic platform-managed bearer environments: a PlatformConnectionRegistration
union (Primary|Bearer) and registry.reconcilePlatform(set), which adds/removes
platform-managed environments as the host topology changes and stashes the bearer
credential. This models the dual-mode WSL secondary (separate loopback origin,
bearer auth, dynamic port so it is rederived rather than persisted). The primary
and the WSL-only primary keep the same-origin cookie path.
Web platform source (apps/web/src/connection/platform.ts):
- Emit the platform set from the plural getLocalEnvironmentBootstraps() IPC: the
primary (cookie) plus each WSL backend (bearer via bootstrap-token exchange),
polling and reconciling on toggle. Replaces the deleted 541-line reconciler.
Renderer re-home:
- Drop the old subsystem (environmentApi, rpc/serverState, rpc/wsConnectionState,
environments/runtime/*, environments/local/*) and their tests.
- Re-home the Sidebar cold-boot indicator, the ConnectionsSettings WSL picker, and
the multi-environment provider-update feature onto the new hooks (useEnvironments,
serverEnvironment.updateProvider, the primaryServer* atoms). Desktop-local
environments are identified by a BearerConnectionTarget with a "local:"
connection id.
- Drop the inert swap-suppression surface superseded by parallel backends.
Verified: typecheck (web, desktop, client-runtime), connection / provider /
localApi / authBootstrap tests, and lint all pass.
Resolve scripts/build-desktop-artifact.ts: keep both our WSL node-pty
prebuild staging (decodeNodePtyManifest) and upstream's fff native binary
staging (encodeStageWorkspaceConfig / DESKTOP_ASAR_UNPACK), and collapse
the duplicated asarUnpack key the merge left behind into a single entry
that unpacks the fff native binaries, the server bundle, and the full
node_modules tree.
The build matrix gated every entry on build_wsl_node_pty succeeding, but only
the Windows artifact consumes the Linux node-pty prebuild, so a failed prebuild
would skip the macOS and Linux builds too. Gate the build job on preflight and
relay only (via !cancelled() instead of !failure()); build_wsl_node_pty stays in
needs for ordering and the Windows-only download step fails just that platform
when the prebuild is missing.
In packaged builds the server bundle and node-pty were sealed inside app.asar,
which the WSL backend's Linux Node cannot read, so the WSL backend never started
in release builds. It dead-ended on a misleading "node-pty not prepared / run
prepare:wsl" error. node-pty also publishes no Linux prebuilt, and the Windows
artifact is built on a Windows CI runner that cannot compile one.
- asarUnpack the server bundle and node-pty, and point the WSL backend at the
app.asar.unpacked sibling. The Windows primary still reads app.asar via
ELECTRON_RUN_AS_NODE, so it is unaffected and there is no payload duplication.
- Build the Linux pty.node in a dedicated Linux CI job and hand it to the
Windows packaging job as an artifact. build-desktop-artifact stages it into
node-pty/prebuilds/linux-<arch>/ with a marker, so the packaged app ships a
ready binary and needs no compiler, node-gyp, or network on first launch.
- node-pty is N-API, so one Linux binary works across all WSL Node versions;
drop the modules ABI comparison from the preflight probe accordingly.
- Runtime compile is now dev-only (allowBuild: !isPackaged). In packaged builds
a prebuilt that cannot load surfaces a clear arch/distro diagnostic instead of
nagging for build tools or silently compiling.
- Restrict release workflow defaults to read-only access
- Grant `id-token` only to the publish job
- Document safe handling for `pull_request_target` in PR size checks