perf: reduce shell and worktree discovery process churn - #1762
Merged
Conversation
- Resolve the selected local shell lazily instead of scanning the full shell inventory - Cache shell validation and version probes with fingerprint-based invalidation and single-flight execution - Invalidate cached shell results after process spawn failures - Cache successful Node.js availability probes and refresh them during explicit source discovery - Add coverage for cache reuse, invalidation, failure retries, and concurrent probes
- Cache repository-scoped worktree topology with metadata-based refresh, request coalescing, and explicit invalidation. - Avoid redundant Git queries during workspace activity tracking and reuse resolved worktree metadata across consumers. - Reject worktree creation in unborn repositories, exclude managed worktree directories, and resolve new checkouts directly. - Distinguish worktree creation failures from workspace opening failures in the frontend. - Add coverage for topology caching, invalidation, worktree creation, and error reporting. - Add a Windows process-event probe for diagnosing BitFun child process activity.
wsp1911
marked this pull request as ready for review
July 25, 2026 14:47
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.
Summary
Type and Areas
Type:
Performance / bug fix / test
Areas:
Rust core, terminal services, Git services, workspace services, desktop/Tauri, web UI, diagnostics
Motivation / Impact
Shell discovery, Node.js availability checks, and Git worktree topology queries could repeatedly create short-lived processes on Windows. This added unnecessary startup overhead and process noise during agent commands and workspace activity.
This PR makes shell and Node discovery lazy and reusable, coalesces concurrent probes, and invalidates cached results when the runtime changes or a process fails to spawn.
Worktree topology is now cached by the common Git directory with metadata-based freshness checks and explicit invalidation after mutations. Routine dialog activity only updates workspace activity timestamps instead of reloading Git metadata.
Worktree creation now rejects repositories without an initial commit before creating
.worktrees, excludes the managed directory from Git tracking, resolves the newly created checkout directly, and distinguishes creation failures from workspace-opening failures in the UI.Verification
Manual Windows checks:
echo 123andlswith Git Bash, PowerShell 7, and Windows PowerShell..worktrees.scripts/diagnostics/probe-bitfun-process-events.ps1to capture process start/stop events and verify BitFun process lineage.Coverage added for:
Reviewer Notes
Checklist