Repository navigation
fix: honor reasoning capabilities on compatible model routes - #182987
Conversation
Preserve operator effort declarations across catalog resolution and only send an explicit disable value when the selected route supports it. Keep binary controls independent of scalar effort support and retain runtime preference clamping. Fixes #165119. Fixes #177425. Thanks to @tre1d and @eulrich101618 for the reports and reproductions.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6e0f9024d
ℹ️ 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".
| if ( | ||
| model.reasoning && | ||
| (!compat.thinkingOffControlUndeclared || thinkingEnabled !== undefined || !thinkingExplicit) | ||
| (!compat.thinkingOffControlUndeclared || thinkingEnabled === true || !thinkingExplicit) |
There was a problem hiding this comment.
Honor model-level off mappings before suppressing Z.AI controls
When a Z.AI model declares thinkingLevelMap: { off: "none" } without an explicit compat.thinkingFormat, an explicit off request now loses its disable control. The Gateway's provider attribution marks the configured Z.AI endpoint as proxy-like, and resolveOpenAICompletionsCompat sets thinkingOffControlUndeclared because it checks only compat declarations, not thinkingLevelMap. Although the shared resolver correctly returns effort: "none" and thinkingEnabled: false, this new condition skips the block that emits thinking: { type: "disabled" }, leaving server-default thinking enabled. Include model-level off mappings in the declaration check so verified disable mappings remain effective.
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves configured reasoning capabilities and omits undeclared scalar disable values on compatible model routes. Example: opencode-go/muse-spark-1.3-contributor receives a utility request with thinking off and no declared disable mapping.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses two concrete reported failures, resolves the earlier findings, and has no new actionable findings; current-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherModel preparation combines configured and catalog capabilities; shared reasoning policy then converts thinking choices into Completions or Responses request fields. flowchart TD
A[Configured model declarations] --> C[Catalog compatibility owner]
B[Provider catalog metadata] --> C
C --> D[Prepared model route]
D --> E[Shared reasoning resolver]
E --> F[Completions adapter]
E --> G[Responses adapter]
F --> H[Provider endpoint]
G --> H
Technical reviewBest possible solution: Retain the focused catalog and shared-request repairs, preserve declared binary contracts, and complete ordinary current-head CI. Do we have a high-confidence way to reproduce the issue? Current-main source exposes both reported paths, supported by reporter reproductions and the PR's recorded failing request/catalog controls; this review executed no target code. Is this the best way to solve the issue? The patch repairs the existing catalog and request owners, removes the transport-specific off policy, and preserves explicit opt-outs, accepted ladders, mappings, and binary controls without adding competing state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b17d07fc01e0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +43, Tests +158, Docs +7, Other +1. Total +209 across 17 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 26, 2026, 12:27 AM ET / 04:27 UTC (Revision 5). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review The model-level off-map finding is fixed, including production Z.AI attribution with scalar support unset/false. Both regressions fail before the fix; all 156 request tests pass. The attribution HTTP fixture now returns visible answers, and all ten final-head Gateway cases pass. Latest-stable upgrade proof remains an explicit limitation in the PR body. |
|
🦞👀 Re-review progress:
|
Preserve main’s shared route-compat test fixtures while retaining the declared reasoning-effort regression cases. The production reasoning and catalog owners merge unchanged.
Clear only an inherited empty effort ladder when the operator explicitly enables scalar reasoning. Preserve non-empty accepted ladders and explicit configured restrictions.
|
@clawsweeper re-review Merged main without rebasing and preserved its shared test fixtures. The merge-resolution review also found and fixed a boolean-only scalar opt-in being vetoed by an inherited empty catalog ladder; a red regression and nonempty-ladder control now pass. All 265 request/catalog/compat tests, wrapper extraction, prefix stability, scoped checks, and the exact-head live Qwen off/medium recheck pass. Independent review is clean. Current-head evidence and the clearly labeled pre-merge upgrade proof are in the PR body. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…w#182987) * fix: honor reasoning capabilities on compatible model routes Preserve operator effort declarations across catalog resolution and only send an explicit disable value when the selected route supports it. Keep binary controls independent of scalar effort support and retain runtime preference clamping. Fixes openclaw#165119. Fixes openclaw#177425. Thanks to @tre1d and @eulrich101618 for the reports and reproductions. * fix: preserve explicitly mapped reasoning controls * test: align declared reasoning mapping expectations * fix: retain declared binary thinking controls in managed requests * fix: honor model reasoning maps on attributed ZAI routes * test: type mapped reasoning transport cases without assertions * fix: honor scalar reasoning opt-in over empty catalog metadata Clear only an inherited empty effort ladder when the operator explicitly enables scalar reasoning. Preserve non-empty accepted ladders and explicit configured restrictions.
What Problem This Solves
Fixes configured thinking choices being replaced by catalog guesses and utility/title requests failing when an OpenAI-compatible endpoint rejects an undeclared
noneeffort.Closes #165119. Closes #177425. Thanks @tre1d and @eulrich101618 for the reports and reproductions.
User Impact
Operator reasoning lists, mappings, and explicit scalar support survive catalog preparation. Off sends a disable value only when the route declares it; unknown disable contracts omit scalar effort and leave the server default in effect. Saved thinking preferences remain intact under the existing runtime clamping policy. No new configuration field is introduced.
Custom Ollama
/v1users can declarenonethrough existing compat metadata for models that support it. Declared binary formats retain their disable field. Explicit opt-outs and configured effort lists stay authoritative.Why This Change Was Made
The shared request resolver owns scalar off/none mapping across Completions and Responses, replacing the transport-specific off hint. Catalog preparation preserves operator reasoning declarations while leaving unrelated capabilities catalog-owned. Partial maps stay partial; model-level off maps participate in Z.AI declaration detection, and declared binary disable remains available when scalar effort is disallowed. Native model-name disable defaults apply only on known native routes.
A boolean-only scalar opt-in also clears an inherited empty catalog ladder; otherwise the empty ladder still vetoes the operator's setting. Nonempty catalog ladders and explicit configured lists remain intact.
Merged main
4846765d3e20bb194bd17a0a9909e49c2ea69dc6without rebasing. The only conflict was with #183604's test-fixture simplification. The resolution retains its shared helpers and passes the new compat declarations through them; no competing production owner was retained.Production: +102/-58 (net +44, including one wrapper-inventory entry). Tests: +187/-29. Docs: +14/-7. The obsolete Completions off policy was removed; remaining growth preserves declared capabilities and distinct wire contracts. The assertion baseline shrinks by one.
Evidence
Current head:
113f6bfe71d459bc806c680e218f7884e76285f6.chat.sendrecheck on real Ollamaqwen3:8b: saved off sentreasoning_effort: "none", produced 0 reasoning characters, and returned4in 5.264 s. Saved medium sent"medium", produced 448 reasoning characters, and returned4in 1.831 s. Both were HTTP 200, normal stop, no rerouting; the configured default was high and requests carried no thinking override.30807beb8d61b895e6dd0c48357bbe07dfdd61a0also passed ten live Gateway cases: Ollama qwen3:8b/qwen3.5:4b, LM Studio Gemma, managed llama.cpp using the existing GGUF read-only, binary fixtures, and strict Responses/title fixtures. The model-level Z.AI attribution probe changed from HTTP 400/400 to 200/200 after its repair.Exact-head CI passed, including
openclaw/ci-gate. ClawSweeper reviewed this head with no findings and no before-merge items; proof confidence and patch quality are both 5/6.Limits: local macOS proof only; no hosted OpenRouter/Muse inference. The full stable-upgrade proof below was run on the pre-merge head; this head reran the affected suites and the live Qwen control. Unknown custom routes still require a verified disable declaration. Ollama was 0.40.10, whose OpenAI adapter is byte-identical to 0.40.8. The mandatory-thinking Qwen3 4B model was not an off control.
Upgrade proof (pre-merge head)
Completed on macOS arm64, from the registry's
latest([email protected], release commit157d8c2bc3ea2fa183afdc11088e69690bf8e64e) to the then-reviewed head30807beb8d61b895e6dd0c48357bbe07dfdd61a0. Both packages use version 2026.10.7; installed build metadata verified the commit replacement.Used an isolated npm prefix, HOME, state, config, workspace, and loopback Gateway port 20020. Three custom Completions routes used the existing real servers: Ollama
/v1withqwen3:8b, LM Studio withgoogle/gemma-4-e4b, and a mapping-only Ollama route. The first two declaredcompat.supportedReasoningEfforts: ["none", "low", "medium", "high"]; the third declared onlycompat.reasoningEffortMap: {off:"none", medium:"medium"}. Stable requires an API-key-shaped field, so all routes used synthetic unused placeholders with no real credentials.Created six sessions on stable with saved off/medium preferences, ran a normal
chat.sendturn in each, then stopped stable and backed up its databases/config. The configured thinking default was high. After upgrade, the samechat.sendrequests contained no thinking override, and no session creation or preference patch was performed; this proves restored preferences rather than a default or one-turn override.Upgrade method: manual package replacement, as authorized for this proof. The repository packer produced the candidate from the prepared head build; its tarball integrity check passed. Installed that tarball over the same prefix, kept the same state, ran
doctor --non-interactive --fix --yes(exit 0), and ranconfig validate --json(valid=true, warnings=[]), then started the candidate Gateway. No automaticopenclaw updatesuccess is claimed. The runtime-only candidate had Control UI disabled; Doctor’s omitted-UI and empty-workspace advisories were recorded. This proves the persisted model/chat path, not web assets.Redacted command sequence (all CLI commands used the same isolated environment/profile):
The npm installs used the scoped install-script allowlist for OpenClaw and its dependency scripts. The registry install's blocked scripts were completed with an isolated-prefix rebuild before stable startup.
Redacted verification output:
{ "providerDefinitionsAndReasoningDeclarationsPreserved": "3/3", "originalSessionIdsModelsAndSavedPreferencesPreserved": "6/6", "originalTranscriptMessagesPreserved": "12/12", "configuredThinkingDefault": "high (unchanged)", "doctorExit": 0, "configValid": true, "allTwelveTurns": "HTTP 200; visible 4; normal stop; no rerouting", "postUpgradeOff": "3/3 zero reasoning characters", "postUpgradeMedium": "3/3 medium on wire; reasoning remains enabled" }Provider/model definitions, compat lists/maps, and all agent settings are semantically identical before and after Doctor. Doctor added its ordinary migration/wizard markers and missing defaults outside those settings; the whole config file is therefore not byte-identical. All six session IDs, model selections, and saved preferences matched before any new candidate turn, and all twelve original messages remained after the second turns. Timings are functional probes, not benchmarks. Package SHA-256:
6adc960f0e780f3a6861ba1be0be8b15e7211dab7ad3f078953dab24d8aaeeff.No code changed or new head was pushed for this proof. The isolated Gateways were stopped after testing; shared model servers remain running.