Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(codex): normalize preset source identities
Cindy57ee881582d4
diff --git a/apps/desktop/src/main/maker-host/__tests__/codexCredentialSwitch.test.ts b/apps/desktop/src/main/maker-host/__tests__/codexCredentialSwitch.test.tsindex 6eabb5b282..899d0ed5b7 100644--- a/apps/desktop/src/main/maker-host/__tests__/codexCredentialSwitch.test.ts+++ b/apps/desktop/src/main/maker-host/__tests__/codexCredentialSwitch.test.ts@@ -231,6 +231,27 @@ describe('shouldCloseSessionForCredentialSwitch codex mode', () => {expect(shouldCloseSessionForCredentialSwitch(input)).toBe(false);});+ it('matches raw source identity for a renamed official preset connection', () => {+ const preset = BUNDLED_CATALOG.presets!.find((entry) => entry.id === 'openai-api')!;+ const account = buildUserProvider({+ id: 'openai-api-account', name: 'OpenAI API account',+ auth: { method: 'apiKey' },+ runtimes: { codex: { ...preset.runtimes.codex!, catalogPresetId: preset.id } },+ }, { modelRegistry: BUNDLED_CATALOG.modelRegistry, presets: BUNDLED_CATALOG.presets });+ setActiveCatalog({ ...BUNDLED_CATALOG, providers: [...BUNDLED_CATALOG.providers, account] });+ const input = {+ agentKind: 'codex',+ currentProviderId: 'openai-api-account',+ nextProviderId: 'openai-api-account',+ currentModel: 'gpt-4.1',+ nextModel: 'gpt-4.1',+ currentCodexProxyActive: true,+ currentCodexThreadModelProviderId: 'openai',+ } as const;+ expect(isCodexThreadModelProviderIdentityMismatch(input)).toBe(false);+ expect(shouldCloseSessionForCredentialSwitch(input)).toBe(false);+ });+it('still closes a gateway Codex session when switching to OAuth on a proxy-active host', () => {expect(shouldCloseSessionForCredentialSwitch({agentKind: 'codex',diff --git a/apps/desktop/src/main/maker-host/codex-credential-switch.ts b/apps/desktop/src/main/maker-host/codex-credential-switch.tsindex c0cb15c1d9..79b19a5aca 100644--- a/apps/desktop/src/main/maker-host/codex-credential-switch.ts+++ b/apps/desktop/src/main/maker-host/codex-credential-switch.ts@@ -1,4 +1,4 @@-import { isOpenAiSubscriptionProvider, providerCatalogId } from '@cindy/model-providers';+import { isOpenAiSubscriptionProvider, providerCatalogId, sourceProviderForPreset } from '@cindy/model-providers';import {canReuseCodexHostForCredentialMode,canReuseHostForCredentialMode,@@ -217,6 +217,7 @@ export function isCodexThreadModelProviderIdentityMismatch(const targetRawProviderIds = new Set(targetProvider?.models.codex?.flatMap((model) => [model.catalogPresetId,+ model.catalogPresetId ? sourceProviderForPreset(model.catalogPresetId) : undefined,model.api === 'azure-openai-responses' ? 'azure' : undefined,].filter((id): id is string => typeof id === 'string')) ?? [],);diff --git a/packages/model-providers/src/index.ts b/packages/model-providers/src/index.tsindex 3142a41412..0003c27988 100644--- a/packages/model-providers/src/index.ts+++ b/packages/model-providers/src/index.ts@@ -39,6 +39,7 @@ export type {export { PI_MODEL_APIS, PI_REASONING_EFFORTS } from "./types.js";export { isLocalOnlyProviderForAgent, isOpenAiSubscriptionProvider, providerCatalogId } from './provider-identity.js';+export { sourceProviderForPreset } from './providerPresetIdentity.js';export {effectivePiWireProtocol,