Skip to content

Commit 8dc3e6f

Browse files
fix(desktop): let the server hydrate PATH when the shell env cache misses
installIntoProcess reported the shell environment as prepared even on a cache miss, before anything reached process.env. The server then skipped its own PATH hydration and probed providers with the bare launcher PATH, reporting login-shell-only CLIs as missing for the session. Yield true only when a cached environment was applied. Discovery still runs in the background in both cases, so startup stays non-blocking. Fixes #28714 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 18f5fa5 commit 8dc3e6f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/desktop/src/shell/DesktopShellEnvironment.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ export class DesktopShellEnvironmentCommandTimeoutError extends Schema.TaggedErr
7575
export class DesktopShellEnvironment extends Context.Service<
7676
DesktopShellEnvironment,
7777
{
78-
// Desktop owns discovery, including on cache misses; the backend receives updates over fd4.
78+
// Yields true only when a cached environment was applied; on a miss the backend hydrates
79+
// PATH itself until desktop discovery arrives over fd4.
7980
readonly installIntoProcess: Effect.Effect<boolean>;
8081
readonly awaitDiscovery: Effect.Effect<boolean>;
8182
readonly updates: Stream.Stream<DesktopShellEnvironmentSnapshot>;
@@ -622,7 +623,8 @@ export const make = Effect.gen(function* () {
622623
const cache = yield* fileSystem
623624
.readFileString(cachePath)
624625
.pipe(Effect.flatMap(decodeCache), Effect.option);
625-
if (Option.isSome(cache) && cache.value.key === key) {
626+
const hit = Option.isSome(cache) && cache.value.key === key;
627+
if (hit) {
626628
const cached = Object.fromEntries(
627629
CACHED_ENV_NAMES.flatMap((name) => {
628630
const value = cache.value.environment[name];
@@ -648,7 +650,7 @@ export const make = Effect.gen(function* () {
648650
);
649651
}
650652
yield* Effect.forkIn(refresh, scope);
651-
return true;
653+
return hit;
652654
}).pipe(Effect.withSpan("desktop.shellEnvironment.installIntoProcess")),
653655
);
654656
const updates = Stream.unwrap(

0 commit comments

Comments
 (0)