mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-22 18:35:21 -06:00
43b4e27699
* fix(thinking): apply Claude profile to anthropic-messages catalog rows When a custom provider (e.g. `jdcloud-anthropic`) fronted Claude Opus over the native anthropic-messages adapter, `--thinking xhigh` was silently clamped to `off`. The thinking-profile dispatcher resolves bundled plugin policy surfaces by exact provider id, so a renamed Anthropic-compatible provider never reached the anthropic plugin's policy and `xhigh` was not in the resulting profile. `auto-reply/thinking.ts` already had a fallback keyed on `context.api === "anthropic-messages"` that attached `CLAUDE_FABLE_5_THINKING_PROFILE` for Fable models. Generalize it to use `resolveClaudeThinkingProfile(modelId, params)` instead — the same canonical helper the anthropic plugin uses — which still returns the Fable profile for Fable models and now returns the correct Opus 4.7/4.8 profile (with `xhigh`/`adaptive`/`max`) for Claude Opus regardless of provider id. Non-Claude models on anthropic-messages routes still get the base profile, and a Claude id on a non-Anthropic transport (e.g. an openai-completions catalog row) is unaffected. Fixes #91975 * fix(thinking): match native Anthropic includeNativeMax in fallback Address ClawSweeper P2 review on #92053. The anthropic-messages fallback in `resolveThinkingProfile` calls `resolveClaudeThinkingProfile` but omits the `{ includeNativeMax: true }` option that the bundled anthropic plugin uses (extensions/anthropic/provider-policy-api.ts:38,45). For native-xhigh Claude families (Opus 4.7/4.8) this had no effect since the native-xhigh branch already exposes `max`. But adaptive Claude families that take the adaptive-default branch (e.g. claude-sonnet-4-6, claude-opus-4-6) silently lost `max` parity on custom anthropic-messages providers compared to native Anthropic policy. Also add a regression test on `claude-sonnet-4-6` that verifies the adaptive-branch path keeps `max` for custom providers. * docs(thinking): document deliberate compat.xhigh bypass on anthropic-messages Self-review surfaced a subtle behavior change worth documenting: when the anthropic-messages fallback was generalized, non-Claude models on this transport stop honoring catalog `compat.supportedReasoningEfforts: ["xhigh"]` because they take the Claude base profile instead of falling through to the later `catalogSupportsXHigh` upgrade path. This is intentional — anthropic-messages does not carry a generic xhigh contract; xhigh on this protocol is a Claude-family capability. Add an inline comment at the resolver site and a regression test that locks the suppression so the next reader (or a future patch) doesn't accidentally restore the upgrade path. * fix(thinking): extract Claude profile to leaf to break import cycle The previous commits added a `resolveClaudeThinkingProfile` import from `auto-reply/thinking.ts` to `plugin-sdk/provider-model-shared.ts`. The shared barrel re-exports `provider-replay-helpers` and `plugins/types`, which transitively reach back into `auto-reply` via the gateway server methods chain — creating the madge cycle reported by `check:madge-import-cycles`: auto-reply/thinking.ts -> ... -> plugin-sdk/provider-model-shared.ts -> plugins/{config-schema, host-hooks, ...} -> plugins/types.ts Move `BASE_CLAUDE_THINKING_LEVELS`, `isClaudeAdaptiveThinkingDefaultModelId`, and `resolveClaudeThinkingProfile` to a new leaf module `src/plugins/provider-claude-thinking.ts` whose only imports are `@openclaw/llm-core` and the existing leaf `provider-thinking.types`. `provider-model-shared.ts` continues to re-export both helpers so existing consumers (`extensions/anthropic/*`, the public test surface) are unaffected. `auto-reply/thinking.ts` now imports the leaf directly, breaking the cycle. * test(thinking): add live proof harness for #91975 anthropic-messages clamp --------- Co-authored-by: wanglu241 <wanglu241@jd.com>