You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sidebar): draw a cross-host project's header in each host section - #36012
When the sidebar shows separate sections for each computer and the same project lives on two of them, the project's title only appeared under one computer. The other computer's workspaces sat under whatever project came before them. Now each computer's section shows its own title for that project, above its own workspaces.
What Changed
Before: with Group by Project and host sections shown, a project checked out on two hosts got one header. That header sat in the section of its anchor repo's host, so the other host's rows appeared under the previous project's header.
After: every host that owns one of the project's rows gets its own copy of the header. Each copy carries that host's own registration, count and workspace ids. This is the same way Pinned and the status/PR lanes already split per host. The default (unsectioned) view still draws one merged header.
Mechanism:
src/shared/sidebar-list/host-labels.tsgetProjectHeaderHostRepos works out which hosts own the section's rows (items, pending creations, notices). For each one it picks the project's own registration on that host, and never borrows another host's or another project's. A hidden host that only anchors the header no longer gets a section.
src/shared/sidebar-list/project-header-localization.ts builds a copy for one host. Views that end up showing a single host also use it, so their header names that host's registration.
src/shared/sidebar-list/host-section-rows.ts:
Places each copy through the same path as other host-owned rows, so project-group ancestors repeat per section.
Gives every header inside a host section that section's hostId. A copy an earlier section already drew is marked repeated.
A project header now ends any project group that doesn't enclose it. Before, an ungrouped project picked up the previous group as a stray header in other sections.
Header actions on copies:
When a repo id is registered on several hosts, Create opens the composer on that copy's own host. A uniquely registered checkout keeps the id path, which already names it.
Header drag keys on the project's anchor and skips repeated copies, so a reorder still moves the project once.
Project-group drag also skips repeated copies.
The desktop list now resolves each row's repo by host (createHostScopedRepoOf, shared with the feed). Same-id registrations on two hosts each keep their own.
Host badge counts no longer add an expanded project group's project count (host-section-workspace-count.ts).
Mobile gives a repeated header a per-section list key and still collapses it as one.
Why
Host sectioning treated a project header as a row owned by its anchor repo's host, so a project spanning hosts could only head one section. Making the grouping key host-qualified would split the default view, which is merged on purpose. Instead, the header is localized at the point where rows are split by host, which is where lanes are already localized. Collapse stays per project, the same as project-group headers today: collapsing one copy collapses all of them.
Thanks @cfqlilei for the detailed report and code-path trace.
Visual Proof
N/A for a rendered screenshot: it needs two live paired hosts with the same repo. The row model's before and after, as captured in __goldens__/sidebar-list/scenario-host-sections.txt, is shown below (orca is a project on local and SSH).
Before, the SSH section:
HOST GPU VM
HEADER project-group Work
ITEM orca-ssh::/orca-ssh <- no project header
After:
HOST GPU VM
HEADER project-group Work
HEADER project:p-orca "orca" repo=orca-ssh hostId=ssh:gpu-vm count=1
ITEM orca-ssh::/orca-ssh
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
host-section-project-headers.test.ts: per-host copies, expanded and collapsed. A hidden host that only anchors a header gets no section. Fails on main.
project-header-drop.test.ts: drag order keys on the anchor and skips repeated copies.
header-create-workspace-target.test.ts: create pins the host only for same-id twins, and leaves unique checkouts and recipe VM repos on the id path.
host-section-project-headers.test.ts also covers views that end up showing a single host, and a lineage child from another project.
mobile/.../host-sidebar-feed-sections.test.ts: distinct list keys with one shared collapse key. Fails on main.
Sidebar goldens regenerated. The harness collapses every other header, so the collapsed sets shift with the new headers.
pnpm check:changed --maxWorkers=2 passes. Mobile src/host-screen and src/worktree suites pass.
Not run: a live two-host session in the app, or Windows/Linux.
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
Remote/mixed versions: no wire change. The phone builds rows from published domains with its own shared code, and its collapse key is unchanged.
Folder workspaces still sit under project groups, unchanged.
Known follow-ups that predate this change:
workspace drag groups key on the header key, so a workspace reorder inside a repeated copy (or inside a per-host Pinned/status lane) uses the first copy;
header DOM ids repeat across copies;
header drag order follows on-screen order across host sections rather than global order.
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)
The sidebar now repeats a cross-host project's header in each host section.
Each host section gets a project header for its own workspaces.
Project header actions and drag order follow their host registration.
Repeated mobile headers get their own list keys but share collapse.
nwparker explicitly deferred workspace reordering through the first copy, repeated header DOM ids, and header ordering based on host-section screen order. The PR description identifies these as existing follow-ups.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Merged project header] --> B{Host sections shown?}
B -->|No| C[Keep one merged header]
B -->|Yes| D[Find each host's registration]
D --> E[Copy header with host count and workspace ids]
E --> F[Repeat enclosing project groups]
F --> G[Share project collapse key]
Review was skipped as selected files did not have any reviewable changes.
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: 3a5ec8fd-99d4-4dfd-9fea-c822e1226bd4
Commits
Reviewing files that changed from the base of the PR and between cecfffe and b1e8523.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
🔍 Trigger review
Walkthrough
Desktop project headers now carry host-specific repository registrations, workspace counts, and worktree IDs. Host sections render corresponding project headers, and repeated headers are excluded from drag identity. Repository header workspace creation can include a host target hint. On mobile, host sections use distinct list keys while sharing a collapse key.
Priority: Normal
Severity of issue fixed: Medium
Merge Risk: Moderate · previous review cecff
Repeated headers can have duplicate option IDs, and opening settings from a remote-host header can select a different host’s project. Resolve these host-specific navigation issues before merging.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 36.36% 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 checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: rendering a cross-host project's header in each host section.
Description check
The description follows the required template and explains the user impact, implementation, rationale, linked issue, visual proof, testing, known limitations, and checklist status. It also discloses t…
Linked Issues check
Issue #35741 is the only active directly linked issue. Its requirement: when one project has workspaces on two visible hosts, each host section must show that project's header, with rows, counts, and …
Out of Scope Changes check
Each changed area connects to the per-host project header objective of #35741. Host-scoped repo lookup (createHostScopedRepoOf, use-section-rows.ts) and getRepoExecutionHostIdOrDefault (`executi…
Full details: Description check
Explanation
The description follows the required template and explains the user impact, implementation, rationale, linked issue, visual proof, testing, known limitations, and checklist status. It also discloses that live two-host, Windows, and Linux testing was not performed.
Full details: Linked Issues check
Explanation
Issue #35741 is the only active directly linked issue. Its requirement: when one project has workspaces on two visible hosts, each host section must show that project's header, with rows, counts, and IDs limited to that host. The PR summary establishes this behavior. getProjectHeaderHostRepos (host-labels.ts) finds the hosts that own a section's rows and selects the project's own registration on each. localizeProjectHeader (project-header-localization.ts) builds one copy per host with host-specific hostWorktreeCounts, hostWorktreeIds, and hostId. addHostSectionRows (host-section-rows.ts) places each copy in its host section and marks repeats. Hosts that only anchor a header get no section. The unsectioned view keeps one merged header, as the issue's Expected section requires. Collapse is shared per project, which the issue allows as an alternative to a host-qualified key. Create (header-create-workspace-target.ts), header drag (project-header-drop.ts), and project-group drag handle repeated copies. The mobile change gives repeated headers distinct list keys with one shared collapse key. Automated tests and regenerated goldens are described for each of these paths. The incremental diff from the previous reviewed head could not be read, so this verdict relies on the whole-PR summary and the previous assessment.
Full details: Out of Scope Changes check
Explanation
Each changed area connects to the per-host project header objective of #35741. Host-scoped repo lookup (createHostScopedRepoOf, use-section-rows.ts) and getRepoExecutionHostIdOrDefault (execution-host.ts) let same-ID registrations on two hosts keep their own registration. Host badge count changes (host-section-workspace-count.ts) avoid double counting the copies. Drag and boundary changes (project-header-drop.ts, worktree-header-section-boundaries.ts, SectionHeader.tsx) keep repeated copies from moving a project twice. The config/repo-host-read-baseline.txt ratchet removal follows from host-section-rows.ts no longer reading connectionId directly. Golden snapshot updates reflect the new header metadata. The mobile changes apply the same repeated-header model to the phone list. No change was found that is unrelated to #35741. The unreadable incremental diff limits this check to the whole-PR summary.
Full details: Docstring Coverage
Explanation
Docstring coverage is 36.36% 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 22 functions across 25 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
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.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Major · Preserve the header host when opening project settings. · WorktreeList.tsx:180
src/renderer/src/components/sidebar/WorktreeList.tsx:180 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Preserve the header host when opening project settings.
When duplicate repository IDs exist on different hosts, this action omits hostId. Settings can therefore select a different host's project settings entry. Pass the header's repository and its execution host to the navigation target.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Use the host-qualified render-row key for repeated header DOM IDs.
The virtualizer keys are unique because getRenderRowKey returns hdr:${row.hostId}:${row.key} for hosted headers. However, SectionHeader.tsx still passes only row.key to getWorktreeOptionId. Repeated host copies therefore receive the same DOM ID. Use the same host-qualified header identity for the option ID and its active-descendant and reveal lookups.
The reason will be displayed to describe this comment to others. Learn more.
Create selects another checkout
When a project has checkouts A and B on one host, and A is also registered on another host, clicking Create on A now supplies initialWorkspaceTarget. That path picks the first ready checkout for the project and host, even when the hint names A's setup. If B comes first, the composer targets B's directory instead. Previously, the initialRepoId path kept A.
Preserve the clicked checkout as well as its host when resolving this hint.
A project checked out on two hosts kept one header, placed in the host
section of its anchor repo, so the other host's rows sat under the
previous project. Project headers now carry, for each host that owns one
of their rows, that project's own registration on that host and its
counts, and host sectioning gives every such host its own copy, the way
Pinned and status lanes already split. A header never borrows another
host's or another project's registration, a hidden host that only
anchors the header no longer gets a section, and a view that ends up
showing one host still names that host's registration.
Every header inside a host section now names that section's host, and a
copy an earlier section already drew is marked repeated. When a repo id
is registered on several hosts, a copy's create button opens the
composer on its own host; header drag keys on the project's anchor and
skips repeated copies, so reordering still moves the project once; the
phone keys each copy per section while collapsing it as one. The desktop
list also resolves each row's repo by host, as the feed already does, so
same-id registrations on two hosts keep their own.
Host sectioning also stops carrying an ended project group into the next
ungrouped project, and host badge counts no longer add a project group's
project count when the group is expanded.
Fixes#35741
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
When the sidebar shows separate sections for each computer and the same project lives on two of them, the project's title only appeared under one computer. The other computer's workspaces sat under whatever project came before them. Now each computer's section shows its own title for that project, above its own workspaces.
What Changed
Mechanism:
src/shared/sidebar-list/host-labels.tsgetProjectHeaderHostReposworks out which hosts own the section's rows (items, pending creations, notices). For each one it picks the project's own registration on that host, and never borrows another host's or another project's. A hidden host that only anchors the header no longer gets a section.src/shared/sidebar-list/project-header-localization.tsbuilds a copy for one host. Views that end up showing a single host also use it, so their header names that host's registration.src/shared/sidebar-list/host-section-rows.ts:hostId. A copy an earlier section already drew is markedrepeated.createHostScopedRepoOf, shared with the feed). Same-id registrations on two hosts each keep their own.host-section-workspace-count.ts).Why
Host sectioning treated a project header as a row owned by its anchor repo's host, so a project spanning hosts could only head one section. Making the grouping key host-qualified would split the default view, which is merged on purpose. Instead, the header is localized at the point where rows are split by host, which is where lanes are already localized. Collapse stays per project, the same as project-group headers today: collapsing one copy collapses all of them.
Linked Issue
Fixes #35741
Thanks @cfqlilei for the detailed report and code-path trace.
Visual Proof
N/A for a rendered screenshot: it needs two live paired hosts with the same repo. The row model's before and after, as captured in
__goldens__/sidebar-list/scenario-host-sections.txt, is shown below (orca is a project on local and SSH).Before, the SSH section:
After:
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
host-section-project-headers.test.ts: per-host copies, expanded and collapsed. A hidden host that only anchors a header gets no section. Fails on main.project-header-drop.test.ts: drag order keys on the anchor and skips repeated copies.header-create-workspace-target.test.ts: create pins the host only for same-id twins, and leaves unique checkouts and recipe VM repos on the id path.host-section-project-headers.test.tsalso covers views that end up showing a single host, and a lineage child from another project.mobile/.../host-sidebar-feed-sections.test.ts: distinct list keys with one shared collapse key. Fails on main.Sidebar goldens regenerated. The harness collapses every other header, so the collapsed sets shift with the new headers.
pnpm check:changed --maxWorkers=2passes. Mobilesrc/host-screenandsrc/worktreesuites pass.Not run: a live two-host session in the app, or Windows/Linux.
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)