Repository navigation
Conversation
Mixed-case or uppercase reasoning effort values (e.g. "HIGH") failed to match the lowercase supported-effort lists in resolveOpenAIReasoningEffortForModel, so requests silently resolved to the wrong effort or fell back unexpectedly. Reuse the existing normalizeLowercaseStringOrEmpty helper to trim/lowercase input consistently. Closes openclaw#102908 Co-authored-by: Copilot <[email protected]>
yplongapp
added a commit
to yplongapp/openclaw
that referenced
this pull request
Jul 10, 2026
normalizeOpenAIReasoningEffort previously only handled the literal "minimal" effort value, passing everything else through unchanged. Mixed-case inputs such as "HIGH", "Max", or "Medium" failed to match the lowercase supported-effort lists, causing requests to silently resolve to the wrong effort or fall back unexpectedly. Use the existing normalizeLowercaseStringOrEmpty helper (already imported) to trim and lowercase the effort value consistently. Also add coverage for case-insensitive normalization, whitespace trimming, and end-to-end model pipeline resolution with mixed-case values. Closes openclaw#103169
Contributor
|
Closing as superseded by #102993, landed on main as 4c4609d. The landed implementation fixes canonical mixed-case input without lowercasing every provider-native compat value. It preserves exact mapped output casing, requires explicit maps for canonical-looking provider labels, covers both Responses and Chat Completions callers, and passed exact-head CI plus focused provider/transport proof. Thanks @drvoss for the report and alternative patch. |
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.
What Problem This Solves
normalizeOpenAIReasoningEffortinpackages/ai/src/providers/openai-reasoning-effort.tsdid not lowercase or trim its input. Mixed-case or uppercase reasoning-effort values (e.g."HIGH") failed to match the lowercase supported-effort lists used throughoutresolveOpenAIReasoningEffortForModel, so requests could silently resolve to the wrong effort or fall back unexpectedly.Why This Change Was Made
Reuse the existing
normalizeLowercaseStringOrEmptyhelper (already imported in this file from@openclaw/normalization-core/string-coerce) to trim and lowercase the effort value consistently, falling back to the original value only when the input is not string-like. This keeps the fix small and consistent with existing normalization conventions in the codebase.User Impact
Callers that pass a mixed-case
reasoningEffort(for example via CLI flags, config, or upstream integrations that don't normalize case) will now correctly match the supported-effort lists and fallback maps instead of silently mismatching.Evidence
packages/ai/src/providers/openai-reasoning-effort.test.tscovering direct normalization ("HIGH"->"high","Medium"->"medium","mInImAl"->"minimal") and end-to-end resolution viaresolveOpenAIReasoningEffortForModel.node scripts/run-vitest.mjs packages/ai/src/providers/openai-reasoning-effort.test.ts— all 12 tests pass (10 existing + 2 new).compat.supportedReasoningEfforts/reasoningEffortMapusages acrossextensions/,docs/, andsrc/use lowercase strings exclusively, so lowercasing the fallback-mapped value carries no regression risk in the current codebase.Closes #102908