Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(codex): match preset provider identities
Cindy8779382ff44c
diff --git a/apps/desktop/src/main/maker-host/__tests__/codexCredentialSwitch.test.ts b/apps/desktop/src/main/maker-host/__tests__/codexCredentialSwitch.test.tsindex 9d6738fb52..6eabb5b282 100644--- a/apps/desktop/src/main/maker-host/__tests__/codexCredentialSwitch.test.ts+++ b/apps/desktop/src/main/maker-host/__tests__/codexCredentialSwitch.test.ts@@ -210,6 +210,27 @@ describe('shouldCloseSessionForCredentialSwitch codex mode', () => {expect(shouldCloseSessionForCredentialSwitch(input)).toBe(false);});+ it('matches raw Azure identity for a renamed Azure preset connection', () => {+ const preset = BUNDLED_CATALOG.presets!.find((entry) => entry.id === 'azure-openai-responses')!;+ const account = buildUserProvider({+ id: 'azure-openai', name: 'Azure 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: 'azure-openai',+ nextProviderId: 'azure-openai',+ currentModel: 'gpt-4.1',+ nextModel: 'gpt-4.1',+ currentCodexProxyActive: true,+ currentCodexThreadModelProviderId: 'azure',+ } 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 b60dda16b9..c0cb15c1d9 100644--- a/apps/desktop/src/main/maker-host/codex-credential-switch.ts+++ b/apps/desktop/src/main/maker-host/codex-credential-switch.ts@@ -214,6 +214,12 @@ export function isCodexThreadModelProviderIdentityMismatch((provider) => provider.id === nextProviderId,);const targetCatalogId = targetProvider ? providerCatalogId(targetProvider) : null;+ const targetRawProviderIds = new Set(+ targetProvider?.models.codex?.flatMap((model) => [+ model.catalogPresetId,+ model.api === 'azure-openai-responses' ? 'azure' : undefined,+ ].filter((id): id is string => typeof id === 'string')) ?? [],+ );// Older app-server versions may report the logical provider id directly// (for example `openai`) instead of Cindy's materialized `cindy_openai`// alias. Account-specific OpenAI ids also share the catalog identity@@ -223,6 +229,7 @@ export function isCodexThreadModelProviderIdentityMismatch(actualThreadModelProviderId !== null &&(actualThreadModelProviderId === nextProviderId ||actualThreadModelProviderId === targetCatalogId ||+ targetRawProviderIds.has(actualThreadModelProviderId) ||(nextProviderId === null &&effectiveNextMode === 'oauth-bearer' &&actualThreadModelProviderId === 'openai'));