Skip to content

fix(sidebar): label pinned rows with their host on a multi-host sidebar - #19351

Merged
nwparker merged 1 commit into
mainfrom
fix/pinned-rows-host-context-label
Sep 8, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/pinned-rows-host-context-label

Conversation

@nwparker

@nwparker nwparker commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​119 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​119
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6

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: mixedWorktreeHostContextLabels is now computed over worktrees (the full set) instead of naturalWorktrees (which, under the default showPinnedWorktreesInGroups: false policy, has the pinned worktrees filtered out). The map is passed to emitPinnedGroup.
  • src/renderer/src/components/sidebar/worktree-list/grouping/pinned-group-rows.ts: emitPinnedGroup accepts hostContextLabelByWorktreeIdentity and forwards it to appendWorktreeRows, matching the All lane and every grouped lane.
  • New test src/renderer/src/components/sidebar/worktree-list-groups-pinned-host-labels.test.ts.

Why

appendWorktreeRows (row-builders.ts:138, :208) is the only writer of hostContextLabel on item rows, and emitPinnedGroup was the only section emitter calling it without the identity-keyed map. Two arms, both required:

  1. Plumbing gap: Pinned rows were emitted with no map at all, so hostContextLabel was always undefined for them.
  2. Map scope: simply forwarding the existing map is not enough. Under the default pinned policy the map was built from 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 was undefined entirely.

The "only badge when hosts are mixed" rule is unchanged: getMixedHostContextLabels still returns undefined for 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; getRenderableFolderWorkspaces path 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 repo repo-1 + SSH repo repo-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:

{ id: 'wt-remote', sectionKey: 'pinned', hostContextLabel: undefined }
{ id: 'wt-1',      sectionKey: 'repo:repo-1', hostContextLabel: undefined }   // map was undefined: natural lane had one host

After — same input:

{ id: 'wt-remote', sectionKey: 'pinned',      hostContextLabel: 'gpu-vm' }
{ id: 'wt-1',      sectionKey: 'repo:repo-1', hostContextLabel: <local label> }

Holds for repo, workspace-status, and none grouping, and for showPinnedWorktreesInGroups: 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:

    • Revert arm 1 only (drop the map from emitPinnedGroup): 5 of 6 fail.
    • Revert arm 2 only (map over naturalWorktrees): 4 of 6 fail (the showPinnedWorktreesInGroups: true case survives, as expected: under that policy the natural set already contains the pinned rows).
    • Neither mutation is inert; the single-host negative control passes in every configuration.
  • pnpm test src/renderer/src/components/sidebar/: 299 files / 2515 tests pass.

  • pnpm tc:web clean; oxlint and oxfmt clean on changed files; pnpm run check:code-quality:changed 0 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

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and 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:159 suppresses the host label for placement === 'pinned-fallback'. That is a notice row, not a worktree card, and looks deliberate.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

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
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 0c55ee3f-d61b-4ae1-84dc-3c9b07a715d3

📥 Commits

Reviewing files that changed from the base of the PR and between d0506bf and 4045ff0.

📒 Files selected for processing (3)
  • src/renderer/src/components/sidebar/worktree-list-groups-pinned-host-labels.test.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/build-rows.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/pinned-group-rows.ts

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


📝 Walkthrough

Walkthrough

buildRows now detects mixed-host context labels from all worktrees, including pinned worktrees. emitPinnedGroup forwards these labels to pinned row rendering. Tests cover multiple groupings, pinned rows rendered in groups, both hosts pinned, and single-host sidebars.

Merge Risk: ⚪ Minimal · up to 4045f

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: adding host labels to pinned sidebar rows on multi-host sidebars.
Description check ✅ Passed The description is complete and follows the repository template. It explains the change, rationale, linked issue, testing, scope, and compatibility considerations. Visual proof is provided as row-mode…
Linked Issues check ✅ Passed The changes satisfy issue #18472 by computing host labels from all worktrees and passing the label map to pinned rows. The added tests cover remote pinned worktrees and preserve single-host behavior.
Out of Scope Changes check ✅ Passed The changes are limited to pinned-row host-label plumbing, mixed-host label computation, and focused regression tests. No unrelated behavior, wire protocol, SSH execution, or folder workspace logic is…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Full-set mixed-host map — getMixedWorktreeHostContextLabels in build-rows.ts now runs over the full worktrees set rather than naturalWorktrees, so pinned worktrees count toward the sidebar-level "hosts are mixed" decision and their identities land in the label map.
  • Pinned-section plumbing — emitPinnedGroup accepts a new optional hostContextLabelByWorktreeIdentity and forwards it to appendWorktreeRows, closing the one section-emit path that never passed the identity-keyed map.
  • Regression tests — new worktree-list-groups-pinned-host-labels.test.ts covers the pinned-only mix, repo/workspace-status/none grouping, duplicate-in-groups, and a single-host negative control with exact toEqual assertions (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.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 7adb5b3 into main Sep 8, 2026
29 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]: Remote Server Name missing from PINNED

1 participant