Repository navigation
fix(translator): pass output_config.effort=max through verbatim - #9053
Merged
diegosouzapw merged 1 commit intoAug 4, 2026
Conversation
The claude->openai translator was unconditionally rewriting max to xhigh, which broke any OpenAI-shape upstream that accepts max literally (e.g. ollama-cloud, opencode-go deepseek, moonshot k3, native Claude). Provider-aware effort policy is owned by sanitizeReasoningEffortForProvider in the executor; the translator should only do form conversion. Regression guard: tests/unit/base-executor-sanitize-effort.test.ts end-to-end case (claude -> ollama-cloud preserves max).
ikelvingo
force-pushed
the
fix/claude-to-openai-max-passthrough
branch
from
July 31, 2026 10:22
b2d59f4 to
e30b950
Compare
Owner
|
Merged via local merge-train on 192.168.0.113 (32 cores) @ train tip Green: Reds, each discriminated against the clean release tip
No red attributable to this PR. |
diegosouzapw
merged commit Aug 4, 2026
c790b57
into
diegosouzapw:release/v3.8.50
15 of 16 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…osouzapw#9053) The claude->openai translator was unconditionally rewriting max to xhigh, which broke any OpenAI-shape upstream that accepts max literally (e.g. ollama-cloud, opencode-go deepseek, moonshot k3, native Claude). Provider-aware effort policy is owned by sanitizeReasoningEffortForProvider in the executor; the translator should only do form conversion. Regression guard: tests/unit/base-executor-sanitize-effort.test.ts end-to-end case (claude -> ollama-cloud preserves max).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a contract mismatch where
output_config.effort="max"from an Anthropic-format request was incorrectly rewritten toxhighwhen translating to an OpenAI-compatible upstream. This caused upstreams that acceptmaxliterally but rejectxhigh— such as Ollama Cloud — to return HTTP 400invalid reasoning value: 'xhigh'.Root Cause
open-sse/translator/request/claude-to-openai.ts::normalizeOpenAIReasoningEffortunconditionally rewrotemax → xhighduring step 1 (translation). However, provider-aware allowlist decisions belong insanitizeReasoningEffortForProvider(the executor layer), which holds the full provider capability table — including providers that explicitly opt in tosupportsMaxEffortForProvider(): ollama-cloud, opencode-go deepseek, moonshot k3, and native claude.Because the translator runs before the sanitizer, the carrier was already
xhighby the time the sanitizer saw it, so theeffortStr === "max"branch could never fire — themaxinformation was lost before reaching the sanitizer.Fix
Removed the
if (normalized === "max") return "xhigh"line inclaude-to-openai.ts. The translator now only performs form conversion (lowercase + non-empty filtering) and no longer makes allowlist decisions;maxis written verbatim toresult.reasoning_effort. Also updated the top comment inreasoningEffort.ts(English) to document this division of responsibility.Impact
maxliterally (e.g. ollama-cloud) now passmaxthrough unchanged instead of returning 400.effortStr === "max"branch already covered the "client sendsmaxdirectly in OpenAI-format" case; it now also covers the new "translator passesmaxthrough" path.Verification
tests/unit/translator-claude-to-openai.test.ts— assertion updated to expectmaxpass-through.tests/unit/base-executor-sanitize-effort.test.ts— added end-to-end test:translateRequest(CLAUDE→OPENAI)+sanitizeReasoningEffortForProvider("ollama-cloud", …)chain keepsoutput_config.effort="max"asmaxend-to-end.Repro (before fix)
After fix: HTTP 200,
reasoning_effort: "max"forwarded to ollama-cloud.