Skip to content

perf: take the login shell's PATH off the launch path - #85

Merged
IAmJSD merged 1 commit into
mainfrom
perf/async-shell-path
Aug 30, 2026
Merged

IAmJSD merged 1 commit into
mainfrom
perf/async-shell-path

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Aug 30, 2026

Copy link
Copy Markdown
Member

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.

Claude-Session: https://claude.ai/code/session_012FgdQwG9FfmLWtpRvC7VWP

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
@IAmJSD
IAmJSD merged commit f891f57 into main Aug 30, 2026
0 of 3 checks passed
@IAmJSD
IAmJSD deleted the perf/async-shell-path branch August 30, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant