Skip to content

The agent that grows with you

fix(desktop): dial user-gesture session opens with foreground priority

Teknium4d14c485bea5
diff --git a/apps/desktop/src/sdk/index.ts b/apps/desktop/src/sdk/index.ts
index 88b4d394677..849a7f4b051 100644
--- a/apps/desktop/src/sdk/index.ts
+++ b/apps/desktop/src/sdk/index.ts
@@ -1066,11 +1066,14 @@ export const host = {
// not the registry-secondary path openGatewayForAgent takes for a 'local'
// connection id. Behavior for a plain local open is unchanged.
const dial = explicitRoute
- ? () => openGatewayForAgent(explicitRoute.connectionId, explicitRoute.profile)
+ ? () =>
+ openGatewayForAgent(explicitRoute.connectionId, explicitRoute.profile, {
+ spawnPriority: 'foreground'
+ })
: plan.switchWorkspace
? () => ensureGatewayProfile(plan.switchWorkspace as string)
: plan.dialWithoutSwitching
- ? () => openGatewayForProfile(plan.dialWithoutSwitching as string)
+ ? () => openGatewayForProfile(plan.dialWithoutSwitching as string, { spawnPriority: 'foreground' })
: null
if (dial) {
diff --git a/apps/desktop/src/sdk/profile-routing.test.ts b/apps/desktop/src/sdk/profile-routing.test.ts
index f06bb28ea1c..7cd9d96a821 100644
--- a/apps/desktop/src/sdk/profile-routing.test.ts
+++ b/apps/desktop/src/sdk/profile-routing.test.ts
@@ -629,7 +629,11 @@ describe('profile-aware plugin session opens', () => {
await host.openSession('remote-chat', { route })
- expect(openGatewayForAgent).toHaveBeenCalledWith('source-a', 'default')
+ expect(openGatewayForAgent).toHaveBeenCalledWith(
+ 'source-a',
+ 'default',
+ expect.objectContaining({ spawnPriority: 'foreground' })
+ )
expect(ensureGatewayProfile).not.toHaveBeenCalled()
expect(setShowAllProfiles).toHaveBeenCalledWith(true)
expect($activeGatewayProfile.get()).toBe('remote-worker')
@@ -1146,7 +1150,10 @@ describe('profile-aware plugin session opens', () => {
await host.openSession('bot-chat', { profile: 'worker' })
expect(ensureGatewayProfile).not.toHaveBeenCalled()
- expect(openGatewayForProfile).toHaveBeenCalledWith('worker')
+ expect(openGatewayForProfile).toHaveBeenCalledWith(
+ 'worker',
+ expect.objectContaining({ spawnPriority: 'foreground' })
+ )
expect(setShowAllProfiles).toHaveBeenCalledWith(true)
expect($activeGatewayProfile.get()).toBe('default')
})
diff --git a/apps/desktop/src/store/profile.ts b/apps/desktop/src/store/profile.ts
index fa80331c8c4..f034de3dcba 100644
--- a/apps/desktop/src/store/profile.ts
+++ b/apps/desktop/src/store/profile.ts
@@ -763,7 +763,10 @@ export async function openGatewayAgent(connectionId: string, profile: string): P
return
}
- await openGatewayForAgent(connection, normalizeProfileKey(profile), { activationLease: true })
+ await openGatewayForAgent(connection, normalizeProfileKey(profile), {
+ activationLease: true,
+ spawnPriority: 'foreground'
+ })
}
// Activate a connection-scoped agent's gateway — the (connectionId, profile)