From f83d73b6feb548fc262f2b07ff391c7061491e79 Mon Sep 17 00:00:00 2001 From: Josh Gratton Date: Mon, 11 May 2026 09:35:41 -0400 Subject: [PATCH] fix(server): fall back to direct fd read on EACCES bootstrap Stdin pipes inherited across the wsl.exe boundary fail to re-open via /proc/self/fd/0, so add EACCES to the codes that drop back to reading the fd directly. Without this the WSL desktop backend fails to load its bootstrap envelope with "Failed to duplicate bootstrap fd" and ends up in a scheduled-restart loop. --- apps/server/src/bootstrap.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/server/src/bootstrap.ts b/apps/server/src/bootstrap.ts index 9ad6328798..f6df92b822 100644 --- a/apps/server/src/bootstrap.ts +++ b/apps/server/src/bootstrap.ts @@ -160,9 +160,12 @@ const makeDirectBootstrapStream = (fd: number): Readable => { } }; +// Stdin pipes inherited across the wsl.exe boundary report EACCES when we try +// to re-open them via /proc/self/fd/0 — fall back to reading the fd directly +// in that case, the same way we already do for ENXIO/EINVAL/EPERM. const isBootstrapFdPathDuplicationError = Predicate.compose( Predicate.hasProperty("code"), - (_) => _.code === "ENXIO" || _.code === "EINVAL" || _.code === "EPERM", + (_) => _.code === "ENXIO" || _.code === "EINVAL" || _.code === "EPERM" || _.code === "EACCES", ); export function resolveFdPath(