Repository navigation
fix: preserve thinking choices across models and runtimes - #150106
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
Consolidate thinking defaults, runtime capability selection, and request intent. Keep native none distinct from logical off, honor declared effort restrictions, and share provider wire policy with standalone completions. Preserve mandatory OpenRouter reasoning without an effort selector, refresh incomplete cached capabilities, and retain default-on reasoning replay. Remove duplicate policy and wrappers while keeping existing configuration.
Contributor
Author
|
Merged via squash.
|
This was referenced Sep 16, 2026
This was referenced Sep 17, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Sep 17, 2026
…50106) * fix: preserve thinking choices across models and runtimes Consolidate thinking defaults, runtime capability selection, and request intent. Keep native none distinct from logical off, honor declared effort restrictions, and share provider wire policy with standalone completions. Preserve mandatory OpenRouter reasoning without an effort selector, refresh incomplete cached capabilities, and retain default-on reasoning replay. Remove duplicate policy and wrappers while keeping existing configuration. * fix: preserve prepared thinking state and defaults Keep standalone wrappers alive across calls and resolve provider thinking before serialization. Preserve trusted runtime alias context, align transport fixtures with verified provider contracts, and consolidate duplicate test setup. * fix: preserve omitted reasoning and scoped model capabilities
This was referenced Oct 4, 2026
This was referenced Oct 11, 2026
This was referenced Oct 19, 2026
This was referenced Oct 27, 2026
Closed
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
Thinking settings could be rejected, silently changed, or serialized incorrectly when selecting another model/runtime, inheriting agent defaults, or using standalone completions. This aligns validation, controls, defaults, and requests with the capabilities of the selected route.
Why This Change Was Made
Thinking policy was duplicated across catalog projections, default resolution, provider wrappers, and transports. Shared request resolution now preserves logical Off, native
none, omission, binary controls, mandatory reasoning, provider-native labels, and explicit capability exclusions. Per-agent and per-model precedence is shared by status, chat, commands, and spawned runs. Scoped runtime refresh replaces only the selected model row, preserving other providers’ prepared capabilities for later switches.Standalone completions apply provider wire policy with the existing once-per-prepared-model wrapper lifetime; returned streams read each call’s thinking choice. Kimi resolves thinking before serialization so payload and replay agree, including empty signatures. Baseten resolves its opt-in default before serialization so disabled thinking cannot be paired with enabled effort. Managed Responses preserves proxy defaults on omission while accepting explicitly supported
none; native OpenAI and Copilot retain their existing defaults. The direct SDK’s distinct omission contract is unchanged.OpenRouter preserves mandatory reasoning when no scalar selector exists. Its derived capability cache refreshes from v3 to v4; config and sessions need no migration. If the first refresh fails, metadata remains temporarily unknown and the existing cold-cache behavior applies. The same request does not retry; a later refresh recovers and persists v4. This is a deliberate derived-cache tradeoff, covered by a 503 → later success → fresh-module durable readback regression.
Duplicate maps, wrappers, default-resolution paths, declarations, and test setup are removed. Production decreases by 488 lines including manifest metadata, or 523 code/type lines excluding metadata. Tests/support grow by 2,004 lines. No configuration, protocol, dependency, or SQLite schema-version changes.
Evidence
Pre-fix reproductions cover default precedence, exact-runtime capabilities, scalar/binary mapping, wrapper lifetime, stale OpenRouter cache reuse, provider omission/replay, and cross-provider catalog retention. Selected owner and sibling suites pass, including the 669-case post-rebase set, 1,396-case cleanup set, 199-case CI repair set, 350-case wrapper/provider set, and final 269-case correction set. Independent review is clean through P2. Canonical selected type, lint, architecture, dead-export, and ratchet checks pass; this is component proof, not a claim that one monolithic changed-check invocation passed.
Authenticated live proof covers OpenAI tools through direct and managed transports, Anthropic thinking signatures, Gemini text/realtime, Kimi K3 Off/Max and tool-result replay, Mistral, Baseten, and OpenRouter. Final reused-model checks include six Baseten GLM-5.2 calls (Off → Max → omitted on each transport), four OpenRouter missing-selector/mandatory cases, and four xAI Grok 4.3 calls (omitted → Off → native
none→ High), all with HTTP 200 and expected outputs/wire controls. Kimi’s native-Max replay check used an opaque tool-provided token to prove actual tool use and exact replay.The complete build passed on
fed27afbdaf366d8296d45ffae7fee931098029ein 9m35s. On that build, isolatedagent execreturned the exact requested output through OpenCode Kimi K3 at Max and Kimi K3 at Off (HTTP 200). Invalid thinking and missing credentials returned explicit, actionable errors. Exact-head CI run 35127601508 and requiredopenclaw/ci-gatepassed. GitHub initially retained the previous PR head after accepting the branch push; closing/reopening this same PR recovered the projection before this final run.A real isolated Gateway/browser verified per-agent defaults, explicit High surviving reload, and
/think defaultrestoring the inherited value. The inspected before/after images were shown in the originating chat and render in this PR.Review follow-through and limitations
ClawSweeper revision 5 reviewed the final head with no actionable findings. Maintainer disposition of its remaining checklist: retain the documented, recovery-tested derived-cache refresh tradeoff; confirm existing config/session formats and wrapper contracts remain unchanged; and treat the data-model flag on
src/commands/agent-command-attempt.test-mocks.tsas test scaffolding, with no production storage/schema change. The complete 196-file diff was reviewed.The ClawSweeper wrapper-lifetime concern is resolved without changing the shipped hook contract. Stateful third-party wrappers survive repeated calls and ambient registry replacement. The cache recovery concern has the failure/recovery/persistence proof above. Final build/CLI results and screenshot delivery address its remaining Rank-up move.
Authenticated Azure, Anthropic Vertex, Amazon Bedrock, ChatGPT subscription, and local llama.cpp inference are not claimed; these routes have source/dependency or request-boundary coverage, and no configured llama.cpp endpoint was running. A separate live Telegram round trip is skipped: the Telegram adapter is unchanged, and common command/status behavior is covered by native-command tests and the real Gateway/UI flow. No live Telegram proof is claimed.
Merged as
f024e6786025e99fd01360542e2c33d8be580e08. Catalog publish run 35131446516 passed; the hosted catalog reports that exact source commit, and all two Kimi and five Baseten rows match the landed manifests, including preservedcodeModemetadata.