Repository navigation
fix(ai): match reasoning efforts case-insensitively without lowering provider values - #102993
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 2:34 PM ET / 18:34 UTC. Summary PR surface: Source +31, Tests +85. Total +116 across 2 files. Reproducibility: yes. Current main leaves mixed-case canonical effort strings unchanged before exact supported-list matching, so the resolver can miss the intended effort and fall through; the PR body also includes loopback request-path proof. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Land this PR after normal exact-head CI and maintainer merge gates, then close the linked canonical issue as implemented. Do we have a high-confidence way to reproduce the issue? Yes. Current main leaves mixed-case canonical effort strings unchanged before exact supported-list matching, so the resolver can miss the intended effort and fall through; the PR body also includes loopback request-path proof. Is this the best way to solve the issue? Yes. The current PR is the narrowest maintainable fix I found: fold canonical user-facing names and map keys while preserving provider-native configured values instead of lowercasing all compat payloads. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 188d109edaff. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +31, Tests +85. Total +116 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (4 earlier review cycles)
|
|
@clawsweeper re-review Added redacted request-path proof to the PR body. It now includes a loopback OpenAI-compatible |
|
🦞🧹 I asked ClawSweeper to review this item again. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69e1235df1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@clawsweeper re-review Addressed the single mapped-provider-value comment in 3fba59c3667. The resolver now preserves exact |
|
🦞🧹 I asked ClawSweeper to review this item again. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3fba59c366
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4774ca4b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c5761e6 to
cea2bdd
Compare
|
Land-ready at exact head cea2bdd. What was tightened:
Proof:
Known proof gap: a credentialed OpenAI request was unavailable because the Testbox had no OPENAI_API_KEY. Official OpenAI API documentation, direct Codex source, real SDK/HTTP loopback proof, exact-head hosted CI, and provider sibling tests cover the contract without weakening the merge gate. |
|
Merged via squash.
|
…provider values (openclaw#102993) * fix(ai): match reasoning effort case-insensitively * fix(ai): preserve mapped reasoning effort casing * fix(ai): preserve unmapped reasoning effort casing * fix(ai): match reasoning effort map keys by case * fix(ai): harden reasoning effort normalization Co-authored-by: Ted Li <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
…5248) Related: #144866, #90703 ## What Problem This Solves Fixes thinking controls offering and accepting advanced levels from provider-native labels such as `MAX` or `XHIGH`, even though the actual model request silently uses a lower level. ## User Impact The model picker, session validation, and execution now agree on which advanced levels a custom provider supports. Lowercase canonical efforts still work, and explicit mappings such as `max: "MAX"` preserve the provider's exact wire value. Unsupported selections fail without changing the session or its runtime/account selection. ## Why This Change Was Made The shared thinking profile incorrectly applied user-input aliases to provider-native capability labels. It now reads those labels exactly, preserving the [existing explicit-mapping policy](#102993 (comment)). Provider-owned profiles, explicit maps, and null opt-outs are unchanged; no new aliases or transport policy are introduced. The earlier lowercase capability-admission bug is already fixed on main. This update addresses the remaining inconsistent advertisement rather than restoring the older transport changes. ## Evidence A real isolated Gateway and secretless loopback HTTP provider exercised `models.list → sessions.patch → chat.send → chat.history`: | Case | Before | After | | --- | --- | --- | | Unmapped native `MAX` / `XHIGH` | Advertised and accepted `max` / `xhigh`; actual wire used `high` | Not advertised; unsupported selection rejected; accepted `high` sends `high` | | Canonical lowercase `max` | Session and wire `max` | Unchanged | | Explicit `max → MAX` mapping | Session `max`, wire `MAX` | Unchanged | | Explicit null opt-out | Selection rejected | Unchanged | Rejected candidate selections left the complete persisted session row unchanged. A saved synthetic account selected through `/model`, its explicit OpenClaw runtime, and model identity survived both rejection and a subsequent real HTTP turn. A copied pre-fix session now displays its effective supported level instead of the unavailable Maximum choice. - [Inspected before/after screenshots from the real Gateway UI](#145248 (comment)). - New regression fails on the original shared profile; 137 focused policy/admission/wire-contract tests pass after the fix. - Focused formatting and diff checks pass. Full static and matrix checks remain in hosted CI. - Local provider responses were synthetic; no external provider or live-account behavior is claimed. Co-authored-by: Ayaan Zaidi <[email protected]>
…5248) Related: #144866, #90703 ## What Problem This Solves Fixes thinking controls offering and accepting advanced levels from provider-native labels such as `MAX` or `XHIGH`, even though the actual model request silently uses a lower level. ## User Impact The model picker, session validation, and execution now agree on which advanced levels a custom provider supports. Lowercase canonical efforts still work, and explicit mappings such as `max: "MAX"` preserve the provider's exact wire value. Unsupported selections fail without changing the session or its runtime/account selection. ## Why This Change Was Made The shared thinking profile incorrectly applied user-input aliases to provider-native capability labels. It now reads those labels exactly, preserving the [existing explicit-mapping policy](openclaw/openclaw#102993 (comment)). Provider-owned profiles, explicit maps, and null opt-outs are unchanged; no new aliases or transport policy are introduced. The earlier lowercase capability-admission bug is already fixed on main. This update addresses the remaining inconsistent advertisement rather than restoring the older transport changes. ## Evidence A real isolated Gateway and secretless loopback HTTP provider exercised `models.list → sessions.patch → chat.send → chat.history`: | Case | Before | After | | --- | --- | --- | | Unmapped native `MAX` / `XHIGH` | Advertised and accepted `max` / `xhigh`; actual wire used `high` | Not advertised; unsupported selection rejected; accepted `high` sends `high` | | Canonical lowercase `max` | Session and wire `max` | Unchanged | | Explicit `max → MAX` mapping | Session `max`, wire `MAX` | Unchanged | | Explicit null opt-out | Selection rejected | Unchanged | Rejected candidate selections left the complete persisted session row unchanged. A saved synthetic account selected through `/model`, its explicit OpenClaw runtime, and model identity survived both rejection and a subsequent real HTTP turn. A copied pre-fix session now displays its effective supported level instead of the unavailable Maximum choice. - [Inspected before/after screenshots from the real Gateway UI](openclaw/openclaw#145248 (comment)). - New regression fails on the original shared profile; 137 focused policy/admission/wire-contract tests pass after the fix. - Focused formatting and diff checks pass. Full static and matrix checks remain in hosted CI. - Local provider responses were synthetic; no external provider or live-account behavior is claimed. Co-authored-by: Ayaan Zaidi <[email protected]>
…5248) Related: #144866, #90703 ## What Problem This Solves Fixes thinking controls offering and accepting advanced levels from provider-native labels such as `MAX` or `XHIGH`, even though the actual model request silently uses a lower level. ## User Impact The model picker, session validation, and execution now agree on which advanced levels a custom provider supports. Lowercase canonical efforts still work, and explicit mappings such as `max: "MAX"` preserve the provider's exact wire value. Unsupported selections fail without changing the session or its runtime/account selection. ## Why This Change Was Made The shared thinking profile incorrectly applied user-input aliases to provider-native capability labels. It now reads those labels exactly, preserving the [existing explicit-mapping policy](openclaw/openclaw#102993 (comment)). Provider-owned profiles, explicit maps, and null opt-outs are unchanged; no new aliases or transport policy are introduced. The earlier lowercase capability-admission bug is already fixed on main. This update addresses the remaining inconsistent advertisement rather than restoring the older transport changes. ## Evidence A real isolated Gateway and secretless loopback HTTP provider exercised `models.list → sessions.patch → chat.send → chat.history`: | Case | Before | After | | --- | --- | --- | | Unmapped native `MAX` / `XHIGH` | Advertised and accepted `max` / `xhigh`; actual wire used `high` | Not advertised; unsupported selection rejected; accepted `high` sends `high` | | Canonical lowercase `max` | Session and wire `max` | Unchanged | | Explicit `max → MAX` mapping | Session `max`, wire `MAX` | Unchanged | | Explicit null opt-out | Selection rejected | Unchanged | Rejected candidate selections left the complete persisted session row unchanged. A saved synthetic account selected through `/model`, its explicit OpenClaw runtime, and model identity survived both rejection and a subsequent real HTTP turn. A copied pre-fix session now displays its effective supported level instead of the unavailable Maximum choice. - [Inspected before/after screenshots from the real Gateway UI](openclaw/openclaw#145248 (comment)). - New regression fails on the original shared profile; 137 focused policy/admission/wire-contract tests pass after the fix. - Focused formatting and diff checks pass. Full static and matrix checks remain in hosted CI. - Local provider responses were synthetic; no external provider or live-account behavior is claimed. Co-authored-by: Ayaan Zaidi <[email protected]>
…5248) Related: #144866, #90703 ## What Problem This Solves Fixes thinking controls offering and accepting advanced levels from provider-native labels such as `MAX` or `XHIGH`, even though the actual model request silently uses a lower level. ## User Impact The model picker, session validation, and execution now agree on which advanced levels a custom provider supports. Lowercase canonical efforts still work, and explicit mappings such as `max: "MAX"` preserve the provider's exact wire value. Unsupported selections fail without changing the session or its runtime/account selection. ## Why This Change Was Made The shared thinking profile incorrectly applied user-input aliases to provider-native capability labels. It now reads those labels exactly, preserving the [existing explicit-mapping policy](openclaw/openclaw#102993 (comment)). Provider-owned profiles, explicit maps, and null opt-outs are unchanged; no new aliases or transport policy are introduced. The earlier lowercase capability-admission bug is already fixed on main. This update addresses the remaining inconsistent advertisement rather than restoring the older transport changes. ## Evidence A real isolated Gateway and secretless loopback HTTP provider exercised `models.list → sessions.patch → chat.send → chat.history`: | Case | Before | After | | --- | --- | --- | | Unmapped native `MAX` / `XHIGH` | Advertised and accepted `max` / `xhigh`; actual wire used `high` | Not advertised; unsupported selection rejected; accepted `high` sends `high` | | Canonical lowercase `max` | Session and wire `max` | Unchanged | | Explicit `max → MAX` mapping | Session `max`, wire `MAX` | Unchanged | | Explicit null opt-out | Selection rejected | Unchanged | Rejected candidate selections left the complete persisted session row unchanged. A saved synthetic account selected through `/model`, its explicit OpenClaw runtime, and model identity survived both rejection and a subsequent real HTTP turn. A copied pre-fix session now displays its effective supported level instead of the unavailable Maximum choice. - [Inspected before/after screenshots from the real Gateway UI](openclaw/openclaw#145248 (comment)). - New regression fails on the original shared profile; 137 focused policy/admission/wire-contract tests pass after the fix. - Focused formatting and diff checks pass. Full static and matrix checks remain in hosted CI. - Local provider responses were synthetic; no external provider or live-account behavior is claimed. Co-authored-by: Ayaan Zaidi <[email protected]>
…5248) Related: #144866, #90703 ## What Problem This Solves Fixes thinking controls offering and accepting advanced levels from provider-native labels such as `MAX` or `XHIGH`, even though the actual model request silently uses a lower level. ## User Impact The model picker, session validation, and execution now agree on which advanced levels a custom provider supports. Lowercase canonical efforts still work, and explicit mappings such as `max: "MAX"` preserve the provider's exact wire value. Unsupported selections fail without changing the session or its runtime/account selection. ## Why This Change Was Made The shared thinking profile incorrectly applied user-input aliases to provider-native capability labels. It now reads those labels exactly, preserving the [existing explicit-mapping policy](openclaw/openclaw#102993 (comment)). Provider-owned profiles, explicit maps, and null opt-outs are unchanged; no new aliases or transport policy are introduced. The earlier lowercase capability-admission bug is already fixed on main. This update addresses the remaining inconsistent advertisement rather than restoring the older transport changes. ## Evidence A real isolated Gateway and secretless loopback HTTP provider exercised `models.list → sessions.patch → chat.send → chat.history`: | Case | Before | After | | --- | --- | --- | | Unmapped native `MAX` / `XHIGH` | Advertised and accepted `max` / `xhigh`; actual wire used `high` | Not advertised; unsupported selection rejected; accepted `high` sends `high` | | Canonical lowercase `max` | Session and wire `max` | Unchanged | | Explicit `max → MAX` mapping | Session `max`, wire `MAX` | Unchanged | | Explicit null opt-out | Selection rejected | Unchanged | Rejected candidate selections left the complete persisted session row unchanged. A saved synthetic account selected through `/model`, its explicit OpenClaw runtime, and model identity survived both rejection and a subsequent real HTTP turn. A copied pre-fix session now displays its effective supported level instead of the unavailable Maximum choice. - [Inspected before/after screenshots from the real Gateway UI](openclaw/openclaw#145248 (comment)). - New regression fails on the original shared profile; 137 focused policy/admission/wire-contract tests pass after the fix. - Focused formatting and diff checks pass. Full static and matrix checks remain in hosted CI. - Local provider responses were synthetic; no external provider or live-account behavior is claimed. Co-authored-by: Ayaan Zaidi <[email protected]>
…5248) Related: #144866, #90703 ## What Problem This Solves Fixes thinking controls offering and accepting advanced levels from provider-native labels such as `MAX` or `XHIGH`, even though the actual model request silently uses a lower level. ## User Impact The model picker, session validation, and execution now agree on which advanced levels a custom provider supports. Lowercase canonical efforts still work, and explicit mappings such as `max: "MAX"` preserve the provider's exact wire value. Unsupported selections fail without changing the session or its runtime/account selection. ## Why This Change Was Made The shared thinking profile incorrectly applied user-input aliases to provider-native capability labels. It now reads those labels exactly, preserving the [existing explicit-mapping policy](openclaw/openclaw#102993 (comment)). Provider-owned profiles, explicit maps, and null opt-outs are unchanged; no new aliases or transport policy are introduced. The earlier lowercase capability-admission bug is already fixed on main. This update addresses the remaining inconsistent advertisement rather than restoring the older transport changes. ## Evidence A real isolated Gateway and secretless loopback HTTP provider exercised `models.list → sessions.patch → chat.send → chat.history`: | Case | Before | After | | --- | --- | --- | | Unmapped native `MAX` / `XHIGH` | Advertised and accepted `max` / `xhigh`; actual wire used `high` | Not advertised; unsupported selection rejected; accepted `high` sends `high` | | Canonical lowercase `max` | Session and wire `max` | Unchanged | | Explicit `max → MAX` mapping | Session `max`, wire `MAX` | Unchanged | | Explicit null opt-out | Selection rejected | Unchanged | Rejected candidate selections left the complete persisted session row unchanged. A saved synthetic account selected through `/model`, its explicit OpenClaw runtime, and model identity survived both rejection and a subsequent real HTTP turn. A copied pre-fix session now displays its effective supported level instead of the unavailable Maximum choice. - [Inspected before/after screenshots from the real Gateway UI](openclaw/openclaw#145248 (comment)). - New regression fails on the original shared profile; 137 focused policy/admission/wire-contract tests pass after the fix. - Focused formatting and diff checks pass. Full static and matrix checks remain in hosted CI. - Local provider responses were synthetic; no external provider or live-account behavior is claimed. Co-authored-by: Ayaan Zaidi <[email protected]>
…nclaw#145248) Related: openclaw#144866, openclaw#90703 ## What Problem This Solves Fixes thinking controls offering and accepting advanced levels from provider-native labels such as `MAX` or `XHIGH`, even though the actual model request silently uses a lower level. ## User Impact The model picker, session validation, and execution now agree on which advanced levels a custom provider supports. Lowercase canonical efforts still work, and explicit mappings such as `max: "MAX"` preserve the provider's exact wire value. Unsupported selections fail without changing the session or its runtime/account selection. ## Why This Change Was Made The shared thinking profile incorrectly applied user-input aliases to provider-native capability labels. It now reads those labels exactly, preserving the [existing explicit-mapping policy](openclaw#102993 (comment)). Provider-owned profiles, explicit maps, and null opt-outs are unchanged; no new aliases or transport policy are introduced. The earlier lowercase capability-admission bug is already fixed on main. This update addresses the remaining inconsistent advertisement rather than restoring the older transport changes. ## Evidence A real isolated Gateway and secretless loopback HTTP provider exercised `models.list → sessions.patch → chat.send → chat.history`: | Case | Before | After | | --- | --- | --- | | Unmapped native `MAX` / `XHIGH` | Advertised and accepted `max` / `xhigh`; actual wire used `high` | Not advertised; unsupported selection rejected; accepted `high` sends `high` | | Canonical lowercase `max` | Session and wire `max` | Unchanged | | Explicit `max → MAX` mapping | Session `max`, wire `MAX` | Unchanged | | Explicit null opt-out | Selection rejected | Unchanged | Rejected candidate selections left the complete persisted session row unchanged. A saved synthetic account selected through `/model`, its explicit OpenClaw runtime, and model identity survived both rejection and a subsequent real HTTP turn. A copied pre-fix session now displays its effective supported level instead of the unavailable Maximum choice. - [Inspected before/after screenshots from the real Gateway UI](openclaw#145248 (comment)). - New regression fails on the original shared profile; 137 focused policy/admission/wire-contract tests pass after the fix. - Focused formatting and diff checks pass. Full static and matrix checks remain in hosted CI. - Local provider responses were synthetic; no external provider or live-account behavior is claimed. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #102908
Alternative to #102958
Supersedes #103169
What Problem This Solves
Canonical OpenAI-compatible reasoning effort values such as
HIGHorXHIGHcould miss lowercase supported-effort lists and silently fall through to a different effort.Why This Change Was Made
The resolver now trims and folds only canonical reasoning effort names before lookup. Provider-native values remain case-sensitive and are emitted exactly as configured. Canonical-looking provider-native casing must be declared through
reasoningEffortMap, which keeps provider output explicit and prevents values such asNONEfrom being mistaken for core control semantics.The same normalization path is exercised by both OpenAI Responses and Chat Completions payload builders.
User Impact
Users get the intended reasoning effort even when canonical values use mixed casing or surrounding whitespace. Custom OpenAI-compatible providers keep their exact mapped payload labels.
Evidence
tbx_01kx4w5fxp81tfkw75hk0mjbk5: 471 focused and sibling tests passed across the resolver, both transports, shared Responses logic, stream wrappers, plugin SDK, Groq, and LM Studio.pnpm check:changedpassed for the core and core-test lanes.pnpm buildpassed.xhighpayloads:{"responses":"xhigh","chatCompletions":"xhigh","paths":["/v1/chat/completions","/v1/responses"]}Closes #102908