perf(git): resolve the git binary once via a cached git_program() - #253
Merged
Conversation
The daemon and CLI spawn `git` from several sites, each a bare
`Command::new("git")` that makes the OS re-walk PATH per spawn
(~100-300ms on Windows). Add `git::git_program()` which resolves the
git binary to an absolute path exactly once (OnceLock cache) and route
all product git-CLI spawn sites through it, so the long-running daemon
never re-walks PATH for git.
Resolution order: `GIT` env override -> which-style PATH lookup
(+ PATHEXT on Windows, hand-rolled, no new crate) -> literal "git"
fallback so behavior is never worse than today.
The gix-first read paths in branch.rs/worktree.rs are unchanged: they
still prefer in-process gix and only reach a git subprocess as a gated
fallback. Only that fallback and the one-shot spawn sites now exec the
cached path. Test-only spawn helpers are left untouched.
Converted sites: worktree.rs (git_command), branch.rs (x3),
config.rs (check-ignore), graph/git.rs (tokio churn), workflow.rs
(tokio diff), tracedecay/lifecycle.rs (git_output).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
This was referenced Jul 3, 2026
Merged
ScriptedAlchemy
added a commit
that referenced
this pull request
Jul 3, 2026
…255) `broker_cancels_partial_refresh_without_poisoning_warm_client` asserts that aborting a partial refresh does not poison the broker: a subsequent refresh must spin up a clean client. On a loaded macOS CI runner the recovery client's `python3` cold-start intermittently exceeds the 3s initialize floor, surfacing a transient "initialize timed out" — a slow start, not a poisoned broker — which failed the test on two consecutive unrelated PRs (#253, #254). Retry the recovery refresh a bounded number of times (5, 50ms apart), tolerating only the transient initialize-timeout error and still failing fast on any other error. The Ready/total_errors assertions are unchanged. Co-authored-by: Claude <noreply@anthropic.com>
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.
The daemon and CLI spawn
gitfrom ~13 sites, each a bareCommand::new("git")that re-walksPATHper spawn (a git spawn is ~100–300ms on Windows). This resolves the binary once, process-wide.Change
src/git.rs:git_program() -> &'static OsStr, cached in aOnceLock. Resolution order:GITenv override → hand-rolledPATHlookup (WindowsPATHEXT-aware) → literal"git"fallback (never worse than today). No new crate (whichisn't a dep).branch.rs,worktree.rs,config.rs,graph/git.rs,mcp/tools/handlers/workflow.rs,tracedecay/lifecycle.rs).Deliberately unchanged
The gix-first read paths (
current_branch/local_branch_exists,git_worktree_root/git_common_dir) still usegixin-process and only fall back togitbehind thegit_may_resolve_repopreflight — only which program the fallback execs changed. No caching of git results (staleness risk).Validation
fmt/clippy(
-D warnings)/build clean; branch/worktree/git lib tests 51 (incl. 2 newgit::testscovering stability +GIToverride); core_cli 189, graph 176, agent_suite 427 green.🤖 Generated with Claude Code