From 670e8314cc88a03fdc3e770c006a4859966bc5e8 Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza Date: Sat, 8 Aug 2026 11:25:37 -0300 Subject: [PATCH] fix(translator): thread model through normalizeResponsesReasoningEffort in promotion path (#8997) Closes #8997 Refs: base-red #9737 fix/8997-gpt56-max-reasoning-rewritte --- .../fixes/8997-gpt56-max-reasoning.plan.md | 1 + .../translator/request/openai-responses.ts | 2 +- tests/unit/triage-bugs-2026-08-02.test.ts | 46 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 changelog.d/fixes/8997-gpt56-max-reasoning.plan.md diff --git a/changelog.d/fixes/8997-gpt56-max-reasoning.plan.md b/changelog.d/fixes/8997-gpt56-max-reasoning.plan.md new file mode 100644 index 0000000000..233441d5d8 --- /dev/null +++ b/changelog.d/fixes/8997-gpt56-max-reasoning.plan.md @@ -0,0 +1 @@ +- **fix(translator):** the Responses-to-Chat promotion path called `normalizeResponsesReasoningEffort` without the model argument, so GPT-5.6 Sol/Terra/Luna requests with `reasoning.effort: "max""` were downgraded to `"xhigh"`. The model is now threaded through, preserving `max` for GPT-5.6 while keeping the legacy downgrade for older models ([#8997](https://github.com/diegosouzapw/OmniRoute/pull/8997)) \ No newline at end of file diff --git a/open-sse/translator/request/openai-responses.ts b/open-sse/translator/request/openai-responses.ts index 67c4a9eb11..6d7a79b8a4 100644 --- a/open-sse/translator/request/openai-responses.ts +++ b/open-sse/translator/request/openai-responses.ts @@ -724,7 +724,7 @@ export function openaiResponsesToOpenAIRequest( const reasoningRec = toRecord(root.reasoning); const effort = toString(reasoningRec.effort); if (effort && result.reasoning_effort === undefined) { - result.reasoning_effort = normalizeResponsesReasoningEffort(effort, model); + result.reasoning_effort = normalizeResponsesReasoningEffort(effort, model ?? root.model); } if ( credentialRecord._copilotClient === true && diff --git a/tests/unit/triage-bugs-2026-08-02.test.ts b/tests/unit/triage-bugs-2026-08-02.test.ts index 70127329f5..2816b888d8 100644 --- a/tests/unit/triage-bugs-2026-08-02.test.ts +++ b/tests/unit/triage-bugs-2026-08-02.test.ts @@ -117,4 +117,50 @@ test("#8853 proxyConfigToUrl accepts ProxyRegistryRecord-shaped object", () => { test("#8853 proxyConfigToUrl returns null for partial config (no host)", () => { const url = proxyConfigToUrl({ type: "http", port: 8080 } as Record); assert.equal(url, null, "proxyConfigToUrl must return null for partial config without host"); +}); + +import test from "node:test"; +import assert from "node:assert/strict"; +import { openaiResponsesToOpenAIRequest } from "../../open-sse/translator/request/openai-responses.ts"; + +function asRecord(value: unknown): Record { + return value as Record; +} + +for (const variant of ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"]) { + test(`#8997 ${variant} nested reasoning.effort max survives promotion`, () => { + const translated = asRecord( + openaiResponsesToOpenAIRequest( + variant, + { model: variant, input: "hello", reasoning: { effort: "max" } }, + false, + {} + ) + ); + assert.equal(translated.reasoning_effort, "max"); + }); + + test(`#8997 ${variant} flat reasoning_effort max survives promotion`, () => { + const translated = asRecord( + openaiResponsesToOpenAIRequest( + variant, + { model: variant, input: "hello", reasoning_effort: "max" }, + false, + {} + ) + ); + assert.equal(translated.reasoning_effort, "max"); + }); +} + +test("non-GPT-5.6 models still get max downgraded to xhigh", () => { + const translated = asRecord( + openaiResponsesToOpenAIRequest( + "gpt-4o", + { model: "gpt-4o", input: "hello", reasoning: { effort: "max" } }, + false, + {} + ) + ); + assert.equal(translated.reasoning_effort, "xhigh"); }); \ No newline at end of file