From 7582371078708ffabbe00ef519fcc1ee2aeba011 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Thu, 12 Nov 2026 23:14:54 -0800 Subject: [PATCH] perf: resolve launch preference owner without building route (#41803) --- .../launch/routing/agent-launch-route-input.ts | 11 +++++++++-- .../use-host-agent-launch-preferences.ts | 6 ++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.ts b/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.ts index fc0fe438133..0fae5c20ccd 100644 --- a/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.ts +++ b/src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.ts @@ -188,14 +188,21 @@ function hostStructuredAgentsInput( return agents ? { hostStructuredAgents: agents.map((row) => row.agent) } : {} } -export function resolveAgentLaunchHost( +export function resolveAgentLaunchOwner( store: AgentLaunchRouteStore, workspace: ProspectiveWorkspace ) { const owner = workspace.worktreeId ? resolveStructuredAgentSessionOwner(store, workspace.worktreeId) : undefined - const executionHostId = owner ?? resolveExecutionHostId(store, workspace) + return { owner, executionHostId: owner ?? resolveExecutionHostId(store, workspace) } +} + +export function resolveAgentLaunchHost( + store: AgentLaunchRouteStore, + workspace: ProspectiveWorkspace +) { + const { owner, executionHostId } = resolveAgentLaunchOwner(store, workspace) return { owner, executionHostId, diff --git a/src/renderer/src/runtime/agent-launch-settings/use-host-agent-launch-preferences.ts b/src/renderer/src/runtime/agent-launch-settings/use-host-agent-launch-preferences.ts index c5a5a1e4583..3a385d39b6d 100644 --- a/src/renderer/src/runtime/agent-launch-settings/use-host-agent-launch-preferences.ts +++ b/src/renderer/src/runtime/agent-launch-settings/use-host-agent-launch-preferences.ts @@ -6,7 +6,7 @@ import { parseExecutionHostId } from '../../../../shared/execution-host' import { lastVerifiedRuntimeStatus } from '../../../../shared/remote-runtime/host-status/runtime-host-status' import type { AppState } from '@/store/types' import { - buildAgentLaunchRouteInput, + resolveAgentLaunchOwner, type ProspectiveWorkspace } from '@/lib/agent-session/launch/routing/agent-launch-route-input' import { workspaceKindForWorktreeId } from '../../../../shared/agent-launch/contracts/workspace-launch-kind' @@ -32,9 +32,7 @@ function preferencesForWorkspace(state: AppState, workspace: ProspectiveWorkspac ? { agentLaunchChoices: state.settings.agentLaunchChoices } : {}) } - const host = parseExecutionHostId( - buildAgentLaunchRouteInput(state, { agent: 'claude', workspace }).executionHostId - ) + const host = parseExecutionHostId(resolveAgentLaunchOwner(state, workspace).executionHostId) const owner = host?.kind === 'runtime' ? {