Merge pull request #9171 from debug-zhang/fix/codex-removed-config-keys

fix(frontend): drop Codex config keys removed upstream
This commit is contained in:
Wesley Liddick authored and GitHub committed 2026-12-02 12:05:17 +08:00
commit 988569acde
2 files changed
+58 -10

No files matched your search

+6 -10
View File
@@ -1036,9 +1036,9 @@ function generateOpenAIFiles(baseUrl: string, apiKey: string): FileConfig[] {
model = "${model}"
review_model = "${model}"
web_search = "live"
${reasoningEffortLine}disable_response_storage = true
${codexLocalCatalogToml.value}network_access = "enabled"
windows_wsl_setup_acknowledged = true
${reasoningEffortLine}${codexLocalCatalogToml.value}
[sandbox_workspace_write]
network_access = true
[model_providers.OpenAI]
name = "OpenAI"
@@ -1271,9 +1271,6 @@ ${codexLocalCatalogToml.value}# Optional:
# review_model = "${model}"
# model_reasoning_effort = "medium"
# model_context_window = 500000
# disable_response_storage = true
# network_access = "enabled"
# windows_wsl_setup_acknowledged = true
[model_providers.sub2api]
name = "Sub2API Grok"
@@ -1348,7 +1345,6 @@ function generateRoutedCodexFiles(
model_provider = "sub2api"
model = "${model}"
review_model = "${model}"
disable_response_storage = true
${codexLocalCatalogToml.value}
[model_providers.sub2api]
name = "Sub2API ${label}"
@@ -1383,9 +1379,9 @@ function generateOpenAIWsFiles(baseUrl: string, apiKey: string): FileConfig[] {
model = "${model}"
review_model = "${model}"
web_search = "live"
${reasoningEffortLine}disable_response_storage = true
${codexLocalCatalogToml.value}network_access = "enabled"
windows_wsl_setup_acknowledged = true
${reasoningEffortLine}${codexLocalCatalogToml.value}
[sandbox_workspace_write]
network_access = true
[model_providers.OpenAI]
name = "OpenAI"
@@ -1150,4 +1150,56 @@ describe('UseKeyModal', () => {
}
}
)
// Codex rejects these removed top-level keys, and network_access now only
// exists as a boolean under [sandbox_workspace_write].
it('generates only config keys supported by current Codex clients', async () => {
const wrapper = mount(UseKeyModal, {
props: {
show: true,
apiKey: 'sk-test',
baseUrl: 'https://example.com/v1',
platform: 'openai'
},
global: {
stubs: {
BaseDialog: { template: '<div><slot /><slot name="footer" /></div>' },
Icon: { template: '<span />' }
}
}
})
for (const transport of ['keys.useKeyModal.cliTabs.codexCli', 'keys.useKeyModal.cliTabs.codexCliWs']) {
const transportTab = wrapper.findAll('button').find(
(button) => button.text().trim() === transport
)
expect(transportTab).toBeDefined()
await transportTab!.trigger('click')
await nextTick()
const configToml = wrapper.findAll('pre code')
.map((code) => code.text())
.find((content) => content.includes('model_provider = "OpenAI"'))!
expect(configToml).not.toContain('disable_response_storage')
expect(configToml).not.toContain('windows_wsl_setup_acknowledged')
expect(configToml).not.toMatch(/^network_access = "enabled"$/m)
expect(configToml).toContain('[sandbox_workspace_write]\nnetwork_access = true')
}
await wrapper.setProps({ platform: 'deepseek' })
await nextTick()
const codexTab = wrapper.findAll('button').find(
(button) => button.text().includes('keys.useKeyModal.cliTabs.codexCli')
)
expect(codexTab).toBeDefined()
await codexTab!.trigger('click')
await nextTick()
const routedConfig = wrapper.findAll('pre code')
.map((code) => code.text())
.find((content) => content.includes('[model_providers.sub2api]'))!
expect(routedConfig).not.toContain('disable_response_storage')
expect(routedConfig).not.toContain('windows_wsl_setup_acknowledged')
expect(routedConfig).not.toMatch(/^network_access = "enabled"$/m)
})
})