fix(codex): support dynamic reasoning efforts (#1012)

* fix(codex): support model-reported reasoning efforts

* fix(web): prevent service worker edge caching

* ci: retrigger stuck Actions run

* fix(codex): accept dynamic reasoning effort values

* fix(web): restore reasoning effort on model switch failure
This commit is contained in:
ejj.cc
2026-07-12 18:38:56 +08:00
committed by GitHub
parent 4c76668a6c
commit d160203bb2
21 changed files with 372 additions and 58 deletions
+2 -13
View File
@@ -19,11 +19,10 @@ import type { ReasoningEffort } from './appServerTypes';
import { parseCodexSpecialCommand } from './codexSpecialCommands';
import { listSlashCommands } from '@/modules/common/slashCommands';
import { resolveCodexSlashCommand } from './utils/slashCommands';
import { parseReasoningEffortValue } from './utils/reasoningEffort';
export { emitReadyIfIdle } from './utils/emitReadyIfIdle';
const REASONING_EFFORTS = new Set<ReasoningEffort>(['none', 'minimal', 'low', 'medium', 'high', 'xhigh'])
export async function runCodex(opts: {
startedBy?: 'runner' | 'terminal';
codexArgs?: string[];
@@ -304,16 +303,6 @@ export async function runCodex(opts: {
return parsed.data;
};
const resolveModelReasoningEffort = (value: unknown): ReasoningEffort | undefined => {
if (value === null) {
return undefined;
}
if (typeof value !== 'string' || !REASONING_EFFORTS.has(value as ReasoningEffort)) {
throw new Error('Invalid model reasoning effort');
}
return value as ReasoningEffort;
};
const resolveModel = (value: unknown): string => {
if (typeof value !== 'string') {
throw new Error('Invalid model');
@@ -363,7 +352,7 @@ export async function runCodex(opts: {
}
if (config.modelReasoningEffort !== undefined) {
currentModelReasoningEffort = resolveModelReasoningEffort(config.modelReasoningEffort);
currentModelReasoningEffort = parseReasoningEffortValue(config.modelReasoningEffort);
}
if (config.collaborationMode !== undefined) {