Skip to content

fix(sidebar): keep child-agent arrows inside nested worktree cards - #23564

Closed
nwparker wants to merge 1 commit into
mainfrom
nwparker/nested-outside-UX
Closed

nwparker wants to merge 1 commit into
mainfrom
nwparker/nested-outside-UX

Conversation

@nwparker

@nwparker nwparker commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​115 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​115
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​17

ELI5

Keep the child-agent arrow inside a nested worktree card without breaking the alignment of nearby agents.

What Changed

Compact agent lists with children now reserve room for the disclosure arrow across the entire list. They reserve more space when the workspace status icon is hidden, because that removes the card's existing gutter. Parent and independent sibling status dots stay aligned, and child agents stay indented.

Why

Moving only the arrow's row inward fixed the overflow but misaligned parents with siblings and children. Reserving space for the list preserves the existing tree layout and hit targets. The tradeoff is slightly earlier text truncation in narrow cards.

Linked Issue

User-reported screenshot; no existing issue.

Visual Proof

Hidden Electron screenshots with seeded agent/worktree state. Before restores the original list padding through CDP; after uses the final built code. Each image shows the full worktree sidebar. Top-level and nested worktrees appear together.

Example Before After
Collapsed nested card Before After
Expanded parent, children and independent sibling Before After
Expanded agents, light theme Before After
Status hidden, narrow sidebar Before After

Testing

  • Manually inspected rendered macOS Electron screenshots via CDP; windows remained hidden.
  • Added a rendered regression test: card containment, aligned sibling dots, indented children, 280/410px sidebars, status shown/hidden, mouse collapse and keyboard expansion. Passes with the fix; fails with original padding restored.
  • 41 focused agent-row tests passed; renderer typecheck and changed-code quality gate passed; Electron e2e build passed.
  • Captured 14 before/after state pairs across light/dark themes, collapsed/expanded agents, multiple roots, narrow width, hidden status, and alternate card style.
  • Windows, Linux, live SSH, and deeper workspace nesting were not run. This changes shared renderer spacing only; no execution, provider, persistence, or wire behavior changes. Folder cards use the same presentation path.

Review

Adversarial review caught and fixed sibling/child misalignment in the first approach and overflow when status is hidden. Final screenshot review found no blocking issues. Gemini orchestration was unavailable because this session had no sender mailbox; two agents inspected the screenshots instead.

Agent skill upstream boundary

  • Not applicable; no upstream skill source copied.

Notes

Full agent rows and compact lists without child agents keep their existing spacing.

Checklist

  • Small, focused change
  • Explained behavior, mechanism, and approach
  • Before/after screenshots attached
  • Reviewed correctness, security, and performance
  • Considered cross-platform and remote behavior
  • Focused tests, renderer typecheck, changed-code lint, and Electron build pass; full repository suites left to CI

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f80bd890-42f1-46eb-b9e0-2f5f351450aa

📥 Commits

Reviewing files that changed from the base of the PR and between 0de5e4d and 296c7fd.

📒 Files selected for processing (3)
  • src/renderer/src/components/sidebar/WorktreeCardAgents.tsx
  • src/renderer/src/components/sidebar/worktree-card-secondary-rows.tsx
  • tests/e2e/worktree-agent-disclosure-layout.spec.ts

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


📝 Walkthrough

Walkthrough

The compact agent list now receives status-gutter visibility and adjusts lineage-row padding accordingly. An end-to-end test checks layout at two sidebar widths with status shown and hidden, and verifies disclosure toggling and worktree selection.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 296c7

The nested-card disclosure layout is covered by the new test, and no actionable merge-blocking issue remains after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 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 main change: keeping child-agent disclosure arrows inside nested worktree cards.
Description check ✅ Passed The description is complete and closely follows the repository template. It explains the user-facing change, implementation, rationale, testing, visual proof, review, and compatibility considerations.…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@nwparker nwparker closed this Sep 28, 2026

@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 critical issues — one minor note inline.

Reviewed changes

  • Compact agent-list gutter fix — WorktreeCardAgents now adds hasLineage && (hasStatusGutter ? 'pl-3' : 'pl-7') to the compact list root, so the parent disclosure chevron (hung left with -ml-5) stays inside the card surface and the parent/sibling/child state-dot columns stay aligned.
  • Gutter signal wiring — WorktreeCardSecondaryRows passes presentation.showCombinedStatusSlot down as the new hasStatusGutter prop.
  • Rendered regression spec — new tests/e2e/worktree-agent-disclosure-layout.spec.ts seeds a lineage scenario and polls containment plus dot-column alignment across 410/280px widths and status shown/hidden, toggling the disclosure with both mouse and keyboard.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

className={cn(
'flex flex-col mt-1 gap-0.5',
// Reserve the disclosure gutter for every row so parent, sibling and child columns stay aligned.
hasLineage && (hasStatusGutter ? 'pl-3' : 'pl-7'),

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.

This pl-7 branch is unreachable in production — status is a fixed card property (FIXED_WORKTREE_CARD_PROPERTIES in src/shared/worktree/card-properties.ts:5) that normalizeWorktreeCardProperties re-adds on every write, so showCombinedStatusSlot is always true. The test only reaches the status-hidden case by writing worktreeCardProperties through store.setState, which bypasses normalization; a real user cannot hide the status icon. If that is deliberate future-proofing, fine — otherwise the hasStatusGutter prop and the showStatus: false test axis can be dropped and the fix reduced to pl-3.

Technical details
# `hasStatusGutter` false branch is unreachable

## Affected sites
- `src/renderer/src/components/sidebar/WorktreeCardAgents.tsx:381` — `hasLineage && (hasStatusGutter ? 'pl-3' : 'pl-7')`.
- `src/renderer/src/components/sidebar/worktree-card-secondary-rows.tsx:70` — passes `presentation.showCombinedStatusSlot`.
- `tests/e2e/worktree-agent-disclosure-layout.spec.ts:100-101` — filters `'status'` out of `worktreeCardProperties` via `store.setState`.

## Why it is unreachable
- `use-worktree-card-controller.ts:34` derives `showStatus = cardProps.includes('status')`.
- Every writer of `worktreeCardProperties` (`setWorktreeCardProperties`, `setWorktreeCardMode`, hydration, main-process read/update, RPC client params, web preload) runs `normalizeWorktreeCardProperties`, which starts from `['status', 'unread']` and always re-adds them (`src/shared/worktree/card-properties.ts:5,61-72`).
- `worktree-card-presentation.tsx:93` sets `showCombinedStatusSlot = showStatus`, so `hasStatusGutter` is a constant `true` in any reachable UI state.

## Required outcome
- Either confirm/justify keeping the defensive branch, or simplify the fix (drop the prop + ternary and the test's `showStatus` axis). No behavior change either way for reachable states.

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.

1 participant