Skip to content

Avoid refreshing every repository after deleting one worktree - #26253

Merged
nwparker merged 1 commit into
mainfrom
nwparker/perf-worktree-removal-auth-scope
Oct 8, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/perf-worktree-removal-auth-scope

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Deleting one worktree should make Orca refresh that repository’s authorized paths, rather than launch Git for every repository before the next file operation.

What Changed

The completed-removal cleanup now calls the existing repository-scoped authorization invalidator with its store and repository ID. It retires the changed owner’s paths and revision. The helper retains its global fallback when that ID has no unique local owner, including remote-only and duplicate-host entries.

Why

The deletion already knows which repository changed; its owner catalog does not change here. Reusing the helper already used by worktree creation avoids a new cache or authorization policy. Catalog/routing changes and orphan/folder removal keep their existing paths.

Seven alternating paired macOS trials exercised actual public removal, completed native Git deletion, and the next authorization for a surviving checkout:

Registered Git repositories Before After
1 35.25 ms 34.77 ms
8 40.44 ms 34.06 ms
24 60.71 ms 35.18 ms

At 24 repositories, authorization alone took 31.17 → 4.58 ms. Separately counted native authorization listings fell from 24 to one (eight to one in the eight-repository case). No claim about every action becoming faster or the intermittent Codex typing pause.

Linked Issue

No linked issue; maintainer performance audit.

Visual Proof

N/A — this changes authorization-cache refresh work after deletion; removal results, notifications and rendered interaction are unchanged.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Three existing public-removal regressions fail on baseline because invalidation receives no owner, then pass with this change: registered removal and forced/normal cleanup of an already-missing worktree. All seven selected suites pass: 1,384 tests, one existing skip; they include the complete runtime characterization, scoped invalidation, root ownership/refresh/WSL routing, and failed/interrupted removal recovery. Node typecheck, changed-code quality and formatting pass. The three regressions also pass on the Node runner; a fresh Electron build passes.

Temporary qualification used real owned Git repositories, actual cache/authorization code and public deletion, with an empty terminal/watcher/browser fixture and a constructor boundary for unrelated runtime owners. Thirteen control records cover unique/unknown/ambiguous/local/remote/folder owners and public folder/SSH-provider-fixture removal. Two additional controls hold real Git replies across public deletion: late affected-owner replies cannot restore the removed root, public file authorization still rejects it, and surviving files remain authorized. Complete results, metadata and callback/provider routing match. Untouched owner revisions remain valid under the existing scoped policy. All owned fixture directories were removed.

Native Linux/Windows/WSL and physical SSH transport were not exercised; remote routing controls use explicit providers. No Git command, remote wire, process-status or execution-host ownership change.

Review

Independent source review read the full removal callers, ownership resolver and existing cache/invalidation policy. A second review checked the final production and regression diff. No ordinary behavior tradeoff identified.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer source or artifacts copied.

Notes

Two production lines changed; no new cache, timer, IPC field or polling. Combined with all 35 audit changes: the seven affected suites / 1,384 tests pass (one existing skip), full pnpm tc passes, and the 109-file changed-code quality gate reports no new findings. All required selected hosted checks pass (15 successful checks; 15 unselected checks skipped).

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Visual proof is N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Relevant tests, typecheck, quality checks, format and build pass; all required selected hosted checks pass

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7d985a3-d899-4db1-8da4-23bac1d83f58
📥 Commits

Reviewing files that changed from the base of the PR and between 76d1b7b and 356716e.

📒 Files selected for processing (3)
  • src/main/runtime/orca-runtime-resolve-worktree-removal-target.ts
  • src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-03.spec.ts
  • src/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Worktree removal now invalidates authorized-root cache entries for the given store and repository. Tests for forced and normal missing-worktree cleanup and archive-hook removal check the scoped arguments.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 35671

Removal now avoids refreshing unrelated repositories while retaining broader invalidation when ownership is unclear. The inspected paths show no actionable merge risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
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.
Title check ✅ Passed The title clearly and concisely describes the main change: limiting repository refreshes after deleting one worktree.
Description check ✅ Passed The description covers the required sections, explains the change and rationale, documents testing and limitations, and marks the visual proof as not applicable. The missing linked issue is reasonably…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 8e22ad2 into main Oct 8, 2026
30 checks passed
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