Skip to content

The agent that grows with you

fix(desktop): drop the unwired owner parameter from fetchVoiceLiveStatus and trim the routing tests

teknium1c7f2e76c5004
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-voice-live-conversation.owner.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-voice-live-conversation.owner.test.tsx
index 0c037fdfeb0..ab6744bb968 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-voice-live-conversation.owner.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-voice-live-conversation.owner.test.tsx
@@ -72,16 +72,4 @@ describe('useVoiceLiveConversation — owner-routed session', () => {
expect(constructed.owners).toEqual([{ connectionId: 'gw-bots', profile: 'bot-adam' }])
})
-
- it('passes an empty owner for the main composer scope (ambient routing keeps the session)', async () => {
- const hook = mountLive()
-
- await act(async () => {
- await hook.result.current.start()
- })
-
- // An ownerless scope still passes the ref object; ownerScoped treats the
- // empty (connection, profile) exactly like the old bare profileScoped().
- expect(constructed.owners).toEqual([{ connectionId: undefined, profile: undefined }])
- })
})
diff --git a/apps/desktop/src/lib/voice-live.routing.test.ts b/apps/desktop/src/lib/voice-live.routing.test.ts
index 86628e70475..5d520b4f2b1 100644
--- a/apps/desktop/src/lib/voice-live.routing.test.ts
+++ b/apps/desktop/src/lib/voice-live.routing.test.ts
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
import { setApiRequestConnection, setApiRequestProfile } from '@/hermes'
-import { fetchVoiceLiveStatus, type VoiceLiveHandlers, VoiceLiveSession } from './voice-live'
+import { type VoiceLiveHandlers, VoiceLiveSession } from './voice-live'
// A GPT-Live session is created on the chat OWNER's (connection, profile) —
// the Bot that owns the chat — never on the window's active scope, mirroring
@@ -71,37 +71,14 @@ describe('GPT-Live owner routing', () => {
expect(request.profile).toBe('bot-adam')
expect(request.connectionId).toBe('gw-bots')
expect(request.priority).toBe('foreground')
- })
-
- it('keeps the active scope verbatim for an ownerless chat', async () => {
- installWebRTC()
- const api = installApi()
- setApiRequestConnection('gw-active')
- setApiRequestProfile('research')
- const session = new VoiceLiveSession(handlers, null)
- await session.start([])
-
- const request = api.mock.calls[0][0] as { connectionId?: string; path: string; priority?: string; profile?: string }
-
- expect(request.path).toBe('/api/audio/voice-live/session')
- expect(request.profile).toBe('research')
- expect(request.connectionId).toBe('gw-active')
- expect(request.priority).toBeUndefined()
- })
-
- it('probes the mode status on the owner scope too', async () => {
- const api = installApi()
- setApiRequestConnection('gw-active')
- setApiRequestProfile('research')
-
- await fetchVoiceLiveStatus({ connectionId: 'gw-bots', profile: 'bot-adam' })
-
- const request = api.mock.calls[0][0] as { connectionId?: string; path: string; priority?: string; profile?: string }
-
- expect(request.path).toBe('/api/audio/voice-live/status')
- expect(request.profile).toBe('bot-adam')
- expect(request.connectionId).toBe('gw-bots')
- expect(request.priority).toBe('foreground')
+ // Ownerless chats keep the active scope verbatim (the old bare profileScoped()).
+ const ownerless = new VoiceLiveSession(handlers, null)
+ await ownerless.start([])
+ const plain = api.mock.calls[1][0] as { connectionId?: string; path: string; priority?: string; profile?: string }
+ expect(plain.path).toBe('/api/audio/voice-live/session')
+ expect(plain.profile).toBe('research')
+ expect(plain.connectionId).toBe('gw-active')
+ expect(plain.priority).toBeUndefined()
})
})
diff --git a/apps/desktop/src/lib/voice-live.ts b/apps/desktop/src/lib/voice-live.ts
index 14f57da21a8..2352e19b6f5 100644
--- a/apps/desktop/src/lib/voice-live.ts
+++ b/apps/desktop/src/lib/voice-live.ts
@@ -1,4 +1,4 @@
-import { type OwnerScope, ownerScoped } from '@/api/client'
+import { type OwnerScope, ownerScoped, profileScoped } from '@/api/client'
import { hermesApi } from '@/hermes'
/**
@@ -78,10 +78,10 @@ const APPEND_CHAR_LIMIT = 1_400
const CONTEXT_WINDOW_MS = 5 * 60_000
const CONTEXT_MAX_FRAGMENTS = 80
-export async function fetchVoiceLiveStatus(owner?: null | OwnerScope): Promise<null | VoiceLiveStatus> {
+export async function fetchVoiceLiveStatus(): Promise<null | VoiceLiveStatus> {
try {
const response = await hermesApi<{ ok: boolean } & VoiceLiveStatus>({
- ...ownerScoped(owner ?? undefined),
+ ...profileScoped(),
path: '/api/audio/voice-live/status'
})