You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(sidebar): nest project groups from the group menu - #26194
You can already put projects into groups, but only one level deep. This lets you put a group inside another group (for example a "Clients" group holding one group per client) straight from the group's ⋯ menu: New subgroup creates one inside it, and Move to group moves an existing group under another one, or back to the top level.
What Changed
Before: a group's ⋯ menu only offered Rename and Delete. Nesting existed only when a folder import created it, so people encoded hierarchy in names ("acme / web", "acme / infra"). A project's Move to group submenu was a flat list, so two groups with the same name in different branches were indistinguishable.
After:
The group menu gains New subgroup and a Move to group submenu (Top level + every valid parent, indented as a tree). The current parent is shown but disabled; the group itself and its own subgroups are never offered.
A project's Move to group submenu shows the same indented tree.
New subgroup is disabled at the depth cap (3 levels, top level = 1), as suggested in the issue. The cap applies to manual creates and moves only; deeper trees from folder imports keep working and can still be moved shallower.
The delete dialog now says when subgroups will be deleted with the group (the host already cascaded; the dialog just didn't say so).
After a create or move, the sidebar reveals the group, so it doesn't vanish into a collapsed parent.
Mechanism:
projectGroup.update and projectGroup.updateMany (IPC + runtime RPC) accept an optional parentGroupId (null = top level), so a move goes through the same updateProjectGroups path as reordering. The host that owns the group validates every move in src/shared/project/groups/project-group-nesting.ts: no self, no descendant, no other host, no deeper than the cap. A batch is checked in full before any of it applies. A manual subgroup inherits its parent's host (connectionId).
Top-level order: a group moved to the top level takes the last top-level slot (rootProjectOrder), computed across every host's catalog as for a new group. A group moved under a parent drops its rootProjectOrder, since only top-level entries rank by it, so moving it back out never restores a stale slot. The host applies the same rule when a client sends only parentGroupId.
Mixed versions: an older host silently strips the unknown field and answers with the unmoved group, so the client only sends a move, or a subgroup create, to remote runtime hosts that advertise the new runtime capability projectGroup.nesting.v1. Otherwise it shows a "could not confirm" toast instead of pretending it worked. A subgroup create also sends the parent's connectionId, so a host that predates nesting keeps the subgroup on the right SSH target.
normalizeProjectGroups now breaks parent cycles in persisted data, since the sidebar renders from roots and a cycle would hide every group in it. The sidebar also resolves parent links inside each host's catalog, so equal group ids on two hosts can't link into a loop.
Why
Folder imports already produce nested groups and the sidebar already renders them; the missing piece was a way to build or change that structure by hand (#8785).
Menu-only, no drag-to-nest. Dragging a header already means "reorder among siblings". Overloading that drop zone needs its own hit-testing and UX decisions, and it is the part that made earlier attempts large. The menu path is discoverable, works with keyboard and screen readers, and gives drag-to-nest a validated backend to build on in a follow-up.
Validation lives on the host, not only in the menu, so the CLI, mobile and remote clients can't create cycles or cross-host parents.
A capability gate rather than a protocol bump, so mixed client/host versions keep working and degrade to a clear message.
Depth cap = 3, as the issue suggested: deeper than that, the indentation eats the sidebar width. It is one constant (MAX_PROJECT_GROUP_LEVELS). Folder imports stay exempt, and an imported tree that is already deeper can still be moved shallower, never deeper, so the cap never traps existing data.
Prior work: #8939 (drag-and-drop, by the issue author) has had merge conflicts since July, and #19125 bundles a broader "client" model. This PR is the narrow, menu-only slice that can land on its own. Drag-to-nest from #8939 can build on top of it.
Headless Electron build, macOS, same seeded data on both sides (left: main at 2584ed9, right: this branch).
Sidebar tree: groups can now nest.
Group ⋯ menu: adds New subgroup and Move to group.
Project → Move to group: an indented tree instead of a flat list.
New: Group → Move to group. Top level is offered, the current parent is shown but disabled, and the group's own subtree is hidden.
Testing
pnpm typecheck and the e2e typecheck: pass.
pnpm check:changed gates (oxlint, every ratchet, verify:rpc-params-catalog, localization catalogs and extraction, max-lines, changed-code quality) and oxfmt --check on the committed files: pass.
Unit tests: the 7 test files this PR adds pass (39 tests). The wider related run (every suite importing a changed module) was cut short on this machine; the only failures it reached are Windows filesystem ones (EBUSY, git worktree remove) in orca-runtime.test.ts, which this PR does not touch. CI runs the full suite.
New tests:
shared/project/groups/project-group-nesting.test.ts: depth, subtree span, move rejections, and the rule that imported deep trees can still move shallower.
shared/project/groups/project-groups.test.ts: parent-cycle breaking, linear on a 50,000-group cycle.
shared/sidebar-list/sections/project-group-tree.test.ts: same-id groups on two hosts can't link into a hidden loop.
main/persistence/tracking-repos/persistence-project-group-nesting.test.ts: host-side validation, parent-host inheritance, renames inside over-deep imported trees, and top-level order on move.
renderer/src/store/project-groups/repos-project-group-nesting.test.ts: owner-host routing, capability gate, the old host that ignores the move, and top-level placement across hosts.
sidebar/worktree-list/rows/project-group-move-targets.test.ts, project-group-header-actions.test.tsx: menu targets, tree order, host isolation.
tests/e2e/project-group-nesting.spec.ts (headless Electron, 4 tests): create a subgroup, cap at level 3, move in and out, own subtree never offered (and the submenu disappears when no valid parent is left).
Cases this PR had added to suites that main has since removed (IPC and RPC parentGroupId round-trips, delete-dialog copy, dialog owner-host toasts) went with those suites.
Platforms: macOS (unit + headless e2e, before the merge with main), Windows (typecheck, lint, unit, after it). No platform-specific code: no shortcuts, paths or process spawning. SSH and remote behaviour is covered by the routing and capability unit tests above.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
AI coding agents were used for this PR. Claude (Anthropic, Claude Opus 5.5, via Claude Code) verified the change, rebased it onto main, ran the checks and e2e tests, captured the screenshots, did the review below, and drafted this description. All of it was reviewed by me before submission.
Review
AI review summary of the final diff:
Cross-platform: no OS-specific code paths, shortcuts, file paths or child processes. Menu indentation uses the existing PROJECT_GROUP_HEADER_INDENT constant (inline style, because computed padding classes on menu primitives are lint-gated).
SSH / remote / local: every mutation routes to the group's owner host, not the focused one. Move targets are limited to the moving group's catalog, where local and direct-SSH rows share one catalog and each runtime host has its own. Cross-host parents are rejected on the host. Mixed versions are handled by the projectGroup.nesting.v1 capability gate, and an unreachable host or timeout ends in a "could not confirm" toast, never a false success.
Agents and integrations: none involved; this is sidebar organization only, with no agent, git-provider or integration-specific logic.
Performance: move checks index the subtree once, then evaluate each candidate parent linearly. The target tree is built only while a menu is open, never per sidebar row. Cycle breaking memoizes walks that reach a root, so it stays linear on large catalogs.
UI quality: uses the existing shadcn DropdownMenu* primitives and tokens, with no new colors or restyles (design-system gate: 0 findings). Long trees scroll inside the submenu (max-h-80). New strings go through translate() with hashed auto.* keys, seeded in all 11 locales.
Security:parentGroupId is validated with zod (min(1), nullable, optional) on both IPC and RPC, and existence, host and cycle checks run on the host before anything is persisted. There are no new filesystem, shell or network surfaces.
src/shared/project/groups/project-group-nesting.ts: the rules.
src/main/persistence/tracking-repos/project-group-operations.ts: host-side enforcement and top-level order on move.
src/renderer/src/store/project-groups/project-group-mutations.ts and project-group-update-persistence.ts: routing, the capability gate and top-level placement.
src/renderer/src/components/sidebar/worktree-list/rows/project-group-move-targets.ts, ProjectGroupMoveSubmenu.tsx and project-group-header-actions.tsx: the UI.
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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance. All of these are covered in Review above. Mobile has no group-editing UI; it only reads parentGroupId to resolve group subtrees (agent-history-resume-target.ts), which already handles imported nested trees and is cycle-safe.
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)
Folder imports already create nested groups and the sidebar renders them,
but nothing let a user build or change that hierarchy by hand. Group
headers now offer "New subgroup" and "Move to group" (capped at five
levels for manual changes), and the project "Move to group" submenu shows
the tree indented.
Moves are validated on the host that owns the group (no self, descendant,
cross-host, or too-deep parents). Clients only send a move to remote hosts
that advertise projectGroup.nesting.v1, because older hosts drop the field
and still return the unmoved group.
Refs stablyai#8785
stablyai#8785 suggested two or three levels: deeper than that, the indentation
eats the sidebar width. Folder imports stay exempt, and imported trees
deeper than the cap can still be moved shallower.
The change adds manual subgroup creation and project-group moves, with a three-level limit for manual nesting. Persistence validates parent changes, updates ordering, and routes operations to the owning host. Sidebar menus show valid destinations and expose subgroup creation and top-level moves. Delete confirmations report subgroup counts. The change also updates group-tree normalization, runtime capability handling, translations, and automated coverage.
Merge Risk: Low · up to df8a8
Nested group creation and moves work as described. Two scalability weaknesses remain for very large or very deep imported group trees: the move menu may stall while it builds, and occurrence-path construction may overflow the stack. Typical usage is unaffected. Fix both before merge, since each fix is small.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Out of Scope Changes check
Most changes connect to the nested project group feature: nesting rules, host validation, owner-host routing, menu and submenu UI, delete-dialog subgroup copy, cycle handling, and related tests and lo…
Provide the diff hunks for src/renderer/src/i18n/en-runtime-required.json (writeNotice keys) and src/shared/settings/default-global-settings.ts (buildDefaultSettings args type), or make the changed blobs available for inspection. If the wri…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title "feat(sidebar): nest project groups from the group menu" matches the main change: the PR adds subgroup creation and move-to-group actions to the project group menu, with nesting validation o…
Linked Issues check
Directly linked issue #8785 requests manual subgroup creation, changing a group's parent, a depth cap of 2 or 3 levels, and a "New subgroup" context-menu action. The supplied PR summary shows: (a) "Ne…
Description check
The description follows the template and covers ELI5, What Changed, Why, Linked Issue (Fixes #8785), Visual Proof (four before/after images), Testing with a checklist, Risk, AI Disclosure, Review, the…
Full details: Title check
Explanation
The title "feat(sidebar): nest project groups from the group menu" matches the main change: the PR adds subgroup creation and move-to-group actions to the project group menu, with nesting validation on the host. The title names the sidebar area and the menu entry point, which fits the changeset.
Full details: Linked Issues check
Explanation
Directly linked issue #8785 requests manual subgroup creation, changing a group's parent, a depth cap of 2 or 3 levels, and a "New subgroup" context-menu action. The supplied PR summary shows: (a) "New subgroup" in the group menu, disabled at the depth cap (MAX_PROJECT_GROUP_LEVELS = 3, src/shared/project/groups/project-group-nesting.ts); (b) a group "Move to group" submenu with a "Top level" destination, which covers un-nesting; (c) host-side validation in project-group-operations.ts for self, descendant, cross-host, and too-deep moves; (d) owner-host routing and a capability gate (projectGroup.nesting.v1) for remote moves; (e) persistence and e2e tests for these rules. The issue lists drag-to-nest as a proposed item but also accepts a context-menu-only approach. The PR states that drag-to-nest is a follow-up. The author's own alternatives in the issue allow this scope. The later changes (rootProjectOrder placement on moves, subtree-aware parent cycle breaking, host-scoped parent resolution) are supported by the summary and do not change these objectives. No coding requirement of the issue is shown as unmet. Drag-and-drop nesting is not implemented, which is accepted by the issue text. Diff blobs were unavailable, so this verdict relies on the supplied summary and PR description.
Full details: Description check
Explanation
The description follows the template and covers ELI5, What Changed, Why, Linked Issue (Fixes #8785), Visual Proof (four before/after images), Testing with a checklist, Risk, AI Disclosure, Review, the agent skill boundary, Notes, and Checklist. The Risk section is missing, though. The template requires a Risk section with a Level and a backout plan, and the description does not include one. The Testing section lists platforms and tests. The Review section covers cross-platform, SSH, and security concerns. Because the description is mostly complete, this check passes despite the missing Risk section.
Full details: Out of Scope Changes check
Explanation
Most changes connect to the nested project group feature: nesting rules, host validation, owner-host routing, menu and submenu UI, delete-dialog subgroup copy, cycle handling, and related tests and locale strings. Two items cannot be judged from the available evidence. (1) src/renderer/src/i18n/en-runtime-required.json changed in the writeNotice translations. The summary says a message for a conversation saved in another folder was removed and then restored under savedInOtherFolder. This is not part of project groups, and the net effect is not clear. (2) src/shared/settings/default-global-settings.ts changed the buildDefaultSettings parameter type from NotificationSettings to GlobalSettings['notifications']. This looks like a type-only refactor unrelated to nesting. Repository inspection of both files failed because the changed blobs are missing from the checkout, so the actual hunks could not be read. The summary does not show a link between these two items and the linked issue. No demonstrated unrelated change is confirmed.
Resolution
Provide the diff hunks for src/renderer/src/i18n/en-runtime-required.json (writeNotice keys) and src/shared/settings/default-global-settings.ts (buildDefaultSettings args type), or make the changed blobs available for inspection. If the writeNotice change and the settings type change are unrelated to project group nesting, remove them from this PR or move them to a separate PR. If they are needed by the nesting work, document the reason in the PR description.
Autopilot · 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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
A create call that named another connection than the parent's stored the
mismatch, so a later move under a valid group on the parent's host failed
with host-mismatch. Reject it up front; an omitted or null connection still
inherits the parent's.
Upstream now routes project group catalog calls by their owner host
(stablyai#27288): createProjectGroup takes the seeding project's host, and rows
are adopted through adoptFromEndpoint. Subgroup creation moves to its own
createProjectSubgroup action, routed by the parent group's owner like
moveProjectGroup, and the update/move helper uses the new owner routing.
protocol-version.ts re-exports the attention capabilities with a star,
as stablyai#27493 did for the resume ones, to stay within the line limit.
@brennanb2025 friendly ping on this one when you have a moment.
I merged main back in to clear the conflicts with #27288 (project group calls now route by their owner host). The only behavioral adjustment: creating a subgroup is now its own createProjectSubgroup store action, routed by the parent group's owner the same way moveProjectGroup is, since createProjectGroup now takes the seeding project's host. Typecheck, lint and the project-group unit tests pass locally.
Since this comes from a fork, the CI workflows are still waiting for a maintainer to approve the run.
Upstream renamed runtimeTargetForOwnerHostId to
ipcOrRuntimeTargetForHostId and dropped the RuntimeClientTarget re-export
(stablyai#27992), so createProjectGroup and the shared createOnTarget helper use
the new name and import the type from shared. ProjectGroupingModel moved
to shared/project-section-grouping (stablyai#28850). Locale conflicts were
sibling additions; both sides are kept.
The workspace-list builder moved to src/shared/sidebar-list (stablyai#29906), and
the sidebar now draws one header per project group id when two hosts
publish the same group (stablyai#30128). The branch linked each host's copy to a
parent on its own host, which assumed every copy was drawn; with copies
collapsed, parents now resolve by id over the drawn groups, the same links
reveal walks. Same-id copies from two hosts can still close a parent loop,
so section emission and getProjectGroupOccurrencePaths share one parent
map that cuts it with breakProjectGroupParentCycles.
compareProjectGroupSiblings adopts the device-independent sidebar order
from stablyai#29946 instead of localeCompare.
createOnTarget moves to project-group-create-on-host.ts, and two repo RPC
test expectations fold into one, to keep both files under max-lines.
@brennanb2025 one follow-up since my last ping, no rush.
I merged main again. One change worth knowing about: since #30128 draws a same-id project group once across hosts, subgroups now link to their parent by id over the drawn groups (the same links reveal walks), instead of each host's copy linking to a parent on its own host. If two hosts' copies would close a parent loop, the loop is cut so no group disappears.
main moves fast enough that this branch picks up conflicts within a few days. Would you rather I keep it synced continuously, or leave it and sync once when you're ready to review? Either works for me.
…s C+E)
Two distinct bugs in the project-group rebase stack (PR stablyai#26194 nest-groups
layered on top of upstream's stablyai#30045/stablyai#30128 same-id-across-hosts fix):
1. appendProjectGroupSections() fed getDistinctProjectGroups()'s bare-id
last-wins dedup straight into the per-host catalogGroupKey nesting walk.
That dedup is correct for stablyai#30045's real scenario (one group literally
republished under the same id to a managed server, so only one copy
should render), but when two DIFFERENT duplicated ids cross-reference
each other as parents across hosts (host A's copy of X parents host B's
copy of Y, while host B's copy of Y parents host A's copy of X), the
dedup silently drops an entire host's half of the hierarchy instead of
looping. Added findDuplicatedIdsFormingParentCycles() to detect that
specific cross-reference and exempt only those ids from the dedup, so
every host keeps its own acyclic copy; ids with no such cross-reference
keep the existing stablyai#30045 merge-to-one-copy behavior unchanged.
2. host-section-rows.ts's getRowHostId() pinned every project-group header
to a concrete host id via getProjectGroupExecutionHostIdForRows(), which
defaults to defaultHostId when a group has no executionHostId/
connectionId of its own. That conflated 'this group explicitly belongs
to one host' with 'this group has no host and spans whichever hosts its
repos live on' — so a catalog-wide group's header got bucketed into the
default host's section only, instead of floating as a pending header
repeated in every host section its member repos actually appear under.
Added projectGroupHasExplicitExecutionHost() and only pin the header to
a host when the group actually names one.
Would love to see this land — I needed to move an imported group under another group today and there was no way to do it from the UI.
One thing to watch when you next sync with main: this branch predates rootProjectOrder (#39768), and the move path never sets or clears it. On current main, getRootProjectEntryRank falls back to Number.NEGATIVE_INFINITY for a group without rootProjectOrder (src/shared/root-project-order.ts:20), so a subgroup moved to the top level would jump to the very top in manual order instead of landing last. Going the other way, a top-level group moved under a parent keeps its stale rootProjectOrder and returns to its old slot if moved back. Setting it the way initializeNewRootProjectGroupOrder does on a move to the top level, and clearing it on a move under a parent, should cover both.
Port group nesting onto the reorganized folders and the unified
ProjectGroupUpdate / updateProjectGroups path: moves now go through the
batch update, gated on the nesting runtime capability.
default-global-settings.ts sheds one import line to stay under max-lines,
which upstream main already exceeds.
Moving a group never set or cleared rootProjectOrder. A subgroup moved to
the top level fell back to the first slot, and a group moved under a
parent kept a stale order that would restore its old slot if moved out.
The host now clears the order on every move and assigns the next root
slot when the group lands at the top level. The renderer sends the last
slot it sees across every host, as group creation already does, and
skips no-op moves so they don't reorder.
89-90: Major · Stability & Availability · Heavy lift
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Make traversal of repaired trees stack-safe.
The new parent repair can turn a long cycle into a long rooted chain. This recursive count then visits the entire chain before visit.group runs. A sufficiently deep chain exhausts the stack even when its root is collapsed.
Calculate subtree counts iteratively. Make walkProjectGroup stack-safe too, so expanding the repaired tree does not cause the same failure. Preserve the existing counts and parent-before-child order.
Based on learnings, avoid unbounded recursive tree traversal on deeply nested inputs.
Source: Learnings
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: 14abeeaa-b97b-478d-a722-4dd4bb7f158d
Commits
Reviewing files that changed from the base of the PR and between d7ff26b and df8a8ef.
Files skipped from review as they are similar to previous changes: 6
src/renderer/src/i18n/locales/en.json
src/renderer/src/i18n/locales/es.json
src/renderer/src/i18n/locales/fr.json
src/renderer/src/i18n/locales/ja.json
src/renderer/src/i18n/locales/ko.json
src/renderer/src/i18n/locales/zh.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Performance & Scalability · Quick win
Cache ancestor levels when constructing the move check.
The move menu invokes this callback for every candidate. Each call creates a new visited set and walks the candidate's full ancestor chain.
For an imported tree with a 1,000-group spine and 49,000 leaves beneath it, these leaf checks alone require about 49 million ancestor visits. This work runs synchronously while constructing the menu, even when every deep destination is rejected.
Memoize ancestor levels across candidates, or compute them once when constructing the predicate. Preserve the existing cycle guard and imported-depth allowance.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Stability & Availability · Quick win
Build occurrence paths iteratively instead of recursing over ancestors.
The new getPath recurses once per uncached ancestor and caches a path only after its parent returns. The previous implementation used a loop. Imported group chains are not limited to the three-level manual cap. A sufficiently deep chain can therefore raise a stack-overflow error before getProjectGroupOccurrencePaths returns.
Restore the loop-based construction. Collect uncached ancestors, then assign paths from the nearest cached ancestor or the root:
Suggested fix
--- "a/src/shared/sidebar-list/sections/project-group-sections.ts"+++ "b/src/shared/sidebar-list/sections/project-group-sections.ts"@@ -66,24 +66,23 @@
}
/** The same group parents used by section emission, including missing-parent roots. */
export function getProjectGroupOccurrencePaths(projectGroups: readonly ProjectGroup[]) {
const parentIdByGroupId = getDrawnProjectGroupParentIds(projectGroups)
const paths = new Map<string, OccurrenceSectionPath>()
- const getPath = (groupId: string): OccurrenceSectionPath => {- const existing = paths.get(groupId)- if (existing) {- return existing- }- const parentId = parentIdByGroupId.get(groupId)- const path: OccurrenceSectionPath = {- key: getProjectGroupHeaderKey(groupId),- parent: parentId ? getPath(parentId) : undefined- }- paths.set(groupId, path)- return path- }- for (const groupId of parentIdByGroupId.keys()) {- getPath(groupId)+ for (const groupId of parentIdByGroupId.keys()) {+ const pending: string[] = []+ let currentId: string | null | undefined = groupId+ while (currentId && !paths.has(currentId)) {+ pending.push(currentId)+ currentId = parentIdByGroupId.get(currentId)+ }+ let parent = currentId ? paths.get(currentId) : undefined+ for (let index = pending.length - 1; index >= 0; index -= 1) {+ const id = pending[index]+ const path: OccurrenceSectionPath = { key: getProjectGroupHeaderKey(id), parent }+ paths.set(id, path)+ parent = path+ }
}
return paths
}
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
You can already put projects into groups, but only one level deep. This lets you put a group inside another group (for example a "Clients" group holding one group per client) straight from the group's
⋯menu: New subgroup creates one inside it, and Move to group moves an existing group under another one, or back to the top level.What Changed
Before: a group's
⋯menu only offered Rename and Delete. Nesting existed only when a folder import created it, so people encoded hierarchy in names ("acme / web", "acme / infra"). A project's Move to group submenu was a flat list, so two groups with the same name in different branches were indistinguishable.After:
Top level+ every valid parent, indented as a tree). The current parent is shown but disabled; the group itself and its own subgroups are never offered.Mechanism:
projectGroup.updateandprojectGroup.updateMany(IPC + runtime RPC) accept an optionalparentGroupId(null= top level), so a move goes through the sameupdateProjectGroupspath as reordering. The host that owns the group validates every move insrc/shared/project/groups/project-group-nesting.ts: no self, no descendant, no other host, no deeper than the cap. A batch is checked in full before any of it applies. A manual subgroup inherits its parent's host (connectionId).rootProjectOrder), computed across every host's catalog as for a new group. A group moved under a parent drops itsrootProjectOrder, since only top-level entries rank by it, so moving it back out never restores a stale slot. The host applies the same rule when a client sends onlyparentGroupId.projectGroup.nesting.v1. Otherwise it shows a "could not confirm" toast instead of pretending it worked. A subgroup create also sends the parent'sconnectionId, so a host that predates nesting keeps the subgroup on the right SSH target.normalizeProjectGroupsnow breaks parent cycles in persisted data, since the sidebar renders from roots and a cycle would hide every group in it. The sidebar also resolves parent links inside each host's catalog, so equal group ids on two hosts can't link into a loop.Why
Folder imports already produce nested groups and the sidebar already renders them; the missing piece was a way to build or change that structure by hand (#8785).
MAX_PROJECT_GROUP_LEVELS). Folder imports stay exempt, and an imported tree that is already deeper can still be moved shallower, never deeper, so the cap never traps existing data.Prior work: #8939 (drag-and-drop, by the issue author) has had merge conflicts since July, and #19125 bundles a broader "client" model. This PR is the narrow, menu-only slice that can land on its own. Drag-to-nest from #8939 can build on top of it.
Linked Issue
Fixes #8785
Visual Proof
Headless Electron build, macOS, same seeded data on both sides (left:
mainat 2584ed9, right: this branch).Sidebar tree: groups can now nest.
Group
⋯menu: adds New subgroup and Move to group.Project → Move to group: an indented tree instead of a flat list.
New: Group → Move to group. Top level is offered, the current parent is shown but disabled, and the group's own subtree is hidden.
Testing
pnpm typecheckand the e2e typecheck: pass.pnpm check:changedgates (oxlint, every ratchet,verify:rpc-params-catalog, localization catalogs and extraction, max-lines, changed-code quality) andoxfmt --checkon the committed files: pass.Unit tests: the 7 test files this PR adds pass (39 tests). The wider
relatedrun (every suite importing a changed module) was cut short on this machine; the only failures it reached are Windows filesystem ones (EBUSY,git worktree remove) inorca-runtime.test.ts, which this PR does not touch. CI runs the full suite.New tests:
shared/project/groups/project-group-nesting.test.ts: depth, subtree span, move rejections, and the rule that imported deep trees can still move shallower.shared/project/groups/project-groups.test.ts: parent-cycle breaking, linear on a 50,000-group cycle.shared/sidebar-list/sections/project-group-tree.test.ts: same-id groups on two hosts can't link into a hidden loop.main/persistence/tracking-repos/persistence-project-group-nesting.test.ts: host-side validation, parent-host inheritance, renames inside over-deep imported trees, and top-level order on move.renderer/src/store/project-groups/repos-project-group-nesting.test.ts: owner-host routing, capability gate, the old host that ignores the move, and top-level placement across hosts.sidebar/worktree-list/rows/project-group-move-targets.test.ts,project-group-header-actions.test.tsx: menu targets, tree order, host isolation.tests/e2e/project-group-nesting.spec.ts(headless Electron, 4 tests): create a subgroup, cap at level 3, move in and out, own subtree never offered (and the submenu disappears when no valid parent is left).Cases this PR had added to suites that
mainhas since removed (IPC and RPCparentGroupIdround-trips, delete-dialog copy, dialog owner-host toasts) went with those suites.Platforms: macOS (unit + headless e2e, before the merge with
main), Windows (typecheck, lint, unit, after it). No platform-specific code: no shortcuts, paths or process spawning. SSH and remote behaviour is covered by the routing and capability unit tests above.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
AI coding agents were used for this PR. Claude (Anthropic, Claude Opus 5.5, via Claude Code) verified the change, rebased it onto
main, ran the checks and e2e tests, captured the screenshots, did the review below, and drafted this description. All of it was reviewed by me before submission.Review
AI review summary of the final diff:
PROJECT_GROUP_HEADER_INDENTconstant (inline style, because computed padding classes on menu primitives are lint-gated).projectGroup.nesting.v1capability gate, and an unreachable host or timeout ends in a "could not confirm" toast, never a false success.DropdownMenu*primitives and tokens, with no new colors or restyles (design-system gate: 0 findings). Long trees scroll inside the submenu (max-h-80). New strings go throughtranslate()with hashedauto.*keys, seeded in all 11 locales.parentGroupIdis validated with zod (min(1), nullable, optional) on both IPC and RPC, and existence, host and cycle checks run on the host before anything is persisted. There are no new filesystem, shell or network surfaces.Suggested reading order (32 source files, +944/−212; tests +1,122; locales +368/−13):
src/shared/project/groups/project-group-nesting.ts: the rules.src/main/persistence/tracking-repos/project-group-operations.ts: host-side enforcement and top-level order on move.src/renderer/src/store/project-groups/project-group-mutations.tsandproject-group-update-persistence.ts: routing, the capability gate and top-level placement.src/renderer/src/components/sidebar/worktree-list/rows/project-group-move-targets.ts,ProjectGroupMoveSubmenu.tsxandproject-group-header-actions.tsx: the UI.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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance. All of these are covered in Review above. Mobile has no group-editing UI; it only reads
parentGroupIdto resolve group subtrees (agent-history-resume-target.ts), which already handles imported nested trees and is cycle-safe.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)