diff --git a/src/renderer/src/lib/structured-native-chat-availability.test.ts b/src/renderer/src/lib/structured-native-chat-availability.test.ts index 5924a773cc4..9e31bea2669 100644 --- a/src/renderer/src/lib/structured-native-chat-availability.test.ts +++ b/src/renderer/src/lib/structured-native-chat-availability.test.ts @@ -82,4 +82,23 @@ describe('canUseStructuredNativeChat', () => { false ) }) + + it('refuses a Windows folder workspace even though its key resolves no project runtime', () => { + mockGetRendererAppPlatform.mockReturnValue('win32') + const state = { + ...stateFor({}), + activeRepoId: null, + activeWorktreeId: null + } as unknown as AppState + expect(canUseStructuredNativeChat(state, 'folder:folder-1')).toBe(false) + }) + + it('allows a folder workspace on a non-Windows platform', () => { + const state = { + ...stateFor({}), + activeRepoId: null, + activeWorktreeId: null + } as unknown as AppState + expect(canUseStructuredNativeChat(state, 'folder:folder-1')).toBe(true) + }) }) diff --git a/src/renderer/src/lib/structured-native-chat-availability.ts b/src/renderer/src/lib/structured-native-chat-availability.ts index 1eb132eeda2..28df6ad0c40 100644 --- a/src/renderer/src/lib/structured-native-chat-availability.ts +++ b/src/renderer/src/lib/structured-native-chat-availability.ts @@ -1,5 +1,4 @@ import type { AppState } from '@/store/types' -import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' import { getExecutionHostIdForWorktree } from '@/lib/worktree-runtime-owner' import { getRendererAppPlatform } from '@/lib/renderer-app-platform' @@ -10,13 +9,9 @@ export function canUseStructuredNativeChat(state: AppState, worktreeId: string): if (getExecutionHostIdForWorktree(state, worktreeId) !== 'local') { return false } - const projectRuntime = getLocalProjectExecutionRuntimeContext(state, worktreeId) - return !( - projectRuntime?.status === 'repair-required' || - projectRuntime?.runtime.kind === 'wsl' || - // The shipped Windows process-tree addon may not expose creation time. Until - // the host advertises that proof, keep this experimental surface on the - // ordinary terminal path instead of letting create fail after the click. - (getRendererAppPlatform() === 'win32' && projectRuntime?.runtime.kind === 'windows-host') - ) + // The shipped Windows process-tree addon may not expose creation time. Until + // the host advertises that proof, refuse every local Windows execution path — + // windows-host, WSL, and keys that resolve no project runtime (folder + // workspaces, floating terminal) — so create cannot fail after the click. + return getRendererAppPlatform() !== 'win32' }