Repository navigation
fix(thinking): apply Claude profile to anthropic-messages catalog rows - #92053
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 11, 2026, 1:58 AM ET / 05:58 UTC. Summary PR surface: Source +8, Tests +127, Other +52. Total +187 across 5 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 418d7e1e83c5. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +8, Tests +127, Other +52. Total +187 across 5 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
|
|
Addressed the P2 in Native-xhigh families (Opus 4.7/4.8) were unaffected; this only restores parity for adaptive families on custom anthropic-messages providers. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Follow-up self-review note on While re-reading the change, I realized the generalized fallback has a subtle behavior change worth documenting: a non-Claude model on the I think this is the correct behavior — If you'd rather treat this differently (e.g. preserve the compat-based upgrade for non-Claude rows on this transport, or gate the fallback strictly on Claude id detection), happy to follow up — but I think the current behavior is consistent with the bundled anthropic plugin's stance. |
|
Review: Approve with notes (pending write access) LGTM. Clean targeted fix that generalizes the existing anthropic-messages fallback to call resolveClaudeThinkingProfile() for Claude models on any anthropic-messages route. Key points verified:
Note: This competes with #92040 (more general approach). Recommend merging this targeted fix first, then evaluating #92040 separately for broader API-family policy routing. |
b2ff752 to
24bf002
Compare
|
@clawsweeper re-review P2 ( |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review 03:34 那次 re-review queue 已 >4h 仍未出 verdict(原 review comment updated_at 仍是 2026-06-10T23:26:01Z),head 仍是 |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
Address ClawSweeper P2 review on openclaw#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.
…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.
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.
450527b to
31cdca3
Compare
|
Maintainer verification complete.
Best-fix judgment: landable. Routing by the catalog API contract is the correct owner boundary. |
|
Thanks @vincentkoc for the manual verification and merge — appreciated, especially given the ClawSweeper Codex backend had been failing on this item all afternoon. And thanks @gregs535 for the early review. |
openclaw#92053) * 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 openclaw#91975 * fix(thinking): match native Anthropic includeNativeMax in fallback Address ClawSweeper P2 review on openclaw#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 openclaw#91975 anthropic-messages clamp --------- Co-authored-by: wanglu241 <[email protected]>
openclaw#92053) * 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 openclaw#91975 * fix(thinking): match native Anthropic includeNativeMax in fallback Address ClawSweeper P2 review on openclaw#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 openclaw#91975 anthropic-messages clamp --------- Co-authored-by: wanglu241 <[email protected]>
Summary
A custom provider fronting Claude Opus over the native
anthropic-messagesadapter (e.g. a renamedjdcloud-anthropic) had--thinking xhighsilently clamped tooff. Thinking-profile resolution matches bundled plugin policy surfaces by exact provider id, so a renamed Anthropic-compatible provider never reached the anthropic plugin's policy andxhigh/adaptive/maxwere dropped from the resulting profile.auto-reply/thinking.tsalready had anapi === "anthropic-messages"fallback that attached the Fable-5 profile for Fable models. This generalizes that fallback to call the canonicalresolveClaudeThinkingProfile(modelId, params)helper — the same one the anthropic plugin uses — so Claude Opus 4.7/4.8 on anyanthropic-messagesroute gets the correct profile (withxhigh/adaptive/max) regardless of provider id, while Fable models keep the Fable profile.Routing keys on the catalog row's
apifield, not the provider id, so no brittle id matching is introduced.Fixes #91975
Why this fix point
resolveThinkingProfileinsrc/auto-reply/thinking.tsis the sole non-test caller of the dispatcher'sresolveProviderThinkingProfile(verified by grep) and the chokepoint behind every agent-command clamp helper (isThinkingLevelSupported,resolveSupportedThinkingLevel,listThinkingLevels,resolveThinkingDefaultForModel, …). Generalizing the existingapi === "anthropic-messages"fallback here covers exactly the same surface as a dispatcher-level fix with less blast radius, no new internals, and net 5 lines of logic.The default-level path (no explicit
--thinking) goes through the same chokepoint and readsprofile.defaultLevel, so it's covered automatically.Non-regressions
anthropic-messagesrow →resolveClaudeThinkingProfilereturns the Claude base set, which is identical to the existingBASE_THINKING_LEVELS;reasoning:falserows still collapse to off-only via the existing guard.openai-completions) →context.api !== "anthropic-messages", so the fallback isundefinedand behavior is unchanged.Test plan
src/auto-reply/thinking.test.tscovering: (1) Claude Opus xhigh exposed on a customanthropic-messagesprovider without a plugin profile, (2) non-Claude model onanthropic-messagesdoes not gain xhigh, (3) Claude-looking id on anopenai-completionsrow does not infer the Claude profile.auto-reply/thinking.test.ts,plugin-sdk/provider-model-shared.test.ts,plugins/provider-thinking.test.ts,plugins/provider-public-artifacts.test.ts,extensions/anthropic/provider-policy-api.test.ts, plusagents/agent-command.live-model-switch.test.tsandagents/cli-runner.reliability.test.ts.oxlintclean on touched files.pnpm build✓ green (130.4s).Real behavior proof
jdcloud-anthropicfronting Claude Opus over the nativeanthropic-messagesadapter silently clamped--thinking xhightooffbecause the bundled anthropic plugin's policy surface is keyed by provider id. After this fix,xhigh/adaptive/maxsurvive level resolution on anyanthropic-messagescatalog row whosereasoningflag is true.~/Code/openclawchecked out at PR head450527b. Catalog input mirrors the reporter's actualjdcloud-anthropicconfig from issue Native Anthropic adapter silently dropsthinkingtoofffor custom provider ids (resolveThinkingProfile only matches exactanthropic/claude-cli) #91975 (provider idjdcloud-anthropic, three Claude Opus rows onapi: "anthropic-messages"with mixedreasoningflags).scripts/proof-thinking-anthropic-messages.mts) and loads the patchedresolveThinkingProfile/listThinkingLevels/resolveSupportedThinkingLeveldirectly fromsrc/auto-reply/thinking.ts, then probes the exact reported provider/model triple against--thinking xhigh(andmaxon 4.8).thinkingtoofffor custom provider ids (resolveThinkingProfile only matches exactanthropic/claude-cli) #91975 is fixed end-to-end on the live code path.--thinking xhighresolves toxhigh(notoff) onClaude-Opus-4.7-hqandClaude-Opus-4.8;maxalso resolves tomaxon 4.8.Claude-Opus-4.7(reasoning: false) correctly stays off-only via the pre-existing reasoning guard, confirming the fallback didn't widen non-thinking rows. Level lists now expose[off,minimal,low,medium,adaptive,high,xhigh,max]on the thinking-capable rows, matching the bundled anthropic plugin's policy surface.--thinking xhighis out of scope here — that depends on the upstream API accepting the thinking payload and is independent of the OpenClaw clamp this PR fixes. The unit tests + this live proof together verify the clamp logic on the exact reporter input.