Skip to content

fix(sidebar): draw a cross-host project's header in each host section - #36012

Merged
nwparker merged 1 commit into
mainfrom
fix/35741-project-header-per-host
Oct 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/35741-project-header-per-host

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​339 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​338
Prod 34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​662 $\color{#cf222e}{\Huge{\mathbf{−}}}$​421 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​241

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

  • 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.ts getProjectHeaderHostRepos 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.

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:

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)

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect project-grouped sidebar behavior across desktop and mobile host sections.

Fix the Create target before merging so a header cannot open the composer for another checkout.

Findings

  1. P1 Create selects another checkout ▶

Summary

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]
Loading

Reviews (2) · Last reviewed commit: "fix(sidebar): draw a cross-host project'..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: rendering a cross-host project's header in each host section.
Description check Passed 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 Passed 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 Passed 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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

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.

Suggested fix
-  onOpenRepoSettings: (projectId: string, sectionId?: string) => void
+  onOpenRepoSettings: (repo: Repo, sectionId?: string) => void

-        <DropdownMenuItem onSelect={() => actions.onOpenRepoSettings(repo.id)}>
+        <DropdownMenuItem onSelect={() => actions.onOpenRepoSettings(repo)}>
...
-          onSelect={() => actions.onOpenRepoSettings(repo.id, getRepositoryIconSectionId(repo.id))}
+          onSelect={() =>
+            actions.onOpenRepoSettings(repo, getRepositoryIconSectionId(repo.id))
+          }
-    (projectId: string, sectionId?: string) => {
-      openSettingsTarget({ pane: 'repo', repoId: projectId, ...(sectionId ? { sectionId } : {}) })
+    (repo: Repo, sectionId?: string) => {
+      openSettingsTarget({
+        pane: 'repo',
+        repoId: repo.id,
+        hostId: getRepoExecutionHostId(repo),
+        ...(sectionId ? { sectionId } : {})
+      })

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: d327892a-1287-4cbc-8f46-f82ac867e39b
Commits

Reviewing files that changed from the base of the PR and between 5257197 and 24e6dd1.

Files selected for processing: 38
  • config/repo-host-read-baseline.txt
  • mobile/src/host-screen/host-sidebar-feed-sections.test.ts
  • mobile/src/host-screen/host-sidebar-feed-sections.ts
  • mobile/src/host-screen/host-workspace-list.tsx
  • mobile/src/worktree/workspace-list-types.ts
  • src/renderer/src/components/sidebar/WorktreeList.tsx
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list-stamp-order/group-by-repo.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list-stamp-order/scenario-hide-default-branch.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list-stamp-order/scenario-hide-sleeping.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list-stamp-order/scenario-host-sections.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list-stamp-order/scenario-name-order.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list-stamp-order/scenario-new-external-inbox.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list-stamp-order/scenario-stamp-tiers.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list/group-by-repo.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list/scenario-hide-default-branch.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list/scenario-hide-sleeping.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list/scenario-host-sections.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list/scenario-name-order.txt
  • src/renderer/src/components/sidebar/__goldens__/sidebar-list/scenario-new-external-inbox.txt
  • src/renderer/src/components/sidebar/header-create-workspace-target.test.ts
  • src/renderer/src/components/sidebar/header-create-workspace-target.ts
  • src/renderer/src/components/sidebar/host-section-project-headers.test.ts
  • src/renderer/src/components/sidebar/project-group-header-drop.ts
  • 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-header-section-boundaries.ts
  • src/renderer/src/components/sidebar/worktree-list/listing/use-section-rows.ts
  • src/renderer/src/components/sidebar/worktree-list/rows/SectionHeader.tsx
  • src/renderer/src/components/sidebar/worktree-list/rows/repo-header-project-actions.tsx
  • src/renderer/src/components/sidebar/worktree-list/rows/repo-header-ssh-isolation.test.tsx
  • src/renderer/src/components/sidebar/worktree-list/viewport/viewport-props.ts
  • src/shared/execution-host.ts
  • src/shared/sidebar-list/group-sections.ts
  • src/shared/sidebar-list/host-labels.ts
  • src/shared/sidebar-list/host-section-rows.ts
  • src/shared/sidebar-list/host-section-workspace-count.ts
  • src/shared/sidebar-list/row-types.ts
  • src/shared/sidebar-list/sidebar-feed-index.ts
Files with no reviewable changes: 1
  • config/repo-host-read-baseline.txt

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

Comment on lines +284 to +298
...hostRows.map((row): Row => {
// A header names its section's host, so repeated copies stay distinct and act on that host.
if (row.type === 'header') {
const repeated = drawnHeaderKeys.has(row.key)
drawnHeaderKeys.add(row.key)
if (row.hostId && !repeated) {
return row
}
return { ...row, hostId: row.hostId ?? hostId, ...(repeated ? { repeated: true } : {}) }
}
// The enclosing host header already names the owner of cards and notices.
return 'hostContextLabel' in row && row.hostContextLabel
? { ...row, hostContextLabel: undefined }
: row
)
})

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.

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

#!/bin/bash
# Check how virtual row keys and option ids are derived for header rows.
rg -nP -C4 'getItemKey|getWorktreeOptionId\s*\(' src/renderer/src/components/sidebar --type=ts --type=tsx -g '!**/*.test.*'
rg -nP -C4 'function getSidebarRowKey|rowKey\s*[:=]|getRenderRowKey' src/renderer/src/components/sidebar --type=ts --type=tsx -g '!**/*.test.*'

Repository: stablyai/orca

Length of output: 215


Script executed:

#!/bin/bash
set -u

rg -n -C5 --glob '*.ts' --glob '*.tsx' --glob '!**/*.test.*' \
  -e 'getItemKey' \
  -e 'getWorktreeOptionId[[:space:]]*\(' \
  -e 'renderWorktreeSectionHeaderRow' \
  -e 'data-worktree-virtual-row-key' \
  src/renderer/src/components/sidebar src/shared/sidebar-list || true

printf '\n--- candidate declarations ---\n'
rg -n -C8 --glob '*.ts' --glob '*.tsx' --glob '!**/*.test.*' \
  -e 'function[[:space:]]+getWorktreeOptionId' \
  -e 'const[[:space:]]+getWorktreeOptionId' \
  -e 'getWorktreeOptionId[[:space:]]*=' \
  -e 'getItemKey[[:space:]]*[:=]' \
  src/renderer/src/components/sidebar src/shared/sidebar-list || true

Repository: stablyai/orca

Length of output: 44674


Script executed:

rg -n -C4 --glob '*.ts' --glob '*.tsx' --glob '!**/*.test.*' 'getItemKey|getWorktreeOptionId|renderWorktreeSectionHeaderRow|data-worktree-virtual-row-key' src/renderer/src/components/sidebar src/shared/sidebar-list || true

Repository: stablyai/orca

Length of output: 33204


Script executed:

set -u
rg --files src/renderer/src/components/sidebar src/shared/sidebar-list | grep -E '(worktree|sidebar-list|section).*\.tsx?$' | head -200
printf '\n-- references --\n'
rg -n --glob '*.ts' --glob '*.tsx' 'getWorktreeOptionId|data-worktree-virtual-row-key|renderWorktreeSectionHeaderRow|getItemKey' src/renderer/src src/shared || true

Repository: stablyai/orca

Length of output: 25095


Script executed:

set -u
printf '%s\n' '--- getVirtualItemKey references and declarations ---'
rg -n -C10 --glob '*.ts' --glob '*.tsx' --glob '!**/*.test.*' \
  'getVirtualItemKey|renderRows\[.*\]\.key|renderRows\[.*\]\?\.key|type RenderRow|interface RenderRow' \
  src/renderer/src/components/sidebar/worktree-list src/shared/sidebar-list || true

printf '%s\n' '--- virtualizer implementation ---'
sed -n '1,180p' src/renderer/src/components/sidebar/worktree-list/viewport/use-virtualizer.ts

Repository: stablyai/orca

Length of output: 13462


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.

Source: Learnings

@nwparker
nwparker force-pushed the fix/35741-project-header-per-host branch from 24e6dd1 to cecfffe Compare October 29, 2026 20:49
Comment on lines +25 to +28
return getComposerEligibleRepos(repos).some(
(candidate) => getRepoHostIdentity(candidate) === identity
)
? { initialWorkspaceTarget: getRepoWorkspaceCreationTargetHint(repo, projectHostSetups) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 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
@nwparker
nwparker force-pushed the fix/35741-project-header-per-host branch from cecfffe to b1e8523 Compare October 29, 2026 22:12
@nwparker
nwparker merged commit 6c6e629 into main Oct 29, 2026
48 of 49 checks passed
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]: Project header is drawn in only one host section when the same project exists on two hosts

1 participant