Merge remote-tracking branch 'origin/farm/2da60ddc/codex-omit-auto-service-tier'

This commit is contained in:
can1357
2026-08-03 18:47:58 +02:00
3 changed files with 17 additions and 7 deletions
+4
View File
@@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed OpenAI-Codex (ChatGPT OAuth) requests failing with `Unsupported service_tier: auto` on default/legacy sessions. `shouldSendServiceTier` no longer forwards `auto` on the wire — it is OpenAI's implicit default, so omitting `service_tier` is equivalent, and the Codex endpoint rejects an explicit `auto`. Explicit `default`/`flex`/`scale`/`priority` are unaffected ([#7517](https://github.com/can1357/oh-my-pi/issues/7517)).
## [17.2.6] - 2026-08-03
### Added
+8 -5
View File
@@ -214,16 +214,19 @@ export function resolveModelServiceTier(
/**
* True when the tier should be sent on the wire as the provider's service-tier
* request field. OpenAI / OpenAI-Codex accept every {@link ServiceTier};
* Google (Gemini API + Vertex) and OpenRouter accept `flex`/`priority`;
* Fireworks Serverless realizes only its Priority serving path. Anthropic is
* absent because it realizes `priority` via `speed: "fast"`.
* request field. `auto` is never forwarded — it is OpenAI's implicit default, so
* omitting `service_tier` is identical to requesting `auto`, and the Codex
* (ChatGPT OAuth) endpoint rejects an explicit `auto` outright. OpenAI /
* OpenAI-Codex accept every other {@link ServiceTier}; Google (Gemini API +
* Vertex) and OpenRouter accept `flex`/`priority`; Fireworks Serverless
* realizes only its Priority serving path. Anthropic is absent because it
* realizes `priority` via `speed: "fast"`.
*/
export function shouldSendServiceTier(
serviceTier: ServiceTier | null | undefined,
target: Provider | ServiceTierModel | undefined,
): boolean {
if (!serviceTier) return false;
if (!serviceTier || serviceTier === "auto") return false;
const provider = typeof target === "string" ? target : target?.provider;
if (provider === "openai" || provider === "openai-codex") return true;
if (provider === "openrouter") {
@@ -78,14 +78,17 @@ describe("resolveModelServiceTier", () => {
});
describe("shouldSendServiceTier", () => {
it("sends every tier on the OpenAI family and supported tiers elsewhere", () => {
it("sends every explicit tier on the OpenAI family, omits auto, supported tiers elsewhere", () => {
for (const p of ["openai", "openai-codex"] as const) {
expect(shouldSendServiceTier("flex", p)).toBe(true);
expect(shouldSendServiceTier("scale", p)).toBe(true);
expect(shouldSendServiceTier("priority", p)).toBe(true);
expect(shouldSendServiceTier("default", p)).toBe(true);
expect(shouldSendServiceTier("auto", p)).toBe(true);
// `auto` is OpenAI's implicit default and the Codex endpoint rejects it — never sent.
expect(shouldSendServiceTier("auto", p)).toBe(false);
}
expect(shouldSendServiceTier("auto", codex)).toBe(false);
expect(shouldSendServiceTier("auto", customOpenAI)).toBe(false);
expect(shouldSendServiceTier("flex", "openrouter")).toBe(true);
expect(shouldSendServiceTier("default", "openrouter")).toBe(false);
expect(shouldSendServiceTier("priority", customCodex)).toBe(true);