Skip to content

Show Source Control for Folder Workspaces - #6432

Closed
brennanb2025 wants to merge 5 commits into
mainfrom
brennanb2025/kahawai
Closed

brennanb2025 wants to merge 5 commits into
mainfrom
brennanb2025/kahawai

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a Source Control activity to folder workspaces so a top-folder import can show one collapsible Source Control section per attached child worktree. Embedded child sections reuse the regular Source Control UI while scoping git status, file opens, history actions, and base-ref lookup/search to the child worktree and its repo host.

The implementation keeps hosted-review/create-review surfaces disabled in embedded child sections until those APIs can be safely host-scoped end to end. Base-ref changes from embedded sections are saved on the worktree, not the repo, to avoid duplicate repo-id ambiguity.

Design and implementation

  • Design doc scratch path: design-docs/multi-repo-folder-source-control.md.
  • Design review: delegated auto-design-review-fix completed READY.
  • Completeness verification: delegated pass completed; follow-up review findings were addressed.
  • Implementation adds FolderWorkspaceSourceControlPanel, bounded/tokenized child refresh scheduling, folder-workspace Source Control visibility, embedded SourceControl scoping, and host-aware base-ref IPC via repoPath + executionHostId.
  • Localization catalog entries were synced for the new folder Source Control strings.

Review

  • Iterative subagent code-review loop completed.
  • Final same-round reviewers: Lagrange and Planck both reported no actionable issues.
  • Earlier findings fixed included hosted-review host ambiguity, repo base-ref writes from embedded sections, stale refresh generations, queued refresh cleanup races, tokenized refresh reservations, duplicate repo labels, hook deps, and base-ref routing across duplicate repo ids/hosts/paths.

Validation

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/right-sidebar-titlebar-drag-regions.render.test.tsx src/renderer/src/components/right-sidebar/right-sidebar-activity-visibility.test.ts src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.test.tsx src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx src/renderer/src/components/right-sidebar/folder-workspace-source-control-refresh.test.ts src/main/ipc/repos-remote.test.ts - 6 files / 138 tests passed after the CI expectation fix.
  • pnpm run typecheck.
  • pnpm run lint.
  • git diff --check - clean aside from Windows CRLF warnings.
  • pnpm build:relay during Brennan validation.
  • Electron validation launched this exact worktree and verified identity: branch brennanb2025/kahawai, root C:\Users\neil\orca\workspaces\orca\kahawai.
  • Reproduced top-folder multi-repo import with disposable alpha-repo and beta-repo under a folder workspace.
  • Verified right-sidebar Source Control showed 2 attached worktrees, collapsible child sections, and each embedded Source Control section showed its own changed/untracked files.
  • Verified local base-ref IPC with repoPath + executionHostId returned the scoped child repo default.
  • Live SSH validation: intentionally not completed in this run. The validation environment had no Docker/Podman, WSL command execution failed with Wsl/Service/E_UNEXPECTED, and no disposable SSH target was configured. Brennan will run SSH validation separately before merge.

Screenshot evidence:

  • .context/multi-repo-source-control-validation-20260626/folder-source-control-initial.png
  • .context/multi-repo-source-control-validation-20260626/folder-source-control-both-expanded.png
  • .context/multi-repo-source-control-validation-20260626/folder-source-control-base-ref-picker.png

Cleanup

Validation cleanup removed the disposable child worktrees, folder workspace, project group, imported repos, temp repos/profile/worktree directories, and stopped the Electron process tree started for validation.

Post-PR stabilization

  • Waited 8 minutes after opening the PR, inspected CI and CodeRabbit.
  • Fixed the initial verify failure by updating the folder-workspace sidebar titlebar test expectation for the newly visible Source Control activity.
  • Pushed the fix, waited another 8 minutes, and verified verify passes.
  • Triggered CodeRabbit manually after its rate-limit notice with @coderabbitai review; CodeRabbit replied Review finished and did not leave actionable review comments.
  • Final PR checks are passing: verify and track-community-pr.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@brennanb2025, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 9 minutes and 27 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 250d8192-7b99-4ddd-980f-3041dc40817f

📥 Commits

Reviewing files that changed from the base of the PR and between e9c8ec5 and 24e6a92.

📒 Files selected for processing (4)
  • src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx
  • src/renderer/src/components/right-sidebar/SourceControl.tsx
  • src/renderer/src/components/right-sidebar/useGitHistoryCommitActions.ts
  • src/renderer/src/store/slices/editor.ts
📝 Walkthrough

Walkthrough

The base-ref lookup path now passes optional repo path and execution host context through the preload bridge, runtime client, and main IPC handlers. The right sidebar now routes folder workspaces to a dedicated source control panel, adds folder-workspace refresh scheduling, and updates embedded SourceControl behavior to use scoped worktree and connection state.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: Source Control support for folder workspaces.
Description check ✅ Passed The description is well-structured and covers summary, implementation, testing, screenshots, review notes, and validation details.
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.

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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.tsx (2)

92-157: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Redundant refreshCandidates in effect deps defeats the refreshCandidateSignature gate.

refreshCandidateSignature is computed to suppress unnecessary effect re-runs, but refreshCandidates (a fresh array reference whenever repos, childWorktrees, expandedWorktreeIds, or manualWorktreeIds change identity) is also listed in the dependency array and used in the body. Because the array identity changes even when the signature is unchanged (e.g. a repos store update that doesn't affect these worktrees), the effect re-runs, invalidates the in-flight generations, and restarts the limited refreshes — so the signature memo currently adds no value.

Consider reading the candidates from a ref keyed by the signature so the effect depends only on refreshCandidateSignature (plus the stable deps/setters).


36-38: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: refreshOutcomes is never pruned when worktrees detach.

Entries accumulate in refreshOutcomes for every worktree id ever seen and are not removed when a worktree leaves childWorktrees. isRefreshing already filters by currentChildWorktreeIds, so this is functionally harmless, but the map grows unbounded over a long session. Consider pruning to the current child ids alongside the expandedWorktreeIds cleanup effect.

Also applies to: 159-165

src/main/ipc/repos.ts (1)

2407-2419: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Type the search handler args as BaseRefSearchArgs for contract consistency.

getBaseRefDefault was updated to BaseRefRepoLookupArgs, but these two handlers still declare { repoId; query; limit? }. They forward args straight into searchBaseRefDetailsForRepo(store, args: BaseRefSearchArgs), so repoPath/executionHostId only survive because JS keeps extra object properties. The annotation hides the discriminators a caller now relies on; a future const { repoId, query, limit } = args rebuild would silently drop them and revert duplicate-repo-id lookups to the wrong host.

♻️ Align handler arg types
   ipcMain.handle(
     'repos:searchBaseRefs',
-    async (_event, args: { repoId: string; query: string; limit?: number }) => {
+    async (_event, args: BaseRefSearchArgs) => {
       return (await searchBaseRefDetailsForRepo(store, args)).map((entry) => entry.refName)
     }
   )

   ipcMain.handle(
     'repos:searchBaseRefDetails',
-    async (_event, args: { repoId: string; query: string; limit?: number }) => {
+    async (_event, args: BaseRefSearchArgs) => {
       return searchBaseRefDetailsForRepo(store, args)
     }
   )

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8ee1109d-49db-437f-b299-e88342e2924f

📥 Commits

Reviewing files that changed from the base of the PR and between 14a742e and e9c8ec5.

📒 Files selected for processing (25)
  • src/main/ipc/repos-remote.test.ts
  • src/main/ipc/repos.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.test.tsx
  • src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.tsx
  • src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx
  • src/renderer/src/components/right-sidebar/SourceControl.tsx
  • src/renderer/src/components/right-sidebar/activity-bar-buttons.tsx
  • src/renderer/src/components/right-sidebar/folder-workspace-source-control-refresh.test.ts
  • src/renderer/src/components/right-sidebar/folder-workspace-source-control-refresh.ts
  • src/renderer/src/components/right-sidebar/folder-workspace-source-control-section.tsx
  • src/renderer/src/components/right-sidebar/index.tsx
  • src/renderer/src/components/right-sidebar/right-sidebar-activity-visibility.test.ts
  • src/renderer/src/components/right-sidebar/right-sidebar-activity-visibility.ts
  • src/renderer/src/components/right-sidebar/right-sidebar-panel-content.tsx
  • src/renderer/src/components/right-sidebar/right-sidebar-titlebar-drag-regions.render.test.tsx
  • src/renderer/src/components/right-sidebar/useGitHistoryCommitActions.ts
  • src/renderer/src/components/settings/BaseRefPicker.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/runtime-repo-client.ts

@OrcaWin
OrcaWin marked this pull request as draft October 27, 2026 09:53
@OrcaWin

OrcaWin commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Moving this PR to draft because it has been untouched for more than 80 days (latest recorded PR activity or commit timestamp: 2026-06-27T01:10:38Z; checked on 2026-10-27). This keeps the review queue focused on active work while preserving the proposal. Please mark it ready for review when work resumes.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Superseded by #38831, which shipped Source Control for folder workspaces.

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