Repository navigation
feat(sidebar): bindable shortcut to show or hide child workspaces - #24165
Conversation
|
There was a problem hiding this comment.
ℹ️ Minor suggestions only. One rough edge on when the shortcut becomes a no-op.
Reviewed changes
- New bindable action
sidebar.childWorkspaces.toggle— ships unbound on every platform and appears under Global in Settings → Keyboard Shortcuts; dispatched next toworkspace.deleteinuse-global-keybindings.ts. child-workspaces-toggle-target.ts— resolves the hovered card (or the active workspace when nothing is hovered) to its own lineage collapse key, or its immediate parent's key when the target is a leaf child;nullfalls through.app-command-handlers.ts— records the sidebar scroll anchor, flipscollapsedGroups, and opens the sidebar when expanding.- Shared
getHostScopedWorktreeLineageInputs— extracted from the inline narrowing inpending-reveal-inputs.tsand reused by the resolver, so both share one host-scoped lineage projection. - Registry, types, docs, tests — definition plus
KeybindingActionIdunion,settings.mdx/worktrees.mdx, targeted unit tests, and a headless e2e.
ℹ️ Nitpicks
- The resolver can count children the sidebar is not rendering, so a press can be a silent no-op.
resolveChildWorkspacesToggleGroupKeybuilds its child set fromgetAllWorktreesFromStatefiltered only by archived + host, whereas the chip'slineageChildCountcomes from the sidebar'svisibleWorktrees, which also hides sleeping, detached-HEAD, CLI-created, automation, other-device, and repo-filtered rows. When every child of the hovered/active workspace is filtered out, no chip renders, yet the shortcut still flipslineage:<target>and (when "expanding") callssetSidebarOpen(true)— the sidebar opens with nothing visibly folded. It is low impact and the persisted collapse state being visibility-independent is defensible, so this is an observation rather than a required change; if you want a press to always have a visible effect, feeding the resolver the same visible set (or documenting the intent) would close the gap.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📥 CommitsReviewing files that changed from the base of the PR and between 3fc47cb8fbae1ee045a127c9c50e6bae919e0ced and 59760f4. 📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughAdds an unbound, configurable Toggle Child Workspaces shortcut. It targets the hovered worktree, or the active worktree when none is hovered. For a child worktree without children, it targets the parent’s children. The command toggles the matching sidebar group and opens the sidebar when it reveals hidden children. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No confirmed issue remains from this review. The reported Linux scroll-test failure should still be checked before relying on that test result. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The shortcut changes sidebar visibility through the existing collapse behavior. It checks workspace identity and input ownership, and no additional execution, credential, or data-access authority was found. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: d3c36485-df28-46fa-99f7-f2da8d30e348
📥 Commits
Reviewing files that changed from the base of the PR and between d74388f and 12e8e20090f1198ba6e55fd60bcfdd2fdbe1584c.
📒 Files selected for processing (13)
docs/site/content/docs/model/worktrees.mdxdocs/site/content/docs/settings.mdxsrc/renderer/src/app-shell/app-command-handlers-child-workspaces.test.tssrc/renderer/src/app-shell/app-command-handlers.tssrc/renderer/src/app-shell/use-global-keybindings.tssrc/renderer/src/components/sidebar/child-workspaces-toggle-target.test.tssrc/renderer/src/components/sidebar/child-workspaces-toggle-target.tssrc/renderer/src/components/sidebar/worktree-lineage-projection.tssrc/renderer/src/components/sidebar/worktree-list/navigation/pending-reveal-inputs.tssrc/shared/keybindings-unassigned-actions.test.tssrc/shared/keybindings/definitions-core-4.tssrc/shared/keybindings/types.tstests/e2e/worktree-lineage-toggle-shortcut.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — the flagged no-op is fixed; one narrow render-parity rough edge inline.
Reviewed changes
Since the prior pullfrog review, commit 0de11fd closed the gap the previous review raised.
- Chip-render gate —
resolveChildWorkspacesToggleGroupKeynow takes the set of lineage keys whose chip the sidebar currently renders (renderedChipKeys) and flips only those, so a target whose children are all filtered out falls through instead of flipping an inert key and opening the sidebar. getRenderedLineageChipKeys— new function that recovers that key set by replayingcomputeVisibleWorktrees+ the sidebar's row pipeline and collecting item rows with a chip.computeRenderedSidebarRows— split out ofcomputeRenderedSidebarWorktreesso the Cmd+1–9 order path and the new chip-key set share onebuildRowscall; also exports theHostSectionRowtype.getHostScopedWorktreeLineageInputs— the inline same-host lineage narrowing frompending-reveal-inputs.tsbecame a shared helper, now reused by the resolver's parent lookup.- Tests — resolver cases for hidden-chip, archived-parent, stale-instance and cross-host paths, plus an e2e filter case asserting
collapsedGroupsis left untouched when the child (and its chip) is filtered out.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Guard parent fallback with valid lineage children, not… · child-workspaces-toggle-target.ts:77-83
src/renderer/src/components/sidebar/child-workspaces-toggle-target.ts:77-83
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winGuard parent fallback with valid lineage children, not rendered chips.
When a target has valid children but filtering removes their chips,
renderedChipKeysdoes not contain the target key. The current branch then falls back to the parent and toggles the parent group. Check the host-scoped lineage projection before using the parent fallback.Do not use raw
hostIdequality. Legacy hostless rows and explicitlocalrows use different representations, and effective host identity can come from repository metadata. UsegetHostScopedWorktreeLineageInputswithgetWorktreeExecutionHostId, then inspectgetProjectedWorktreeLineageChildrenByParentId.Suggested fix
import { getAllWorktreesFromState, getRepoMapFromState, getWorktreeOnHostFromState } from '@/store/selectors' import type { AppState } from '@/store/types' +import { getWorktreeExecutionHostId } from '../../../../shared/execution-host' import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' import type { Worktree } from '../../../../shared/worktree/types' ... import { getHostScopedWorktreeLineageInputs, + getProjectedWorktreeLineageChildrenByParentId, getWorktreeLineageAncestors } from './worktree-lineage-projection' type ChildWorkspacesToggleState = Pick< AppState, - 'activeWorkspaceExecutionHostId' | 'activeWorktreeId' | 'worktreeLineageById' | 'worktreesByRepo' + | 'activeWorkspaceExecutionHostId' + | 'activeWorktreeId' + | 'repos' + | 'worktreeLineageById' + | 'worktreesByRepo' > ... -function getParentWorktree( +function resolveParentLineage( state: ChildWorkspacesToggleState, target: Worktree -): Worktree | undefined { +): { parent: Worktree | undefined; hasValidChildren: boolean } { // Why: the sidebar nests a child only under a parent on the same host, and archived rows never render. - const worktrees = getAllWorktreesFromState(state).filter( - (worktree) => worktree.hostId === target.hostId && !worktree.isArchived - ) - const { worktreeMap, lineageById } = getHostScopedWorktreeLineageInputs( + const repoMap = getRepoMapFromState(state) + const executionHostId = getWorktreeExecutionHostId(target, repoMap.get(target.repoId)) + const inputs = getHostScopedWorktreeLineageInputs( + getAllWorktreesFromState(state).filter((worktree) => !worktree.isArchived), + state.worktreeLineageById, + executionHostId + ) + const childrenByParentId = getProjectedWorktreeLineageChildrenByParentId( + inputs.lineageById, + inputs.worktreeMap + ) + return { + parent: getWorktreeLineageAncestors(target, inputs.lineageById, inputs.worktreeMap)[0], + hasValidChildren: (childrenByParentId.get(target.id)?.length ?? 0) > 0 + } - worktrees, - state.worktreeLineageById, - target.hostId - ) - return getWorktreeLineageAncestors(target, lineageById, worktreeMap)[0] } ... - const parent = getParentWorktree(state, target) + const { parent, hasValidChildren } = resolveParentLineage(state, target) + if (hasValidChildren) { + return null + } const parentKey = parent ? getWorktreeLineageGroupKey(parent) : null
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 56ba15fa-6e06-4bfb-b15d-bd99738ba8e9
📥 Commits
Reviewing files that changed from the base of the PR and between 0de11fd9b092743ef65bb15af8833494f2e6c948 and f8702ec14ffd0720bb059b3abddc2ee5c69f4d7a.
📒 Files selected for processing (1)
docs/site/content/docs/model/worktrees.mdx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Adds an unbound 'Toggle Child Workspaces' action. It flips the same lineage collapse key as the children chip, for the hovered card or the active workspace, or the parent's key when the target is a leaf child. Fixes stablyai#24163
…ders Resolve the shortcut against the sidebar's own row pipeline, so a filter or grouping that hides every child (and with it the chip) leaves the chord untouched instead of flipping hidden collapse state.
3fc47cb to
8e499dc
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior pullfrog review, the newest commits close the render-parity gap it flagged and add the shortcut's dialog guard.
- Mounted chip-key publishing —
useSidebarWorktreeSelectionnow publishes each rendered row'slineageGroupKeyonVisibleWorktreeShortcutTarget, so the resolver's chip set tracks the mounted list's forced-reveal, effective-collapse, and host-drag policy instead of only the canonical replay. - Authoritative mounted set —
getRenderedLineageChipKeystrusts the published list whenever it is non-null (including empty) and replays canonical rows only while the sidebar list is unmounted. - Dialog guard — the handler now returns the chord to focused content when
activeModalis set, a floating workspace is focused, or a visible[role="dialog"]/[role="alertdialog"]is on screen, while listboxes and menus still pass through; a scroll-anchor ordering assertion was added. - Coverage — a new visibility unit test plus e2e cases for locally controlled dialogs, hover/active precedence, folder pass-through, stale instances, pinned duplicates, restart persistence, and scrolled-anchor behavior.
The prior child-workspaces-toggle-target.ts:93 thread is resolved: chip keys now come from the mounted rows, and the chip predicate (lineageGroupKey && lineageChildCount > 0) matches the card's own chip condition.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Wait for observed scroll and row geometry to stay unchanged for 500ms, then complete two animation frames before measuring. Keep the original shortcut sequence and both strict two-pixel assertions. This changes fixture preparation only.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior pullfrog review, the newest commits harden the lineage acceptance fixtures and pin them to background launch.
- Scroll fixture readiness helper — new
waitForLineageScrollFixtureReadywaits for the parent row and mounted virtual rows to hold a stable geometry signature for 500ms (and for scrolling to stop), then completes two animation frames before the scroll spec freezes itsbeforegeometry. - Background launch on CI — the dialog, scroll, and shortcut lineage specs now declare
test.use({ launchEnv: { ORCA_BACKGROUND_LAUNCH: '1' } })so fixtures stay off screen, matching the repo's automated-run policy.
The strict two-pixel assertions and the original shortcut sequence are unchanged, so the adjustment pre-settles the measurement fixture rather than relaxing the check.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
…/risk-24165-20261003

ELI5
The sidebar already lets you click a parent workspace’s child chip to show or hide its children. You can now assign Toggle Child Workspaces in Settings → Shortcuts and perform that same action from the keyboard.
What Changed
Adds one unassigned Global action. It uses the workspace under the pointer, otherwise the active workspace; a card without its own chip uses its valid parent’s rendered chip. With no eligible chip, including folder cards, the shortcut leaves the key available to the focused content. Central and locally controlled dialogs, and floating workspaces, keep their input.
The handler writes the same persisted collapse setting as the chip (
toggleCollapsedGroup) and records the sidebar position before changing it. The existing displayed-row list now carries each card’s chip key, so temporary reveal/drag visibility agrees with the shortcut. When the sidebar is closed, it reuses the existing row builder. Workspace identity still includes its host; expanding a family opens the sidebar.Why
This gives keyboard access to an existing action while keeping the chip as the authority for eligibility and collapse state. Reusing the displayed targets and existing row builder avoids maintaining separate child counts or visibility rules.
Linked Issue
Fixes #24163
Visual Proof
Captured from hidden Electron renderers through Playwright CDP with disposable profiles. The baseline is
0f167ac659744fa78500281532645b8f648adbe5; after captures are from8e499dc8d81965a53be375b5713eabf77dd52a5a. Media is uploaded, not committed.[email protected]
Additional scrolled acceptance
Keyboard and chip preserve the scrolled parent; expanding from a closed sidebar opens it. Recorded from three passing runs.
[email protected]
Dialog input acceptance
A locally controlled Delete Project Group dialog keeps the chord and leaves the child group expanded; the preceding nonmodal menu permits the existing action. Recorded from three passing runs.
[email protected]
Testing
Reproduce: Settings → Shortcuts → search Toggle Child Workspaces → assign a chord (tested with Cmd+Option+H). With a parent active, move the pointer away from the sidebar and press it twice; then hover another parent or a leaf child and repeat. Compare with clicking the child chip. A hovered/active folder or a family with no rendered chip leaves the chord unclaimed.
Acceptance covers actual Settings recording, active/hovered parent precedence, active/hovered leaf-parent fallback, stale lineage, filtered sleeping children, folder pass-through, pinned duplicates, central/local modal and floating guards, persisted collapse after restart, scrolled anchor position, and sidebar opening on expansion. Renderer-hook regressions reproduced both transient visibility gaps before fixing them.
pnpm tc, real oxlint, 20-file format check, changed-lines code-quality/design gate and E2E-mode build pass. Separatepnpm typecheck:e2ehas 169 existing normalized diagnostics: identical baseline and final sets, with zero additions. The earlier Linux run at8e499dc8failed the scrolled-parent assertion with a 123-pixel difference against its two-pixel limit. The follow-up stabilizes only the virtual list before capturing the baseline: mounted rows must stay quiet for 500 ms and two animation frames. Both strict post-action limits remain unchanged. An intermediate isolated Linux run at59760f41passed all 12 cases.At current
f83edd57e441b2bc96cda55eb60b400cffab6bea, required CI passes. The final-source Linux rendered job selected all three lineage specs and passed 12 tests, zero failures and no retries: strict keyboard/chip scroll preservation, shortcut recording, modal and floating guards, hovered-parent precedence, stale/folder/filter handling, pinned duplicate state, and restart persistence. The app-build job and test job both checked out this exact head, and all three specs explicitly useORCA_BACKGROUND_LAUNCH=1. No older-head result is substituted for this final-source proof.AI Disclosure
Original contributor disclosure: written with Claude Opus 5.5 (Anthropic) in the pi coding agent, with human direction on scope and behaviour. This disclosure is retained from mmarabel’s original PR.
Review
Final merge review confirms that Toggle Child Workspaces remains unassigned by default on macOS, Linux and Windows. The effective-binding regression passes at
f83edd5: no default chord is claimed, and a user-supplied override works. The final-source rendered Settings/recording/reset and restart checks above also pass. Cross-reference review of issue #24163 found this PR as its only linked implementation; there is no sibling contributor PR to consolidate. Original contributor mmarabel is credited in the squash commit. Existing bot findings are fixed, withdrawn or explicitly addressed in the review below.Independent read-only review is clean, including the reproduced and fixed local-dialog finding. The reviewer captured clean start/end status, all 31,712 tracked blobs, and unchanged source throughout the review. Exact source head
8e499dc8d81965a53be375b5713eabf77dd52a5a, tree44f19a82d318031b391b8fce45faa409a0275216.This continues mmarabel’s original contribution in this same PR. All four original commit authors, dates and messages are preserved; there were no recorded coauthors. The follow-up adds reproduced guard/visibility fixes and focused acceptance coverage.
Old review findings were checked against this head. Hidden-child mutation and temporary mounted visibility are fixed and covered; the mounted-visibility thread is resolved. The outside-diff parent-fallback recommendation would change the documented chip rule: the passing child/grandchild fixture deliberately uses the parent chip when the child has no rendered chip. Raw host matching follows the actual row builder, as CodeRabbit confirmed when withdrawing normalization. Browser-guest forwarding remains the disclosed scope limitation. Old reviews are not fresh-head coverage.
Agent skill upstream boundary
Notes
Merge risk is low after final-source Linux rendered verification, focused source tests and passing required CI. Grouping, filtering, pinning, stale lineage and host identity agree with the mounted-sidebar cases covered by those checks. Keyboard parsing, pinned labels/card layout, remote execution and wire contracts are untouched.
User-facing tradeoffs: the action requires assigning a binding; hover takes precedence over the active workspace; using a leaf child folds its parent’s whole child group. Folder cards have no chip, and focused embedded browser guests retain their existing renderer-shortcut limitation. macOS hidden rendering is validated; Linux/Windows native input, visible-window focus and live SSH execution were not exercised. The final-source Linux rendered job and required repository gate pass. Broader Windows geometry and physical native keyboard input remain untested; old-head bot reviews are not fresh coverage.
Checklist