Repository navigation
Conversation
… hosts Projects merge across hosts, project groups did not. Two hosts whose folder scans produced same-named groups rendered two identical headers, one of which held every project row and the other nothing at all — an unfoldable empty row with no way to tell the two apart. Fold the per-host copies of a group into one row, matched on the chain of names up to the root, and bucket repos and folder workspaces through that merged identity. The local copy owns the row when there is one, so the collapse key and menu actions stay on the host the user is sitting at. Fixes stablyai#22022
4e49260 to
821ae87
Compare
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. 📝 WalkthroughWalkthroughThe sidebar now merges project-group copies across hosts by normalized name and parent-chain identity. It assigns collision-safe row IDs when hosts reuse group IDs. Repository, folder-workspace, search, and reveal paths use host-scoped lookups and merged row IDs. Tests cover cross-host rendering, duplicate IDs, hierarchy, cycles, lookup resolution, and navigation. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to When project-group metadata is temporarily unavailable for one host, its repository can be hidden or shown under another host's group. Use a collision-safe unresolved key before merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the user impact, mechanism, rationale, scope, linked issue, testing, and checklist status. However, the required visual proof for this UI behavior change is not attached; the text only says screenshots will be added. Resolution Attach before-and-after screenshots or a video from the paired-host setup, then mark the visual proof checklist item as complete. If visual proof cannot be provided, use 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 24d4a322-7b5d-451f-b72e-7491fc3bbfbf
📥 Commits
Reviewing files that changed from the base of the PR and between 4aaa6c7 and 821ae871463d28446f3f9403e3a4fae9b505de33.
📒 Files selected for processing (4)
src/renderer/src/components/sidebar/worktree-list-groups-project-groups.test.tssrc/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.test.tssrc/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.tssrc/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Important
The sidebar fix itself is sound, but two things should be settled before merge: the branch carries nine unrelated commits (~3.7k added lines across the skills and emulator subsystems) that would land under a fix(sidebar) title, and the merged header key diverges from the collapse/reveal/palette key helpers for rows owned by the non-primary host copy.
Reviewed changes
Reviewed the full branch diff (48 files, 10 commits) against main.
- Cross-host project-group merge — new
cross-host-project-group-merge.tsfolds same-identity group copies from different hosts into oneMergedProjectGroup(primary = the local copy, else the oldest bycreatedAt/id);project-group-sections.tsresolves repo and folder-workspace buckets, child parents, and the header/collapse key through that primary. - Tests — merge unit tests plus an end-to-end
buildRowscase that reproduces the duplicateproject-group:remote-groupheader from #22022. - Skills port (unrelated to the title) — ports
brainstorming,debug,delivery,review,tdd,verifyfrom agent-deck, adds stubs/guides, regeneratesresources/skills/*, and gives the orchestration coordinator a context lifecycle. - Emulator (unrelated to the title) — adds
serve-sim-simulatorkit-link.tsto symlinkSimulatorKit.frameworkfrom the installed Xcode.
⚠️ Nine unrelated commits ride along with the sidebar fix
The branch is 10 commits ahead of main; only 4e492608d2 is the sidebar fix. The other nine are a separate skills port and an emulator change, all authored the same day on a base that already carried them. Merging this PR as-is lands all of it under a fix(sidebar) title, and the "small and focused" checklist box does not reflect the actual diff. If these were meant to be separate, rebase the sidebar commit onto main (or retarget the PR base at the branch that owns the other work).
Technical details
# Unrelated commits in the PR range
## Affected sites
- `skill-guides/*`, `skill-stubs/*`, `skills/*/SKILL.md`, `resources/skills/current-manifest.json`,
`resources/skills/snapshot-registry.json`, `config/scripts/*skill-guidance*.mjs`,
`config/scripts/generate-bundled-skill-guides.mjs` — skills port, ~45 files.
- `src/main/emulator/serve-sim-simulatorkit-link.ts` and
`src/main/emulator/serve-sim-simulatorkit-link.test.ts` — new Xcode SimulatorKit linking.
- `src/cli/bundled-skill-guides.ts` — regenerated bundled guides.
## Required outcome
- The PR should contain only the sidebar fix, or its title/body/checklist should
describe the full scope.
## Suggested approach
- Rebase `fix/merge-cross-host-project-groups` onto current `main` keeping only
`4e492608d2`, or split the other nine commits into their own PR(s).ℹ️ Same-host duplicate names now merge
Because the merge identity is the name chain and ignores the host, two groups on the same host that share a name and parent chain (e.g. two folder-scan roots both named platform under different parentPaths) now render as one row. That is a wider behavior change than the two-host case the PR risk note describes; it is probably acceptable, but worth stating explicitly. The new case/whitespace test locks it in.
Technical details
# Same-host dedup is implicit
## Affected sites
- `src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts:29,42` — identity uses the `name` chain only.
- `cross-host-project-group-merge.test.ts:91-98` — asserts two local (`'Adaptam'` / `' adaptam '`) copies merge.
## Required outcome
- Either document that same-host same-name groups intentionally collapse, or include
the host in the identity so only cross-host copies merge.
## Open questions for the human
- Are duplicate same-name groups on one host a supported state, or already prevented in the UI?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ The branch was rebased to a single commit — the nine unrelated skills/emulator commits are gone and the PR is now 4 files, all sidebar. That resolves the scope concern from the prior review.
Reviewed changes
This pass reviewed the rebased head 821ae87 (1 commit, 4 files). The sidebar source is byte-identical to the version examined at 4e49260, so the two inline findings from the prior review still stand and are not repeated here.
ℹ️ Prior inline findings remain open at this head
The rebase changed no sidebar code, so both earlier comments still apply unchanged: the merged header key (project-group:<primaryId>) diverges from the raw-id keys used by the collapse/reveal helpers and the Cmd+J palette, and the merge identity joins name segments with an unescaped /.
Technical details
# Unchanged since the prior review
## Affected sites
- `src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts:37-44,119` — header/collapse key uses `primary.id` (unchanged).
- `src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts:42` — `${parentIdentity}/${name}` (unchanged).
- `src/renderer/src/components/sidebar/worktree-list/grouping/worktree-group-keys.ts:62-79`,
`navigation/reveal-ancestors.ts:48-65`, `navigation/folder-reveal.ts:75-87`,
`components/cmd-j/palette-project-results.ts:84-97` — still derive keys from raw ids.
## Required outcome
- Same as the prior review; see review #5268922627.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…t group Review follow-ups on the cross-host group merge: - Collapse/reveal/palette keys came from the raw per-host group id while the header renders the merged primary's, so revealing a row owned by the paired host never expanded its header and its palette entry dead-ended. - Group ids are unique per host, not globally. Membership now resolves through (host, id), and an id two hosts reuse for different rows resolves to neither instead of guessing. - Two same-named groups on one host are two real groups; an identity a single host claims twice no longer merges at all. - Identity segments are length-prefixed: a folder-scan group name is a relative path, so `packages/shared` and `shared` under `packages` used to collide.
|
Follow-up commit
Also confirmed working against the real reproduction: a local build of this branch is installed on the reporter's machine with the paired m1 host, and each group now renders once. Verification: |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: d9e142e8-2488-4d65-ace8-bbf73b668856
📥 Commits
Reviewing files that changed from the base of the PR and between 821ae871463d28446f3f9403e3a4fae9b505de33 and ff114a11a096bc3e3ee4e02f0d735c7552d47526.
📒 Files selected for processing (8)
src/renderer/src/components/cmd-j/palette-project-results.tssrc/renderer/src/components/sidebar/worktree-list-groups-nested-project-groups.test.tssrc/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.test.tssrc/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.tssrc/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.tssrc/renderer/src/components/sidebar/worktree-list/grouping/worktree-group-keys.tssrc/renderer/src/components/sidebar/worktree-list/navigation/folder-reveal.tssrc/renderer/src/components/sidebar/worktree-list/navigation/reveal-ancestors.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
✅ No new issues found. Both prior findings are addressed cleanly at
ff114a1.
Reviewed changes
Reviewed the delta from the prior pullfrog review (821ae87) to ff114a1 (8 files touched by this commit) against main.
- Merged identity index —
cross-host-project-group-merge.tsgainedbuildMergedProjectGroupIndex, memoized on the project-group array identity, exposing a host-scoped lookup and an id-only lookup that returnsnullwhen two hosts reuse one id for different rows, plusfindMergedProjectGroup/resolveMergedProjectGroupId. - Host-aware bucketing —
project-group-sections.tsresolves repo and folder-workspace group ids through the merged index using each row's owning host, and derives child parents from the primary. - Key alignment —
getGroupKeysForWorktree,getSidebarRowRevealAncestorKeys,getFolderWorkspaceRevealGroupKeys, and the Cmd+J palette now resolve raw ids to the merged primary, closing the collapse/reveal/palette divergence flagged in the prior review. - Identity encoding — name-chain segments are length-prefixed, so a group literally named
packages/sharedno longer collides withsharedunderpackages. - Same-host guard — an identity a single host claims twice is left entirely unmerged; tests cover that, the flattened collision, id-reuse ambiguity, and a paired-host reveal.
ℹ️ Two same-id groups on different hosts still render under one header key
The new host-scoped disambiguation stops two hosts that reuse one group id from cross-resolving, but both disambiguated rows still carry primary.id === id, so the sidebar emits two headers with the same project-group:<id> key and the first one consumes the shared repo bucket, leaving the second empty. This is pre-existing key construction rather than something these commits introduced, and it needs an actual id collision between hosts (normally impossible with UUID ids) to appear — noted only because the new commit adds an id-reuse test, so the scenario is now explicitly contemplated.
Technical details
# Same-id rows share a header key
## Affected sites
- `src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts:147` — `getProjectGroupHeaderKey(projectGroup.id)` uses the raw primary id.
- `src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts:70` — repo entries resolve to `shared-id` for both hosts, so `groupByProjectGroupId` holds one bucket; the first header drains it and `delete`s the key (`:167`), the second renders empty.
- `cross-host-project-group-merge.test.ts:173-182` — asserts the two same-id rows stay distinct, which is exactly the state that produces the duplicate key.
## Required outcome
- A rendered header key must uniquely identify a row even when two hosts reuse one group id.
## Open questions for the human
- Can real `ProjectGroup.id`s collide across hosts, or are they always UUIDs? If always UUIDs, this stays theoretical and needs no change.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Group ids are unique per host, not globally, so three lookups could cross to another host's unrelated group: - findMergedProjectGroup fell back to the id-only map after a host-scoped miss, which could file a repo under a different host's group entirely. - getGroupKeysForWorktree, getProjectGroupAncestorKeys and getFolderWorkspaceRevealGroupKeys walked the parent chain through a bare id map, so a reveal could expand the wrong header. - Two merged rows whose primaries reuse one id rendered under the same project-group:<id> key and shared one repo bucket, leaving the second header empty. Merged rows now carry a rowId, host-qualified only when a second row's primary reuses that id; the sidebar keys headers, buckets and collapse state on it while ownership and mutations keep routing through primary.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: f3ab764d-4fbc-4e1a-850a-12fa10ef9e4d
📥 Commits
Reviewing files that changed from the base of the PR and between ff114a11a096bc3e3ee4e02f0d735c7552d47526 and 51a963a9999e785a0478b6ebcbe2d81e291143aa.
📒 Files selected for processing (9)
src/renderer/src/components/cmd-j/palette-project-results.tssrc/renderer/src/components/sidebar/folder-workspace-host-id.tssrc/renderer/src/components/sidebar/worktree-list-groups-nested-project-groups.test.tssrc/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.test.tssrc/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.tssrc/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.tssrc/renderer/src/components/sidebar/worktree-list/grouping/worktree-group-keys.tssrc/renderer/src/components/sidebar/worktree-list/navigation/folder-reveal.tssrc/renderer/src/components/sidebar/worktree-list/navigation/reveal-ancestors.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- src/renderer/src/components/sidebar/worktree-list/grouping/worktree-group-keys.ts
- src/renderer/src/components/sidebar/worktree-list/navigation/reveal-ancestors.ts
- src/renderer/src/components/sidebar/worktree-list/navigation/folder-reveal.ts
- src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| ): string | null => | ||
| projectGroupId === null | ||
| ? null | ||
| : (findMergedProjectGroup(mergedIndex, projectGroupId, hostId)?.rowId ?? projectGroupId) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '35,190p' src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts
sed -n '90,245p' src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts
rg -n "resolveMergedRowId|remainingRepos|mergedRowIds|projectGroupId" src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts src/renderer/src/components/sidebar/worktree-list-groups-*.test.tsRepository: stablyai/orca
Length of output: 18508
🏁 Script executed:
sed -n '450,525p' src/renderer/src/components/sidebar/worktree-list-groups-nested-project-groups.test.ts
sed -n '1,110p' src/renderer/src/components/sidebar/worktree-list-groups-nested-project-groups.test.ts
sed -n '1,85p' src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts
sed -n '150,185p' src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.tsRepository: stablyai/orca
Length of output: 10167
Keep unresolved host-scoped groups out of existing row buckets.
When findMergedProjectGroup misses, this fallback uses the raw projectGroupId. If another host has a merged row with that rowId, the repository enters that row's bucket. The mergedRowIds check then excludes it from remainingRepoEntries, so it is not rendered as ungrouped while its metadata loads.
Use a host-qualified unresolved key or an explicit unresolved state that cannot match a merged rowId.
There was a problem hiding this comment.
ℹ️ No critical issues — one documentation nit inline.
Reviewed changes
Reviewed the delta from the prior pullfrog review (ff114a1) to 51a963a (10 files, 3 commits) against main.
- Unique row ids —
MergedProjectGroupgainedrowId, host-qualified only when two merged rows reuse one primary id; the sidebar now keys headers, buckets, and collapse state on it instead ofprimary.id, closing the residual same-key collision from the prior pass. - Host-scoped resolution —
buildProjectGroupHostIndex/findProjectGroupByHostwalk raw parent chains without crossing hosts, andfindMergedProjectGroupno longer falls back to an id-only match once a host is supplied. - Shared resolver —
getFolderWorkspaceProjectGroupHostIdmoved intofolder-workspace-host-id.ts;folder-reveal,reveal-ancestors,worktree-group-keys, and the Cmd+J palette resolve raw ids through the merged index to the row id. - Tests — end-to-end
buildRowscase where two hosts reuse one group id (distinct headers and buckets), host-qualified miss, row-id uniqueness/fallback, host-index scoping and memoization.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| * host are two real groups the user can tell apart and move projects between, so | ||
| * an identity any single host claims twice is left entirely unmerged. | ||
| */ | ||
| type MergedProjectGroupRow = Omit<MergedProjectGroup, 'rowId'> |
There was a problem hiding this comment.
The JSDoc above this alias is the doc for mergeProjectGroupsAcrossHosts ("Fold the per-host copies ... #22022"), but inserting MergedProjectGroupRow between them moved it onto an internal type and left the exported function undocumented. Move the comment back above the function and give the alias a one-line note.
51a963a to
eb2f13c
Compare

ELI5
If you use Orca on two machines and pair them, every one of your project folders showed up twice in the sidebar. One copy had all your projects in it; the other was empty and did nothing when you clicked it. Now there is just one.
What Changed
Before: with a paired runtime environment connected and host grouping off, each project group rendered twice —
tools,tools,work,work. One header held every project (with both machines' worktrees already merged inside each project row); its twin was empty and could not be unfolded. Neither header said which host it came from, so they were indistinguishable.After: one header per group, holding the projects from both hosts.
Mechanism: project groups are stored and merged per host, keyed by
(hostId, groupId)inproject-group-catalog.ts. Two machines whose folder scans walked the same directory layout therefore hold two groups per folder — same name, different ids. Projects, meanwhile, already merge across hosts, so the merged project rows bucket under whichever single group id their repo names, leaving the other host's group with a header and no members.appendProjectGroupSectionsnow folds those copies into one row first:cross-host-project-group-merge.tsmatches copies on the chain of normalized group names up to the root (ids andparentPathare per-host; the name chain is not), and picks a primary — the local copy when there is one, otherwise the oldest bycreatedAtthen id, so the choice is stable across renders.Preferring the local copy keeps the persisted collapse key and the header's menu actions (rename/delete/add project) on the host the user is sitting at, instead of round-tripping to a paired machine.
Nothing about the per-host store changes: both copies still exist, still carry their own owner host, and mutations still route through the existing owner routing.
Why
The duplicate header is not merely cosmetic — the empty twin is a dead click target that looks exactly like the real group, and with several groups it doubles the height of the sidebar.
Alternatives considered:
Scope note: the same duplication still shows wherever a flat group list is rendered straight from
state.projectGroups— the "move project to group" menu and the new-workspace composer. Called out as follow-up in the issue rather than widened into this PR.Linked Issue
Fixes #22022
Visual Proof
Before/after screenshots to be attached by the reporter from the paired-host setup that reproduces this (a paired environment is needed to see it at all). The before state is described and shown in #22022.
Testing
pnpm test src/renderer/src/components/sidebar— 309 files / 2626 tests pass.New
cross-host-project-group-merge.test.tscovers: two-host fold, differently named groups kept apart, full parent-chain matching (a nestedtoolsdoes not merge with a top-leveltools), case/whitespace, stable primary when no copy is local, and a cyclic parent chain.New case in
worktree-list-groups-project-groups.test.tsreproduces the report end to end throughbuildRows(local +runtime:m1groups, one merged project). Verified it fails onmainwith the duplicateproject-group:remote-groupheader and passes with the fix.Also covered: a paired host's own group with no local counterpart still renders.
pnpm tc:weband the changed-code quality gate pass.Platforms: logic is pure renderer row-building with no path or platform branching; exercised on macOS with one paired runtime environment (the host-id handling is the shared
getProjectGroupHostId, which covers SSH and runtime hosts alike).I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude Code (Opus 5); the diagnosis and the approach were reviewed by the author.
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
getProjectGroupHostId, so an SSH host's groups merge with the local ones by the same rule.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)