From 1cf1ea2dac6b880e721e0b7bb6b5aed28036231f Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 10 Aug 2026 20:44:32 -0700 Subject: [PATCH] fix(sidebar): retain legacy SSH folder rows --- .../sidebar/worktree-list-groups.test.ts | 14 +++++++++++++- .../components/sidebar/worktree-list-groups.ts | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/sidebar/worktree-list-groups.test.ts b/src/renderer/src/components/sidebar/worktree-list-groups.test.ts index c5a7f9606b2..21dd8e2e482 100644 --- a/src/renderer/src/components/sidebar/worktree-list-groups.test.ts +++ b/src/renderer/src/components/sidebar/worktree-list-groups.test.ts @@ -6,7 +6,9 @@ import { getExecutionHostLabel } from '../../../../shared/execution-host' import { projectHostSetupProjectionFromRepos } from '../../../../shared/project-host-setup-projection' import { ALL_GROUP_META, + buildProjectGroupSidebarIndex, buildRows, + findProjectGroupForFolderWorkspace, getGroupKeyForWorktree, getGroupKeysForWorktree, getLineageGroupKey, @@ -3154,11 +3156,12 @@ describe('project groups', () => { }) }) - it('renders folder workspaces under their owning folder-backed Project Group', () => { + it('renders a legacy SSH folder under its unambiguous local-stamped Project Group', () => { const group: ProjectGroup = { id: 'group-root', name: 'Platform', parentPath: '/monorepo', + executionHostId: 'local', parentGroupId: null, createdFrom: 'folder-scan', tabOrder: 0, @@ -3172,6 +3175,8 @@ describe('project groups', () => { projectGroupId: group.id, name: 'Refund fix', folderPath: '/monorepo', + connectionId: 'builder', + executionHostId: 'ssh:builder', linkedTask: null, comment: '', isArchived: false, @@ -3218,6 +3223,13 @@ describe('project groups', () => { groupDepth: 1 } ]) + const collidingGroup = { ...group, executionHostId: 'runtime:env-1' } + expect( + findProjectGroupForFolderWorkspace( + buildProjectGroupSidebarIndex([group, collidingGroup]), + folderWorkspace + ) + ).toBeUndefined() }) it('preserves nested Project Group depth for folder workspace rows', () => { diff --git a/src/renderer/src/components/sidebar/worktree-list-groups.ts b/src/renderer/src/components/sidebar/worktree-list-groups.ts index b4cdf92e049..8fb32d5c092 100644 --- a/src/renderer/src/components/sidebar/worktree-list-groups.ts +++ b/src/renderer/src/components/sidebar/worktree-list-groups.ts @@ -205,7 +205,20 @@ export function findProjectGroupForFolderWorkspace( : workspace.connectionId === null ? LOCAL_EXECUTION_HOST_ID : undefined) - return findProjectGroupForSidebarOwner(index, workspace.projectGroupId, ownerHostId) + const exact = findProjectGroupForSidebarOwner(index, workspace.projectGroupId, ownerHostId) + if ( + exact || + !workspace.connectionId || + ownerHostId !== toSshExecutionHostId(workspace.connectionId) + ) { + return exact + } + const legacyGroup = index.byUnambiguousId.get(workspace.projectGroupId) + return legacyGroup !== undefined && + legacyGroup.connectionId === undefined && + getProjectGroupOwnerHostId(legacyGroup) === LOCAL_EXECUTION_HOST_ID + ? legacyGroup + : undefined } export function getAmbiguousFolderWorkspaceSidebarIds(