From 3f5098a0f2fb255deecb22e0a2d4095ad6ba0cca Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Mon, 27 Jul 2026 22:25:52 -0700 Subject: [PATCH] fix(workspaces): hide false repo error for remote servers (#11050) --- src/renderer/src/hooks/useComposerState.ts | 2 ++ .../useEphemeralVmRecipeOptions.test.tsx | 24 ++++++++++++++++++- .../src/hooks/useEphemeralVmRecipeOptions.ts | 3 +++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/hooks/useComposerState.ts b/src/renderer/src/hooks/useComposerState.ts index 2411ed3b9..934065ab3 100644 --- a/src/renderer/src/hooks/useComposerState.ts +++ b/src/renderer/src/hooks/useComposerState.ts @@ -140,6 +140,7 @@ import { useFolderWorkspaceComposerPathStatus } from '@/components/sidebar/folde import { submitFolderWorkspaceCreate } from '@/components/sidebar/folder-workspace-composer-submit' import { buildExecutionHostRegistry } from '../../../shared/execution-host-registry' import { + getRepoExecutionHostId, normalizeExecutionHostId, parseExecutionHostId, type ExecutionHostId @@ -826,6 +827,7 @@ export function useComposerState(options: UseComposerStateOptions): UseComposerS repoId: selectedRecipeRepoId, repoIsGit: selectedRepoIsGit, repoConnectionId: selectedRecipeRepoConnectionId, + repoExecutionHostId: selectedRepo ? getRepoExecutionHostId(selectedRepo) : null, projectGroupTarget: isProjectGroupTarget, initialRecipeId: initialEphemeralVmRecipeId }) diff --git a/src/renderer/src/hooks/useEphemeralVmRecipeOptions.test.tsx b/src/renderer/src/hooks/useEphemeralVmRecipeOptions.test.tsx index 6439bc43a..5f10b7a99 100644 --- a/src/renderer/src/hooks/useEphemeralVmRecipeOptions.test.tsx +++ b/src/renderer/src/hooks/useEphemeralVmRecipeOptions.test.tsx @@ -59,17 +59,20 @@ function installApi(listRecipes: ReturnType): { function Harness({ repoId, initialRecipeId, - enabled = true + enabled = true, + repoExecutionHostId = 'local' }: { repoId: string initialRecipeId?: string enabled?: boolean + repoExecutionHostId?: 'local' | `runtime:${string}` }): React.JSX.Element { const state = useEphemeralVmRecipeOptions({ enabled, repoId, repoIsGit: true, repoConnectionId: null, + repoExecutionHostId, projectGroupTarget: false, initialRecipeId }) @@ -78,6 +81,7 @@ function Harness({ {repoId} {state.recipes.map((recipe) => recipe.id).join(',')} {state.selectedRecipeId ?? 'none'} + {state.error ?? 'none'} ) } @@ -145,4 +149,22 @@ describe('useEphemeralVmRecipeOptions', () => { expect(listRecipes).not.toHaveBeenCalled() }) + + it('does not send a paired-runtime repo id to local recipe discovery', async () => { + const listRecipes = vi.fn().mockResolvedValue({ + status: 'error', + repoPath: null, + diagnostics: [], + recipes: [], + message: 'Repo not found: repo-runtime' + }) + installApi(listRecipes) + + const { container } = await render( + + ) + + expect(listRecipes).not.toHaveBeenCalled() + expect(container.querySelector('[data-testid="error"]')?.textContent).toBe('none') + }) }) diff --git a/src/renderer/src/hooks/useEphemeralVmRecipeOptions.ts b/src/renderer/src/hooks/useEphemeralVmRecipeOptions.ts index 3bee2c8c6..6ebf489f8 100644 --- a/src/renderer/src/hooks/useEphemeralVmRecipeOptions.ts +++ b/src/renderer/src/hooks/useEphemeralVmRecipeOptions.ts @@ -1,4 +1,5 @@ import { useCallback, useEffect, useRef, useState } from 'react' +import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../shared/execution-host' import type { OrcaVmRecipe } from '../../../shared/types' type EphemeralVmRecipeOptionsArgs = { @@ -6,6 +7,7 @@ type EphemeralVmRecipeOptionsArgs = { repoId: string | null repoIsGit: boolean repoConnectionId: string | null + repoExecutionHostId: ExecutionHostId | null projectGroupTarget: boolean initialRecipeId?: string } @@ -25,6 +27,7 @@ export function useEphemeralVmRecipeOptions(args: EphemeralVmRecipeOptionsArgs): Boolean(args.repoId) && args.repoIsGit && !args.repoConnectionId && + args.repoExecutionHostId === LOCAL_EXECUTION_HOST_ID && !args.projectGroupTarget const load = useCallback(