Skip to content

Reduce duplicate worktree refresh scans - #6390

Merged
OrcaWin merged 2 commits into
mainfrom
brennanb2025/burden-worktree-refresh
Jun 26, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
brennanb2025/burden-worktree-refresh

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reduces duplicate worktree refresh scans by coalescing concurrent detected-worktree refreshes for the same repo, execution host, runtime target, and refresh mode. Each caller still performs its own state merge after the shared scan resolves, so existing visible/detected worktree semantics remain local to the caller.

A follow-up verification pass found and fixed an SSH overlap edge: fetchDetectedWorktrees now uses the same host-scoped merge/stamp path as visible refreshes so a detected-only refresh cannot clobber SSH/runtime host identity when it overlaps fetchWorktrees.

Design and Review

  • Design approach: add a module-local in-flight promise map keyed by repo id, execution host id, local/runtime target, and best-effort vs authoritative mode.
  • Design review outcome: reviewed against the requested duplicate-scan fix, retry behavior, state merge semantics, SSH/runtime separation, and cross-platform constraints; no product-scope drift found.
  • Implementation notes: routed fetchDetectedWorktrees, fetchWorktrees, and both fetchAllWorktrees paths through the coalesced scanner. Added focused regression coverage for same-host coalescing, detected/visible overlap, authoritative separation, same-repo/different-host separation, and SSH host identity preservation in both detected/visible overlap orders.
  • Completeness verification: implementation matches the design doc requirements and edge cases after the SSH overlap follow-up.
  • Code review loop: two orchestration review subagents completed clean after the follow-up fix; both reported no actionable findings. Residual risk noted by both: duplicate repo IDs that share the same lower-level list API key remain a pre-existing sharp edge, not introduced by this patch.
  • Brennan test result: land. Store-level behavior is covered by focused unit tests plus static gates; no visible UI/layout changed.
  • Post-PR stabilization: CodeRabbit code review reported no actionable code comments; PR-body template warning addressed below. Follow-up PR checks are running.

Screenshots

Not applicable; this is renderer store/runtime refresh behavior and does not change visible UI or layout.

Security Audit

  • Input handling: no new user-provided input is parsed; the coalescing key uses existing repo id, execution host id, runtime target, and refresh mode values.
  • Paths: no path parsing or path separator assumptions were added.
  • IPC/RPC: no new IPC/RPC methods or permissions were added; existing local/runtime detected worktree calls are only de-duplicated while in flight.
  • Auth/SSH: SSH-owned repos stay routed through local desktop/SSH settings, and tests cover host identity preservation during overlapping refreshes.
  • Dependencies: no new dependencies.
  • Failure behavior: in-flight entries are removed in finally, so failed refreshes are not cached or reused after settlement.

Tests

  • pnpm vitest run --config config/vitest.config.ts src/renderer/src/store/slices/worktrees.test.ts (160 tests)
  • pnpm run typecheck
  • pnpm run lint (passes; emits an existing warning in src/renderer/src/components/right-sidebar/useGitStatusPolling.ts)
  • git diff --check
  • Post-PR checks after initial PR: track-community-pr and verify passed.

Notes

  • Initial install required pnpm install --frozen-lockfile; optional cpu-features native build could not find a Visual Studio toolchain, but repo postinstall skipped/recovered optional native modules and install exited successfully.
  • Live SSH/Electron validation was not run because the changed behavior is covered at the store refresh boundary and does not add UI controls or new SSH transport behavior. A manual SSH smoke of overlapping refreshes would still be useful final confidence evidence if available.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The worktree store adds a keyed in-flight promise map and a coalesced helper for detected worktree refreshes. fetchDetectedWorktrees, fetchWorktrees, and both fetchAllWorktrees paths now use that helper. The test suite adds coverage for concurrent same-repo refreshes, overlapping detected and worktree refreshes, authoritative versus non-authoritative refreshes, and separate execution-host refreshes.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: reducing duplicate worktree refresh 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.
Description check ✅ Passed The PR description covers summary, screenshots, testing, security, and notes, and includes review details despite minor template-heading mismatches.
✨ 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.

@OrcaWin
OrcaWin merged commit 156134e into main Jun 26, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Reduce duplicate worktree refresh scans

* Preserve host identity during overlapping worktree refreshes

---------

Co-authored-by: Neil <[email protected]>
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.

3 participants