Repository navigation
fix(sidebar): label pinned rows with their host on a multi-host sidebar - #19351
Conversation
emitPinnedGroup was the one section emitter that appended worktree rows without hostContextLabelByWorktreeIdentity, and the mixed-host map it would have received was computed over naturalWorktrees, which under the default pinned policy has the pinned worktrees filtered out. Under that policy a pinned worktree renders only in the Pinned section, so a pinned remote workspace had no host badge anywhere. Compute the mixed-host map over the full worktree set and thread it into the Pinned emitter. Single-host sidebars still draw no badge. Fixes #18472
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
Merge Risk: ⚪ Minimal · up to Pinned workspace rows now show their host labels in mixed-host sidebars while single-host sidebars remain unchanged. The targeted row-building coverage supports the intended behavior with no current merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
✅ No new issues found.
Reviewed changes
- Full-set mixed-host map —
getMixedWorktreeHostContextLabelsinbuild-rows.tsnow runs over the fullworktreesset rather thannaturalWorktrees, so pinned worktrees count toward the sidebar-level "hosts are mixed" decision and their identities land in the label map. - Pinned-section plumbing —
emitPinnedGroupaccepts a new optionalhostContextLabelByWorktreeIdentityand forwards it toappendWorktreeRows, closing the one section-emit path that never passed the identity-keyed map. - Regression tests — new
worktree-list-groups-pinned-host-labels.test.tscovers the pinned-only mix,repo/workspace-status/nonegrouping,duplicate-in-groups, and a single-host negative control with exacttoEqualassertions (not loose/truthiness checks).
The deliberate widening of the "mixed" test from natural-lane scope to whole-sidebar scope is the correct call for the pinned case, and the trace of hostContextLabel from row model to WorktreeCard confirms the row model is the sole deciding layer. No correctness, security, or compatibility concerns.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ELI5
When your sidebar mixes hosts (say, your Windows machine plus a remote Orca server), every workspace card gets a little "which computer is this on" badge. Cards in the Pinned section never got one. Because pinned workspaces are, by default, shown only in Pinned, a pinned remote workspace had no host attribution anywhere in the sidebar. This threads the same host-label map every other section already uses into the Pinned section, and computes it over the full workspace set so pinned rows count toward "is this sidebar mixed?".
What Changed
src/renderer/src/components/sidebar/worktree-list/grouping/build-rows.ts:mixedWorktreeHostContextLabelsis now computed overworktrees(the full set) instead ofnaturalWorktrees(which, under the defaultshowPinnedWorktreesInGroups: falsepolicy, has the pinned worktrees filtered out). The map is passed toemitPinnedGroup.src/renderer/src/components/sidebar/worktree-list/grouping/pinned-group-rows.ts:emitPinnedGroupacceptshostContextLabelByWorktreeIdentityand forwards it toappendWorktreeRows, matching the All lane and every grouped lane.src/renderer/src/components/sidebar/worktree-list-groups-pinned-host-labels.test.ts.Why
appendWorktreeRows(row-builders.ts:138,:208) is the only writer ofhostContextLabelon item rows, andemitPinnedGroupwas the only section emitter calling it without the identity-keyed map. Two arms, both required:hostContextLabelwas alwaysundefinedfor them.naturalWorktrees, which excludes pinned worktrees. A pinned remote's identity was never a key in it, and if the pinned worktrees were the only thing making the sidebar multi-host, the map wasundefinedentirely.The "only badge when hosts are mixed" rule is unchanged:
getMixedHostContextLabelsstill returnsundefinedfor a single unique host, so single-host setups draw no new badge.Row-to-badge hop verified as an unconditional pass-through:
worktree-list/rows/item-row.tsx:217->WorktreeCard->worktree-card-presentation.tsx:80(showHostContextBadge = !compactCards && !!hostContextLabel). The row model is the deciding layer.Remote wire compatibility: no wire change (renderer-only row model). SSH execution boundary: no verdicts, no process control touched. Folder workspaces: unaffected (they are not pinned worktrees;
getRenderableFolderWorkspacespath unchanged). Not GitHub/GitLab specific.Linked Issue
Fixes #18472
Visual Proof
Row-model before/after (the deciding layer; the badge is a pass-through of
row.hostContextLabel). Input: local reporepo-1+ SSH reporepo-remote(ssh:gpu-vm), remote worktree pinned, default pinned policy,hostLabelById = { local -> "This computer" label, ssh:gpu-vm -> "gpu-vm" }.Before (origin/main
bcd4076dd12) — pinned remote row has no label; it also appears nowhere else:After — same input:
Holds for
repo,workspace-status, andnonegrouping, and forshowPinnedWorktreesInGroups: true(both copies labelled). Single-host sidebar with a pinned row: no label on any row, before and after.Testing
pnpm test src/renderer/src/components/sidebar/worktree-list-groups-pinned-host-labels.test.ts: 6/6 pass with the fix; 5/6 fail on origin/main behaviour (both arms reverted).Per-arm mutation testing, each arm reverted independently while the other is kept:
emitPinnedGroup): 5 of 6 fail.naturalWorktrees): 4 of 6 fail (theshowPinnedWorktreesInGroups: truecase survives, as expected: under that policy the natural set already contains the pinned rows).pnpm test src/renderer/src/components/sidebar/: 299 files / 2515 tests pass.pnpm tc:webclean;oxlintandoxfmtclean on changed files;pnpm run check:code-quality:changed0 findings.Platforms: macOS (row model is platform-independent; the reporter's setup is Windows + remote Orca server, and the same code path builds the rows there).
I manually tested these changes locally
Automated tests added/updated, or explained why not below
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
Left as-is on purpose:
ImportedWorktreesVisibilityLine.tsx:159suppresses the host label forplacement === 'pinned-fallback'. That is a notice row, not a worktree card, and looks deliberate.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)