Add Codex OAuth provider flow for ChatGPT account sign-in (#503)
* feat: add Codex OAuth provider flow * fix: harden Codex OAuth storage, session activation, and UI
This commit is contained in:
committed by
GitHub
parent
252808bbd0
commit
fc7dc9ca0d
65
src/utils/effort.codex.test.ts
Normal file
65
src/utils/effort.codex.test.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { afterEach, expect, mock, test } from 'bun:test'
|
||||
|
||||
afterEach(() => {
|
||||
mock.restore()
|
||||
})
|
||||
|
||||
async function importFreshEffortModule(options: {
|
||||
provider: 'codex' | 'openai'
|
||||
supportsCodexReasoningEffort: boolean
|
||||
}) {
|
||||
mock.module('./model/providers.js', () => ({
|
||||
getAPIProvider: () => options.provider,
|
||||
}))
|
||||
mock.module('./model/modelSupportOverrides.js', () => ({
|
||||
get3PModelCapabilityOverride: () => undefined,
|
||||
}))
|
||||
mock.module('../services/api/providerConfig.js', () => ({
|
||||
supportsCodexReasoningEffort: () => options.supportsCodexReasoningEffort,
|
||||
}))
|
||||
|
||||
return import(`./effort.js?ts=${Date.now()}-${Math.random()}`)
|
||||
}
|
||||
|
||||
test('gpt-5.4 on the ChatGPT Codex backend supports effort selection', async () => {
|
||||
const { getAvailableEffortLevels, modelSupportsEffort } =
|
||||
await importFreshEffortModule({
|
||||
provider: 'codex',
|
||||
supportsCodexReasoningEffort: true,
|
||||
})
|
||||
|
||||
expect(modelSupportsEffort('gpt-5.4')).toBe(true)
|
||||
expect(getAvailableEffortLevels('gpt-5.4')).toEqual([
|
||||
'low',
|
||||
'medium',
|
||||
'high',
|
||||
'xhigh',
|
||||
])
|
||||
})
|
||||
|
||||
test('gpt-5.4 on the OpenAI provider still supports effort selection', async () => {
|
||||
const { getAvailableEffortLevels, modelSupportsEffort } =
|
||||
await importFreshEffortModule({
|
||||
provider: 'openai',
|
||||
supportsCodexReasoningEffort: true,
|
||||
})
|
||||
|
||||
expect(modelSupportsEffort('gpt-5.4')).toBe(true)
|
||||
expect(getAvailableEffortLevels('gpt-5.4')).toEqual([
|
||||
'low',
|
||||
'medium',
|
||||
'high',
|
||||
'xhigh',
|
||||
])
|
||||
})
|
||||
|
||||
test('gpt-5.3-codex-spark stays without effort controls', async () => {
|
||||
const { getAvailableEffortLevels, modelSupportsEffort } =
|
||||
await importFreshEffortModule({
|
||||
provider: 'codex',
|
||||
supportsCodexReasoningEffort: false,
|
||||
})
|
||||
|
||||
expect(modelSupportsEffort('gpt-5.3-codex-spark')).toBe(false)
|
||||
expect(getAvailableEffortLevels('gpt-5.3-codex-spark')).toEqual([])
|
||||
})
|
||||
Reference in New Issue
Block a user