Skip to content

perf(workspace): cancel local worktree scans - #10107

Merged
nwparker merged 1 commit into
mainfrom
nwparker/perf-space-git-cancellation-wsl
Jul 24, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/perf-space-git-cancellation-wsl

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Description

  • Forward Workspace Space cancellation into each local worktree-list Git process.
  • Resolve local project Git routing before Space and cleanup worktree discovery so WSL projects use
    their selected distro instead of host Git.
  • Preserve the existing folder and SSH branches, two-repository Space concurrency, cleanup timeout,
    and Git command behavior.
  • Add deterministic two-repository cancellation and WSL option-forwarding coverage.

ELI5

When a Space scan was cancelled, the screen stopped waiting but up to two Git helpers could keep
running for 30 seconds. Orca now tells those helpers to stop too. On Windows, it also sends Space and
cleanup Git work to the WSL distro selected for that project instead of accidentally asking Windows
Git to inspect the Linux checkout.

Proof of zero regression

  • Three independent final reviews—correctness, performance, and platform/SSH—found no issues.
  • Full suite: 3,264 files and 34,746 tests passed; 7 files and 57 tests skipped by the existing suite.
  • Related superset: 131/131 tests passed, including real Git-runner and Windows process-tree
    cancellation coverage.
  • Full Node/CLI/web TypeScript check passed.
  • Touched-file oxlint and oxfmt, max-lines ratchet, localization coverage, and git diff --check
    passed.
  • Native local behavior is unchanged apart from receiving cancellation. Folder and SSH branches
    return before local runtime resolution. Cleanup still uses its existing 8-second timeout and error
    text. Space still scans at most two repositories concurrently. No Git command or Git 2.25
    compatibility behavior changed.
  • Full pnpm run lint reaches the unrelated released orca-cli revision-9 manifest blocker; direct
    localization catalog verification finds only pre-existing keys missing from three unrelated
    renderer files. This diff changes no skill or renderer/localization files.

Proof of performance improvement

  • Before: Space did not forward cancellation, so two in-flight local worktree-list Git children could
    remain alive until the 30,000 ms command timeout.
  • After: two real hanging Git subprocesses sharing the scan signal both rejected with AbortError
    and both process IDs disappeared within 50.983 ms of cancellation.
  • The deterministic Space test proves both concurrently started listings receive and observe the same
    abort. Repository concurrency remains 2.
  • Runtime-routing lookup overhead measured 0.079 ms for 100 repositories/projects and 3.461 ms for
    1,000—negligible beside Git process startup.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a0311b8f-23c1-4242-ba4e-85807cd7defd

📥 Commits

Reviewing files that changed from the base of the PR and between c445f26 and 7a458c2.

📒 Files selected for processing (5)
  • src/main/ipc/workspace-cleanup-local-git-routing.test.ts
  • src/main/ipc/workspace-cleanup-scan.ts
  • src/main/ipc/workspace-cleanup.test.ts
  • src/main/workspace-space-analysis.test.ts
  • src/main/workspace-space-analysis.ts

📝 Walkthrough

Walkthrough

Workspace cleanup and workspace space analysis now pass Store context into local worktree discovery. Both flows use getLocalProjectWorktreeGitOptions to configure listRepoWorktrees, while retaining scan timeout or cancellation signals. Tests add mocks for the Git-option provider and verify WSL distro forwarding, cleanup timeout signal propagation, and abortion of in-flight space scan worktree listings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change, but it misses required template sections like Screenshots, Testing, AI Review Report, Security Audit, and Notes. Add the missing template sections, especially testing details, AI review report, security audit, screenshots or no-visual-change note, and notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: canceling local worktree scans.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit d95eae5 into main Jul 24, 2026
2 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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