Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(providers): preserve empty connections and validate speech references
JiangJiahao74c9bb3df377
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/providerHandlers.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/providerHandlers.test.tsindex e1ea449758..ad976c9a60 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/providerHandlers.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/providerHandlers.test.ts@@ -4899,6 +4899,7 @@ describe('manual refresh speech references through the real provider update handit.each(['new', 'new-pi', 'hidden', 'hidden-pi', 'transcription', 'discovery-other','user-other', 'missing', 'reference-other', 'failed-target', 'disabled', 'oauth', 'proxy',+ 'registry-other', 'registry-transcription',] as const)('preserves effective classification and saved settings: %s', async kind => {mountDb();const harness = new IpcHarness();@@ -4909,6 +4910,14 @@ describe('manual refresh speech references through the real provider update handbaseModels: [...BUNDLED_CATALOG.modelRegistry!.baseModels!,{ id: 'server-only-audio', aliases: [], defaults: { mode: registryMode } }],};+ // #6928 P2, Main unit: unlike reference-other, this ID is absent from both+ // saved settings and discovery. The active Registry must also govern the+ // candidate before the real update handler persists a reference addition.+ if (kind === 'registry-other' || kind === 'registry-transcription') {+ modelRegistry.baseModels = modelRegistry.baseModels!.map(model =>+ model.aliases.includes('speech-2.8-turbo') ? { ...model, defaults: { ...model.defaults,+ mode: kind === 'registry-other' ? 'other' : 'audio_transcription' } } : model);+ }const config: CustomProviderConfig = { id: 'refresh-speech', name: 'My connection', runtimes: {codex: { baseUrl: kind === 'proxy' ? 'https://proxy.example/v1' : 'https://api.minimax.io/v1',wireProtocol: 'openai-chat', models: [{ id: 'MiniMax-M3', name: 'My chat', defaultEnabled: false }] },@@ -4921,7 +4930,8 @@ describe('manual refresh speech references through the real provider update handconfig.runtimes[agent]!.models.push({ id, name: 'My saved audio', defaultEnabled: false,...(kind === 'user-other' ? { mode: 'other' as const } : {}) });}- const discovered: DiscoveredModel[] = ['missing', 'failed-target', 'disabled', 'oauth', 'proxy'].includes(kind)+ const discovered: DiscoveredModel[] = ['missing', 'failed-target', 'disabled', 'oauth', 'proxy',+ 'registry-other', 'registry-transcription'].includes(kind)? [{ id: 'MiniMax-M3', name: 'Upstream chat' }]: [{ id, name: 'Discovered audio', ...(['discovery-other', 'reference-other'].includes(kind)? { discoveredMetadata: { mode: 'other' as const } } : {}) }];diff --git a/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx b/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsxindex 1c90e7cad8..22db71016c 100644--- a/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx+++ b/apps/desktop/src/renderer/__tests__/providersSectionUnavailableModels.test.tsx@@ -390,6 +390,36 @@ describe('ProvidersSection — 双栏管理', () => {expect(await screen.findByRole('checkbox', { name: /speech-2.8-turbo/ })).toBeTruthy();expect(updateCustomProvider).not.toHaveBeenCalled();});+ // #6928 P2, renderer unit: the empty-connection case above never suspended+ // its provider. Exercise the real menu and next snapshot so the enable entry+ // cannot disappear along with the speech setup action.+ it('keeps an empty speech connection visible through suspend and resume', async () => {+ const config = miniMaxConfig();+ config.runtimes.codex.models = [];+ selectSpeechProvider(config);+ const setModelDisable = vi.fn<typeof window.electronAPI.maker.setModelDisable>(async input => {+ if (input.kind === 'provider')+ providerSnapshotState.customOverride = { ...providerSnapshotState.customOverride!, suspended: input.disabled };+ return { ok: true as const };+ });+ window.electronAPI.maker.setModelDisable = setModelDisable;+ const view = render(<MemoryRouter><ProvidersSection /></MemoryRouter>);+ fireEvent.keyDown(screen.getByRole('button', { name: 'settings.providers.detail.moreActionsAria' }), { key: 'ArrowDown' });+ await act(async () => { fireEvent.click(await screen.findByRole('menuitem', { name: 'settings.providers.menu.disableProvider' })); });+ expect(setModelDisable).toHaveBeenLastCalledWith({ kind: 'provider', providerId: config.id, disabled: true });+ view.rerender(<MemoryRouter><ProvidersSection /></MemoryRouter>);+ expect(await screen.findByText('settings.providers.detail.suspendedBanner')).toBeTruthy();+ expect(screen.queryByRole('button', { name: 'settings.providers.models.refreshAria' })).toBeNull();+ expect(screen.queryByRole('button', { name: 'settings.providers.models.manage.menu' })).toBeNull();+ await act(async () => { fireEvent.click(screen.getByRole('button', { name: 'settings.providers.button.enableProvider' })); });+ expect(setModelDisable).toHaveBeenLastCalledWith({ kind: 'provider', providerId: config.id, disabled: false });+ view.rerender(<MemoryRouter><ProvidersSection /></MemoryRouter>);+ expect(screen.queryByText('settings.providers.detail.suspendedBanner')).toBeNull();+ fireEvent.keyDown(screen.getByRole('button', { name: 'settings.providers.models.manage.menu' }), { key: 'ArrowDown' });+ expect(await screen.findByRole('menuitem', { name: 'settings.providers.speechSetup.add' })).toBeTruthy();+ expect(updateCustomProvider).not.toHaveBeenCalled();+ expect(setModelVisibilities).not.toHaveBeenCalled();+ });it.each(['hidden-other-runtime', 'failed-target'] as const)('does not supplement a reference across runtimes: %s', async kind => {const config: CustomProviderConfig = miniMaxConfig();diff --git a/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx b/apps/desktop/src/renderer/components/settings/ProvidersSection.tsxindex 89562e1a1f..e1c46f2bf5 100644--- a/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx+++ b/apps/desktop/src/renderer/components/settings/ProvidersSection.tsx@@ -2613,7 +2613,8 @@ export function ProvidersSection() {p.id === MANAGED_LLAMACPP_PROVIDER_ID ||p.id === MANAGED_LMSTUDIO_PROVIDER_ID ||providerHasModels(p) ||- !!providerSpeechSetup(p) ||+ // Suspension gates actions, not the empty connection's enable entry.+ !!providerSpeechSetup({ ...p, suspended: false }) ||(p.auth.method === 'oauth' && (!!p.auth.oauth || !!p.auth.native)))) {rows.push(p);diff --git a/apps/desktop/src/shared/speechProviderSetup.ts b/apps/desktop/src/shared/speechProviderSetup.tsindex 26b54fd871..cbd67ae955 100644--- a/apps/desktop/src/shared/speechProviderSetup.ts+++ b/apps/desktop/src/shared/speechProviderSetup.ts@@ -207,6 +207,13 @@ export function missingSpeechReference(if (!runtime) return;const model = speechReferenceModels(runtime.baseUrl).find(reference => reference.defaultEnabled);if (!model || models.some(existing => existing.id === model.id)) return;+ // Bundled references only nominate an ID. Resolve the unsaved candidate with+ // the same active Registry/preset layers that will classify it after saving.+ const candidate = buildUserProvider({ ...config, runtimes: { ...config.runtimes,+ [target.agent]: { ...runtime, models: [...runtime.models, model] },+ } }, catalog);+ if (!candidate.audioModels?.some(entry => entry.id === model.id &&+ entry.sourceAgent === target.agent && entry.mode === 'audio_speech')) return;return { agent: target.agent, model };}diff --git a/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts b/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.tsindex 454c9b77d0..05f8ae9289 100644--- a/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts+++ b/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts@@ -633,7 +633,12 @@ describe('Cindy durable PI Subagent runner', () => {const files = ['result.json', 'transcript.jsonl', 'config.json'];const before = await Promise.all(files.map(file => readFile(path.join(fixture.runDir, file))));await writeFile(path.join(fixture.runDir, 'status.json'), Buffer.alloc(72_506));- await expect(stopForAccountBoundary(fixture.root, { timeoutMs: 0 })).resolves.toBe(true);+ // #6928 Windows CI: a cold OS inventory can exhaust its 8s budget even after+ // the real runner exits. That probe must fail closed; this test verifies+ // receipt recovery, not first-probe latency. Keep the production deadline+ // and wait for positive OS evidence, as the live-orphan case below does.+ await waitFor(async () => await stopForAccountBoundary(fixture.root, { timeoutMs: 0 }) ? true : null,+ undefined, 'the independent process inventory to confirm the completed runner exited');expect(await Promise.all(files.map(file => readFile(path.join(fixture.runDir, file))))).toEqual(before);});