Repository navigation
fix(ai): fold case in OpenAI reasoning-effort matching (#102908) - #102958
ObliviateRickLin wants to merge 1 commit into
Conversation
normalizeOpenAIReasoningEffort passed effort names through unchanged, and
readCompatReasoningEfforts kept user-authored compat entries as written, so a
mixed-case requested effort ("High") or compat list entry ("Low") failed the
lowercase .includes() matching in resolveOpenAIReasoningEffortForModel /
supportsOpenAIReasoningEffort. A miss does not fail loudly — it silently falls
through the support ladder and returns a different effort than the one the model
actually supports.
Lowercase both sides at the boundary: normalizeOpenAIReasoningEffort now folds
case (efforts are matched and sent to the API lowercase), and compat lists use
normalizeStringEntriesLower. Disabled semantics ("None"/"OFF") keep working
case-insensitively as well.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the useful mixed-case reasoning-effort fix is now covered by the newer open PR with sufficient request-path proof, while this branch still has a provider-native compatibility bug. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #102993 as the landing path for #102908, because it fixes canonical effort casing without rewriting provider-native payload labels. So I’m closing this here and keeping the remaining discussion on #102993 and #102908. Review detailsBest possible solution: Use #102993 as the landing path for #102908, because it fixes canonical effort casing without rewriting provider-native payload labels. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main leaves mixed-case canonical efforts unchanged before exact supported-list matching, and the contributor added live before/after request output for the changed path; I did not execute tests in this read-only review. Is this the best way to solve the issue? No. The goal is valid, but this branch lowercases provider-native compat values; the better solution is the narrower open PR that folds canonical names while preserving configured API labels. Security review: Security review cleared: The diff only changes in-repo TypeScript normalization logic and focused tests; it adds no dependency, workflow, secret, package, or code-execution surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 745b8c315eaa. |
Live OpenAI-compatible request run (real setup, wire capture)Stood up a real local OpenAI-compatible Chat Completions endpoint (the mixed-case scenario's home turf — self-hosted/vLLM-style deployments), configured OpenClaw against it, and drove a real agent turn through the built runtime CLI — once on Setup (fresh models.providers.openai: {
baseUrl: "http://127.0.0.1:8090/v1", api: "openai-completions",
request: { allowPrivateNetwork: true },
models: [{ id: "test-effort-model", reasoning: true,
compat: { supportsReasoningEffort: true,
supportedReasoningEfforts: ["Low", "MEDIUM", "High"] } }] // user-authored mixed case
}
agents.defaults.model.primary: "openai/test-effort-model"Command (both runs): Both turns completed ( BEFORE — The operator asked for AFTER — this PR (same config, same command): That is the user-visible bug and the fix on the wire: |
|
🦞✅ Reason: structured ClawSweeper close marker: close-required (sha=d7eee43717175eeb06fbb2f56b1419a0b8de95ae) Closed:
|
What Problem This Solves
normalizeOpenAIReasoningEffort(packages/ai/src/providers/openai-reasoning-effort.ts) passes effort names through unchanged, andreadCompatReasoningEffortskeeps user-authoredcompat.supportedReasoningEffortsentries as written. So a mixed-case requested effort ("High") or a mixed-case compat entry ("Low") fails the lowercase.includes()matching inresolveOpenAIReasoningEffortForModel/supportsOpenAIReasoningEffort. The miss doesn't fail loudly — it silently falls through the support ladder and returns a different effort than the one the model actually supports (e.g. requestedlowagainst a declared["Low","MEDIUM","High"]mis-ladders to another tier). Fixes #102908.Why This Change Was Made
Fold case on both sides of the boundary, using the normalization helpers this package already imports:
normalizeOpenAIReasoningEffortnow lowercases (efforts are matched against lowercase lists and sent to the API lowercase), and compat lists use the existingnormalizeStringEntriesLowersibling helper. Disabled semantics ("None"/"OFF") also work case-insensitively instead of falling through the ladder into an enabled effort. No new options or API surface; internal lowercase callers are byte-for-byte unaffected.User Impact
Operators writing
reasoningEffort/supportedReasoningEffortsvalues in config with any casing get the effort they asked for, instead of a silently substituted tier (which changes model behavior and cost).Evidence
Live OpenAI-compatible request run (wire capture, full recipe in PR comment): real agent turn via
pnpm openclaw agent --local --thinking highagainst a local OpenAI-compatible endpoint with user-authored mixed-casecompat.supportedReasoningEfforts: ["Low","MEDIUM","High"]:Two new regression tests fail on current
mainand pass with this PR:Consumer suites checked:
openai-responses-shared.test.tsgreen;stream-wrappers/openai.test.tshas 2 pre-existing local failures (Codex attribution/user-agent, fail identically with main's reasoning-effort file — verified unrelated).oxfmt/oxlintclean.