Repository navigation
perf: take the login shell's PATH off the launch path - #85
Merged
Merged
Conversation
Asking the login shell for its PATH is a whole shell startup — 0.75s on a real dotfile setup — and every Finder launch since #84 has waited out that shell before the window was created, because the answer was published with `set_var` and that is only sound before other threads exist. The probe moves to its own thread and stops touching the process environment. Its answer is published through a mutex/condvar and handed to each spawn explicitly: `path::current()` never waits and is what `Backend::available` and the picker read, `path::resolved()` waits (five seconds for the shell, six for a caller) and is only ever called from a worker thread about to spawn a CLI. Both SDKs are given an absolute `cli_path`/`command` plus a PATH override for the children they spawn in turn, so nothing depends on the app's own environment any more — which also spares the Claude SDK its discovery pass, a `claude --version` spawn on every connect. Availability computed while the probe is still out can say a CLI is missing when it is merely off launchd's PATH, so the workspace watches for the answer and redoes it, refreshing the model catalogs if the panel is open. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012FgdQwG9FfmLWtpRvC7VWP
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.
Asking the login shell for its PATH is a whole shell startup — 0.75s on a real dotfile setup — and every Finder launch since #84 has waited out that shell before the window was created, because the answer was published with
set_varand that is only sound before other threads exist.The probe moves to its own thread and stops touching the process environment. Its answer is published through a mutex/condvar and handed to each spawn explicitly:
path::current()never waits and is whatBackend::availableand the picker read,path::resolved()waits (five seconds for the shell, six for a caller) and is only ever called from a worker thread about to spawn a CLI. Both SDKs are given an absolutecli_path/commandplus a PATH override for the children they spawn in turn, so nothing depends on the app's own environment any more — which also spares the Claude SDK its discovery pass, aclaude --versionspawn on every connect.Availability computed while the probe is still out can say a CLI is missing when it is merely off launchd's PATH, so the workspace watches for the answer and redoes it, refreshing the model catalogs if the panel is open.
Claude-Session: https://claude.ai/code/session_012FgdQwG9FfmLWtpRvC7VWP