fix(routing): honor client reasoning.effort for gpt-5.5 + route suffixed variants to codex (#2877)

(A) For a Codex-only account, a bare gpt-5.5 Responses request was rerouted to
codex with the model hardcoded to gpt-5.5-medium (chatHelpers.ts). The Codex
executor reads a model-name suffix as an explicit modelEffort that, per #2331,
overrides the client's reasoning.effort — so a genuine reasoning.effort=xhigh
was silently demoted to medium. Keep the bare gpt-5.5 id (the connection
fallback still supplies the default effort); the executor precedence is
untouched, so #2331 stays intact.

(B) gpt-5.5-xhigh/-high/-low misrouted to the openai provider (only bare gpt-5.5
was codex-preferred), so codex-only users got 'No credentials for provider:
openai'. Add the suffixed variants to CODEX_PREFERRED_UNPREFIXED_MODELS so they
infer codex before the /^gpt-/ → openai fallback.

Closes #2877
This commit is contained in:
diegosouzapw
2026-05-31 09:05:35 -03:00
parent 923b8fe14f
commit f5d74cd76d
4 changed files with 96 additions and 3 deletions

View File

@@ -130,9 +130,14 @@ export async function resolveModelOrError(
!isCodexNativeResponsesRequest(body, endpointPath, requestHeaders) &&
(await hasOnlyActiveCodexAccount())
) {
log.info("ROUTING", `${modelStr} → codex/gpt-5.5-medium (Codex-only active account)`);
// #2877: keep the bare model id (do NOT bake a `-medium` suffix). The Codex
// executor reads a model-name suffix as an explicit `modelEffort` that (per
// #2331) overrides the client's `reasoning.effort`, so injecting `-medium`
// here silently demoted a genuine `reasoning.effort=xhigh`. The default
// effort still comes from the connection fallback when the client sends none.
log.info("ROUTING", `${modelStr} → codex/gpt-5.5 (Codex-only active account)`);
modelInfo.provider = "codex";
modelInfo.model = "gpt-5.5-medium";
modelInfo.model = "gpt-5.5";
}
// Forced-rewrite: codex provider doesn't serve DeepSeek/Qwen/Kimi/etc. Reroute