Merge pull request #7628 from Sterbennicht/fix/codex-windows-catalog-path

fix(keys): use ~/ for the Codex model catalog path on Windows
This commit is contained in:
Wesley Liddick
2026-09-28 09:41:35 +08:00
committed by GitHub
2 changed files with 13 additions and 7 deletions
+8 -4
View File
@@ -325,6 +325,10 @@ const codexModelCatalogPath = computed(() => {
return joinConfigPath(configDir, 'codex-models.json', isWindows)
})
// Codex expands a leading ~/ on every platform but not %userprofile%, which it
// resolves relative to the config directory, so config.toml always uses ~/.
const CODEX_MODEL_CATALOG_CONFIG_PATH = '~/.codex/codex-models.json'
const codexManifestContext = computed(() => {
if (!showCodexModelCatalog.value) return ''
return `${props.platform}|${props.baseUrl}|${props.apiKey}`
@@ -952,7 +956,7 @@ function generateOpenAIFiles(baseUrl: string, apiKey: string): FileConfig[] {
model = "${model}"
review_model = "${model}"
${reasoningEffortLine}disable_response_storage = true
model_catalog_json = "${escapeTomlBasicString(codexModelCatalogPath.value)}"
model_catalog_json = "${CODEX_MODEL_CATALOG_CONFIG_PATH}"
network_access = "enabled"
windows_wsl_setup_acknowledged = true
@@ -1185,7 +1189,7 @@ function generateGrokCodexFiles(baseUrl: string, apiKey: string): FileConfig[] {
model_provider = "sub2api"
model = "${model}"
model_catalog_json = "${escapeTomlBasicString(codexModelCatalogPath.value)}"
model_catalog_json = "${CODEX_MODEL_CATALOG_CONFIG_PATH}"
# Optional:
# review_model = "${model}"
# model_reasoning_effort = "medium"
@@ -1266,7 +1270,7 @@ model_provider = "sub2api"
model = "${model}"
review_model = "${model}"
disable_response_storage = true
model_catalog_json = "${escapeTomlBasicString(codexModelCatalogPath.value)}"
model_catalog_json = "${CODEX_MODEL_CATALOG_CONFIG_PATH}"
[model_providers.sub2api]
name = "Sub2API ${label}"
@@ -1301,7 +1305,7 @@ function generateOpenAIWsFiles(baseUrl: string, apiKey: string): FileConfig[] {
model = "${model}"
review_model = "${model}"
${reasoningEffortLine}disable_response_storage = true
model_catalog_json = "${escapeTomlBasicString(codexModelCatalogPath.value)}"
model_catalog_json = "${CODEX_MODEL_CATALOG_CONFIG_PATH}"
network_access = "enabled"
windows_wsl_setup_acknowledged = true
@@ -848,9 +848,11 @@ describe('UseKeyModal', () => {
const windowsConfig = wrapper.findAll('pre code')
.map((code) => code.text())
.find((content) => content.includes('[model_providers.sub2api]'))
expect(windowsConfig).toContain(
'model_catalog_json = "%userprofile%\\\\.codex\\\\codex-models.json"'
)
// Codex does not expand %userprofile% in config.toml; it only expands ~/.
expect(windowsConfig).toContain('model_catalog_json = "~/.codex/codex-models.json"')
expect(windowsConfig).not.toContain('%userprofile%')
expect(wrapper.get('[data-testid="codex-model-catalog"]').text())
.toContain('%userprofile%\\.codex\\codex-models.json')
})
it.each(['anthropic', 'gemini', 'antigravity', 'kimi', 'zhipu', 'minimax'] as const)(