The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): route ambient SSH profile deletion to remote
Kavyrocom76af834dddb4
diff --git a/apps/desktop/src/sdk/index.ts b/apps/desktop/src/sdk/index.tsindex 59f01962d69..74a57357197 100644--- a/apps/desktop/src/sdk/index.ts+++ b/apps/desktop/src/sdk/index.ts@@ -617,6 +617,17 @@ export const host = {}const targetProfile = route?.targetProfile || name+ // A name-only call is ambient, not local: Bot Mode's active SSH roster+ // rows deliberately use the ambient gateway door and therefore carry no+ // explicit owner route. Preserve the active registry connection so the+ // profile teardown and DELETE both land on the VPS instead of retiring the+ // unrelated local pool and leaving the warmed remote backend to recreate+ // the deleted profile.+ const ambientConnectionId = route ? null : String(activeGatewayConnectionId() || '').trim()++ const ambientRemoteConnectionId = ambientConnectionId && ambientConnectionId !== 'local'+ ? ambientConnectionId+ : nullif (!name) {throw new Error('deleteProfile: profile name required')@@ -637,11 +648,18 @@ export const host = {// A hover-warmed Bot Mode row owns a retained renderer socket. Retire it// before Electron stops the profile backend so the socket closure cannot// schedule a reconnect that resurrects the deleted profile.- if (!route || route.mode === 'local') {+ if (route?.mode === 'local' || (!route && !ambientRemoteConnectionId)) {retireLocalProfileGateways(targetProfile)}- await deleteProfile(targetProfile, route ? { connectionId: route.connectionId, profile: route.profile } : undefined)+ await deleteProfile(+ targetProfile,+ route+ ? { connectionId: route.connectionId, profile: route.profile }+ : ambientRemoteConnectionId+ ? { connectionId: ambientRemoteConnectionId, profile: name }+ : undefined+ )// The profile rail paints from the shared $profiles cache; without a// refresh the deleted profile's badge survives and clicking it starts adiff --git a/apps/desktop/src/sdk/profile-routing.test.ts b/apps/desktop/src/sdk/profile-routing.test.tsindex 78dae20be49..71237762d0f 100644--- a/apps/desktop/src/sdk/profile-routing.test.ts+++ b/apps/desktop/src/sdk/profile-routing.test.ts@@ -108,6 +108,7 @@ const { openSession: openSessionCore } = await import('@/app/open-session')const { deleteProfile } = await import('@/hermes')const {+ activeGatewayConnectionId,openGatewayForAgent,openGatewayForProfile,requestGatewayForAgent,@@ -152,6 +153,7 @@ const profile = (name: string): ProfileInfo => ({afterEach(() => {vi.clearAllMocks()+ vi.mocked(activeGatewayConnectionId).mockReturnValue('local')$activeGatewayProfile.set('remote-worker')$gatewaySwapTarget.set(null)setMockAtom($focusedRuntimeId, null)@@ -189,6 +191,18 @@ describe('connection-aware plugin host APIs', () => {expect(refreshProfiles).toHaveBeenCalled()})+ it('pins an ambient SSH profile delete to the active connection and target profile', async () => {+ vi.mocked(activeGatewayConnectionId).mockReturnValue('ssh-vps')++ await host.deleteProfile('worker')++ expect(retireLocalProfileGateways).not.toHaveBeenCalled()+ expect(deleteProfile).toHaveBeenCalledWith('worker', {+ connectionId: 'ssh-vps',+ profile: 'worker'+ })+ })+it('refreshes the profile inventory before asking Electron for routes', async () => {const getProfileRoutes = vi.fn(async () => [{ connectionId: 'connection-local', mode: 'local', profile: 'desktop-primary', targetProfile: 'desktop-primary' },