Skip to content

fix(sidebar): place a multi-host project in the group any of its rows is in - #34720

Closed
jbamlee wants to merge 7 commits into
stablyai:mainfrom
jbamlee:fix-multi-host-project-group
Closed

jbamlee wants to merge 7 commits into
stablyai:mainfrom
jbamlee:fix-multi-host-project-group

Conversation

@jbamlee

@jbamlee jbamlee commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When the same project is added on two paired computers, the sidebar shows it once, with a row for each computer. It picked the project's group by looking at only one of those rows, usually the one listed first. So after you put the project in a group on one computer, the other computer could show an empty group and leave the project outside it. And when each computer had put the project in its own group, another computer's group could win, and nothing you did on this computer could move it. Now the project is shown in this computer's group if its row here is in one, otherwise in the group of the first row that is.

What Changed

Before:

  • Orca A and Orca B are paired and both have the same Git project. On Orca B, Move to group puts the project inside the group. Orca A shows the group header empty, with the project at the top level ([Bug]: A project grouped on one paired Orca shows outside that group on the other Orcas #29876).
  • If Orca A's row is in Orca A's group and Orca B's row is in Orca B's group, Orca A draws the project in whichever group belongs to the row listed first. When that is Orca B's row, the project sits under Orca B's group. Its card menu on Orca A marks Orca A's group as current, so no move from Orca A changes where it is drawn.

After:

  • Orca A also shows the project inside Orca B's group.
  • When the rows are in different groups, each Orca draws the project in its own group, whatever the row order.

Mechanism:

  • src/shared/sidebar-list/project-group-sections.ts: new getProjectSectionMemberRepoIds(repoMap, projectIndex) maps every catalog row to its section key, once per row build. It covers rows whose workspaces are pinned away and rows that have no workspaces yet.
  • New getProjectSectionGroupRepo(section, memberRepoIds, …) returns the row that places a section:
    • A row counts only when its group lives in the row's own host's catalog (runtime:X with X; local and direct SSH with this Orca's). The window copies an earlier copy's group id onto a fetched row that names none (applyInheritedProjectGroups), so a row can carry another host's group that does not hold it.
    • Among those, a row from this Orca's own catalog wins, then the first in manual order.
    • With none, it is the anchor, so the section stays at the root as today.
    • Because it reads catalog rows rather than visible ones, pins and placeholders cannot move a project, and the drawn sidebar and the Cmd+1–9 order always agree.
  • appendProjectGroupSections places sections, and orders them inside a group, by that row's projectGroupId and projectGroupOrder.
  • sidebar-row-plan.ts (planSidebarRows) takes the reveal path (which group to expand to reveal a workspace) from the same row, so reveal matches where the project is drawn. Every caller of planSidebarRows reads the same placement: the window's list, the Cmd+1–9 order, reveal, and the sidebar feed.
  • Header rows carry that row as projectGroupRepo when it is not the anchor. Header drag passes it into the drag session next to the header's own row. The drag takes its bucket from it, sibling ranks read it, and the commit moves that row (moveProjectToGroup(row, …)). The header's own id still marks its place in the list. Dragging a project inside a group therefore reorders the row that put it there, on that row's own host.
  • The header's … menu takes the same row (RepoHeaderProjectActionsMenu's projectGroupRepo). The "current group" check and Remove from group act on it, so they match where the project is drawn. Move to group moves whichever of that row and the anchor can join the chosen group (getProjectGroupJoinableRow, the store guard's isProjectGroupJoinableFromCatalog), because a group lives on one host. Project settings, icon, worktree visibility, New group from project and Remove Project keep the anchor row.
  • With host sections shown, each host's copy of a cross-host header names that host's row as its repo (fix(sidebar): draw a cross-host project's header in each host section #36012). The menu falls back to the merged header's anchor (getHeaderProjectGroupRepo), so every copy acts on the row that placed the project in the group it is drawn under. Header drag keys that row by the anchor's id, which is what the drag buckets list (getProjectHeaderDragRepoById), so a host's copy ranks among its siblings by that row too.

Why

Root cause:

  • The anchor is the section's first row in this Orca's state.repos order (getManualOrderAnchorRepo). That order follows when each row reached this Orca's list, so it can be any host's row.
  • Placement read only the anchor's projectGroupId, and Move to group changes only one host's row. So only an Orca whose anchor is the moved row drew the project in the group, unless the window had copied that group onto its anchor (see Visual Proof).
  • Ranking alone does not fix it: when each host's row is in its own host's group, the first row's group wins, and that can be another computer's.
  • The group catalogs themselves sync correctly: the paired client receives both the group and the moved row (see Visual Proof).

Alternatives considered:

  • Make Move to group change every host's row. A group lives on one host, and a row can only join a group on its own host (fix(project-groups): say so when a project cannot join a group on another host #30127), so the other hosts' rows cannot join it.
  • Anchor the section on the grouped row. The anchor also decides which host header actions target, such as creating a workspace. Changing it would send those actions to another computer.
  • Prefer the focused host's row. The focused host (getSettingsFocusedExecutionHostId) changes with focus, so the project would move between groups as focus moves.
  • Stop merging a project's rows from different hosts. That reverses the one-project-per-section design.

Linked Issue

Fixes #29876

I first opened this as #29877 and closed it on 2026-10-23. It is reopened here on current main, because the bug still reproduces there and a user asked for a follow-up on #29877.

Visual Proof

Paired Orca apps ran in the background on main b18dc951ca and on this branch: an Electron client (Orca A) and one or two headless hosts it is paired with (Orca B, Orca C). Each Orca added its own clone named demo-test with the same origin. "Group A" lives on Orca A, "Group B" on Orca B, "Group C" on Orca C. The screenshots are Orca A's window (CDP screenshots of the hidden window).

Three Orcas, three groups

Orca A adds its clone first, so its own row is listed first.

Step main b18dc951ca this branch
1. No row in a group main, no row grouped: demo-test at the root under three empty groups This branch, no row grouped: demo-test at the root under three empty groups
2. Only Orca B's row in Group B main, only Orca B row grouped: demo-test stays at the root and Group B is empty This branch, only Orca B row grouped: demo-test is nested under Group B
3. Each row in its own host's group main, each row in its own group: demo-test under Group A This branch, each row in its own group: demo-test under Group A
  • Step 2 is [Bug]: A project grouped on one paired Orca shows outside that group on the other Orcas #29876: main leaves the project at the root with Group B empty; this branch draws it inside Group B.
  • Steps 1 and 3 are the same on both. In step 3 Orca A uses its own row's group.
  • In step 2 Orca A's store lists Orca C's row with Group B's id, although Orca C's repo.list returns that row with no projectGroupId field. That is applyInheritedProjectGroups copying Orca B's group onto it; main does the same.
  • Whether main gets [Bug]: A project grouped on one paired Orca shows outside that group on the other Orcas #29876 depends on that copy. In a two-Orca run on the same main, Orca A's own row also came back with no projectGroupId and took Group B the same way, so main drew the project inside Group B. In the step 2 run above, Orca A's row kept no group, and main left the project at the root. With this change the placement comes from the row Group B holds, so it does not depend on the copy.

Another host's row listed first, each row in its own host's group

Orca B adds its clone first, so Orca A lists Orca B's row first. Then Orca B's row goes into Group B (on Orca B), and Orca A's row into Group A (on Orca A).

main b18dc951ca this branch
Sidebar main, Orca B row listed first: demo-test is nested under Group B although Orca A row is in Group A This branch, Orca B row listed first: demo-test is nested under Group A
Card menu of Orca A's workspace, Move to group open main: card menu of Orca A workspace marks Group A current while demo-test is drawn under Group B This branch: card menu of Orca A workspace marks Group A current and demo-test is drawn under Group A
  • main draws demo-test under Group B. The card menu of Orca A's own workspace marks Group A as current (disabled) and offers Group B, which Orca A's row cannot join. Remove from group clears only Orca A's row, which does not place the project. No action from Orca A moves it.
  • This branch draws it under Group A, matching the menu.
  • The headers read from the rendered DOM (data-repo-header-bucket):
# main b18dc951ca
group   "Group A"    bucket=root
group   "Group B"    bucket=root
project "demo-test"  bucket=group:<Group B>

# this branch
group   "Group A"    bucket=root
project "demo-test"  bucket=group:<Group A>
group   "Group B"    bucket=root

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • New worktree-list-groups-cross-host-project-group.test.ts:

    • The same two-host data, built in both catalog orders, renders identically.
    • The reveal path follows the group the project is drawn in.
    • With the rows in different groups, the project stays in this Orca's group whether this Orca's row, the paired host's row, or a direct SSH row of this Orca comes first.
    • A row that only inherited the paired host's group id does not place the project; the paired row does.
    • A same-id copy of this Orca's group listed by the paired host does not hide this Orca's copy.
    • Pinning the grouped host's only workspace keeps the project in the group.
    • The rendered sidebar (empty-project placeholders) and the Cmd+1–9 order (no placeholders) place the project the same way, including with rows in competing groups.
    • Dragging the project inside its group drags it as the row that placed it.
  • project-header-drag-commit.test.ts: a header placed by another host's row reorders that row. project-header-drag-start.test.ts: the drag takes that row's bucket. project-header-drop.test.ts: a host's copy of such a header ranks by that row under its anchor's id.

  • New worktree-list-groups-cross-host-project-menu.test.tsx: the planned header, with this Orca's ungrouped row as anchor, renders the menu with the props SectionHeader passes. Remove from group shows and removes the paired host's row. Move to group marks that group current and moves that row, and moving into one of this Orca's groups moves the local row. Project Settings and Remove Project stay on the local row. A paired host section's copy of a header drawn in this Orca's group marks that group current and removes this Orca's row. The two-host fixture is shared through worktree-list-groups-cross-host-project-group.test-fixture.ts.

  • With main b18dc951ca's source files and these tests, 14 of the 32 cases in the five changed test files fail; with this change all 32 pass.

  • Rebased onto main 46237aa148 after fix(sidebar): draw a cross-host project's header in each host section #36012. pnpm check:changed --maxWorkers=2 (format, lint, typecheck, affected tests, ratchets: 27 checks) passes on 2c98f794f85.

  • Platforms: macOS (unit tests and the background E2Es above). The change is renderer and shared-list code with no platform branches.

AI Disclosure

Implemented with Claude Code (Claude Opus 5.5). It was reviewed by GPT-6 Astra (xhigh reasoning) through Codex CLI in #29877. That review found pinned members, Cmd+1–9 parity including competing groups, and drag buckets; all are fixed here. This version was reviewed again by GPT-6.1 Sol before opening. The own-group and inherited-id changes were reviewed by GPT-6.1 Sol (xhigh reasoning) in two passes; the last pass found nothing blocking.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • No IPC, RPC or persisted-state change. The phone's host list is built by the same planSidebarRows through the sidebar feed, so it places the project the same way with no phone code change. Its catalog (buildSidebarProjectCatalog) stamps paired servers' rows and groups with their host, as the window does.
  • Single-host projects are unaffected: their only row is the anchor, and its group lives in its own catalog.
  • Cost: one pass over the repo catalog per row build, using indexed lookups, plus a scan of each section's member ids.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 29aebc3f-0803-4fe2-860e-79ad5249417b
Commits

Reviewing files that changed from the base of the PR and between b3c721a and 2c98f79.

Files selected for processing: 3
  • src/renderer/src/components/sidebar/project-header-drop.test.ts
  • src/renderer/src/components/sidebar/project-header-drop.ts
  • src/renderer/src/components/sidebar/worktree-list/drag/use-header-drag.ts

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

Walkthrough

Project sections now use a member repository’s Project Group to determine placement and reveal paths across paired hosts. Sidebar headers carry that repository into drag sessions and project-group menu actions. Drag commits use the group-member repository to resolve the moved row while preserving the dragged header ID. Tests cover cross-host placement, ordering, dragging, and menu callbacks.

Severity of issue fixed: Medium

Merge Risk: Minimal · previous review 2c98f

Host-filtered drag ordering now uses consistent header keys. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "fix(sidebar): place a multi-host project in the group any of its rows is in" names the main change: a multi-host project is placed in a group based on any of its rows, not only the anchor r…
Description check Passed The description follows the repository template closely. It has the ELI5, What Changed (before/after and mechanism), Why (root cause and alternatives), Linked Issue (Fixes #29876), Visual Proof (befor…
Linked Issues check Passed Issue #29876 requires a multi-host project to appear inside the group that contains a qualifying row on another paired Orca. getProjectSectionMemberRepoIds and getProjectSectionGroupRepo evaluate …
Out of Scope Changes check Passed The changes support issue #29876. Group placement, ordering, reveal, header actions, and header drag behavior use the row that places the project. Anchor-based project settings, project removal, and n…
Full details: Title check

Explanation

The title "fix(sidebar): place a multi-host project in the group any of its rows is in" names the main change: a multi-host project is placed in a group based on any of its rows, not only the anchor row. The changeset adds row-based group resolution in project-group-sections.ts, sidebar-row-plan.ts, and the header drag/menu paths, which match this title. The title is specific and uses the conventional fix(sidebar) prefix. It is somewhat long at 75 characters, but it is not vague or misleading.

Full details: Description check

Explanation

The description follows the repository template closely. It has the ELI5, What Changed (before/after and mechanism), Why (root cause and alternatives), Linked Issue (Fixes #29876), Visual Proof (before/after tables with main and this branch), Testing (manual and automated, platform named as macOS), AI Disclosure, the Agent skill upstream boundary checkbox, Notes, and the Checklist. It is detailed and specific about the change. Minor deviations exist: the Notes line contains the typo 'Cross-platoform', and the Review heading is empty. These are non-critical and do not affect the assessment.

Full details: Linked Issues check

Explanation

Issue #29876 requires a multi-host project to appear inside the group that contains a qualifying row on another paired Orca. getProjectSectionMemberRepoIds and getProjectSectionGroupRepo evaluate all project rows, validate the row's group against its host catalog, and select the local row before manual order. appendProjectGroupSections and planSidebarRows use the selected row for placement and reveal. The added tests cover paired-host orders, inherited group IDs, pinned rows, placeholders, reveal, and menu and drag actions.

Full details: Out of Scope Changes check

Explanation

The changes support issue #29876. Group placement, ordering, reveal, header actions, and header drag behavior use the row that places the project. Anchor-based project settings, project removal, and new-group behavior remain separate. The shared fixture and tests verify the linked behavior. The documented workspace-card gaps and same-repository-ID limitation do not demonstrate unrelated changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 18 functions across 20 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · 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

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous local-group move failure is fixed.

Summary

The PR places a shared project's header using a member row whose own host holds its group, preferring this computer's row.

  • Merged projects appear in the group of a valid member row.
  • Project group menu actions follow the row that places the header.
  • Dragging a grouped project reorders the row that placed it.

Reviews (2) · Last reviewed commit: "fix(sidebar): move the project row that ..." · Reviewed by Greptile

@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


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 39ad4e10-f575-497f-8e39-acd8fe256b41
Commits

Reviewing files that changed from the base of the PR and between 1768531 and 4f4d877.

Files selected for processing: 3
  • src/renderer/src/components/sidebar/worktree-list-groups-cross-host-project-menu.test.tsx
  • src/renderer/src/components/sidebar/worktree-list/rows/repo-header-project-actions.tsx
  • src/renderer/src/store/slices/project-group-owner-routing.ts

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

@jbamlee
jbamlee force-pushed the fix-multi-host-project-group branch from 4f4d877 to b3c721a Compare October 30, 2026 08:38

@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


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bef3b8cb-b7dd-4b12-adac-62fe7957f8e6
Commits

Reviewing files that changed from the base of the PR and between 4f4d877 and b3c721a.

Files selected for processing: 6
  • src/renderer/src/components/sidebar/project-header-drop.ts
  • src/renderer/src/components/sidebar/worktree-list-groups-cross-host-project-menu.test.tsx
  • src/renderer/src/components/sidebar/worktree-list/rows/SectionHeader.tsx
  • src/renderer/src/components/sidebar/worktree-list/rows/repo-header-project-actions.tsx
  • src/shared/sidebar-list/group-sections.ts
  • src/shared/sidebar-list/row-types.ts

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

jbamlee and others added 7 commits November 1, 2026 22:39
… is in

A project set up on several hosts is one sidebar section anchored on each Orca's own row, and
placement read only the anchor's projectGroupId. Move to group changes one host's row, so only the
Orca anchored on that row drew the project inside the group; the others showed the group empty.

- getProjectSectionMemberRepoIds maps every catalog row to its section, including rows whose
  workspaces are pinned away or absent.
- getProjectSectionGroupRepo picks the first member in manual order that is in a known group,
  else the anchor. Placement, in-group rank and the reveal path read that row.
- Header rows carry it as projectGroupRepo; header drag buckets, ranks and commits use it, and the
  commit names that row's host.

Ported onto src/shared/sidebar-list after stablyai#29906.

Fixes stablyai#29876

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aced it in the group

A header drawn inside a paired host's group, while this Orca's own row is
ungrouped, hid Remove from group and moved the local row. Move to group, its
current-group check and Remove from group now use the header's
projectGroupRepo; the other project actions keep the anchor row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the hosts' groups differ

When a project's rows sit in different hosts' groups, the row that ranked first
in this Orca's order placed the project, and that can be another host's row.
The project was then drawn in that host's group while this Orca's own row was
in its own group, and no move from this Orca could change it. Prefer a grouped
row from this Orca's own catalog (local or direct SSH), then fall back to the
first grouped row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… group holds

The window copies an earlier copy's group id onto a fetched row that names no
group (applyInheritedProjectGroups), so a row can carry another host's group.
Choosing such a row to place the project made the header's group actions act
on a row the group does not hold: Remove from group changed nothing. Count a
row as grouped only when a copy of its group lives in the row's own host's
catalog; same-id group copies can sit on several hosts (stablyai#30045).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m the header menu

The header's Move to group moved the row that places the project. When that
row is another host's, choosing one of this Orca's groups sent that row to a
group on another host, and the store refused it; main moved this Orca's anchor
row there. Pick the placing row or the anchor, whichever the store guard lets
join the chosen group.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d its group

With host sections shown, each host's copy of a cross-host project header
names that host's registration as its repo. The header's group actions fell
back to that repo, so a copy drawn in this Orca's group acted on the paired
row: Remove from group removed the paired row from its own group, and the
group the copy is drawn in was not marked current. Group actions now fall
back to the merged header's anchor, which is the row that placed it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The drag buckets list each header under its anchor's id, but the map of
rows that placed headers in a group keyed a host's copy by that host's
own registration. A localized copy then ranked its siblings by the
anchor's own projectGroupOrder. Key the map by getHeaderDragRepo(row),
built next to the bucket lists.

Co-Authored-By: Claude Opus 5.5 <[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.

[Bug]: A project grouped on one paired Orca shows outside that group on the other Orcas

1 participant