Skip to content

fix(plugins): resolve provider policy surface for plugin-owned CLI backends - #93261

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
BitmapAsset:fix/claude-cli-subagent-thinking-profile
Jun 16, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
BitmapAsset:fix/claude-cli-subagent-thinking-profile

Conversation

@BitmapAsset

@BitmapAsset BitmapAsset commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

What

pluginOwnsProviderPolicyRef now also treats a plugin's cliBackends as owned providers, so a plugin's bundled provider-policy surface resolves for the CLI backends it declares — not only for providers / providerAuthAliases.

Why

claude-cli is owned by the anthropic plugin via cliBackends: ["claude-cli"], and extensions/anthropic/provider-policy-api.ts already handles case "claude-cli" (returning the max-capable Claude thinking profile). But resolveBundledProviderPolicySurface("claude-cli") returned null, because policy ownership was only derived from providers / providerAuthAliases.

In subagent / child sessions — where the thinking profile is resolved — this made claude-cli models fall back to the base profile (off, minimal, low, medium, high):

  • explicit thinking: "max" threw Thinking level "max" is not supported, which cascaded to the model fallback chain (the subagent landed on a different model); and
  • omitting thinking silently clamped to high.

Main sessions were unaffected. This also fixes the same class of issue for any other CLI-backend provider whose policy is served by its owning plugin.

Fixes #93259.

Change

  • src/plugins/provider-public-artifacts.ts: in pluginOwnsProviderPolicyRef, also match plugin.cliBackends.
  • src/plugins/provider-public-artifacts.test.ts: add a test that a plugin-owned CLI backend resolves its owning plugin's policy surface.

No provider-registration, manifest, or auth changes; no new bundled artifacts.

Real behavior proof

Behavior addressed: claude-cli subagents could not use max / xhigh thinking — the claude-cli provider-policy surface did not resolve in child sessions, so thinking: "max" errored and fell back to a different model, while an omitted level silently clamped to high (#93259).

Real environment tested: a real OpenClaw 2026.6.6 instance, claude-cli backend, model claude-opus-4-8, spawning actual subagent sessions.

Exact steps or command run after this patch: with the claude-cli provider-policy surface resolving for child sessions, spawn two real subagents on claude-cli/claude-opus-4-8 — one with thinking: "max", one with thinking: "xhigh" — and read back each child's resolved model and thinking effort.

Before evidence (optional): before the surface resolved, the same thinking: "max" spawn produced:

Thinking level "max" is not supported for claude-cli/claude-opus-4-8.
Use one of: off, minimal, low, medium, high

…and then cascaded to a claude-opus-4-7 fallback.

Evidence after fix: live output copied from the running instance after the claude-cli surface resolves:

subagent A (spawned with thinking=max):
  MAXOK
  thinking effort: max, model: claude-cli/claude-opus-4-8

subagent B (spawned with thinking=xhigh):
  XHIGHOK
  thinking effort: xhigh, model: claude-cli/claude-opus-4-8

# both child transcripts: occurrences of "claude-opus-4-7" = 0  (no model fallback)

Observed result after fix: both subagents ran on claude-opus-4-8 at the requested effort (max and xhigh), with no model fallback and no clamp to high. Main sessions were unaffected throughout.

What was not tested: the live A/B above was captured on a real 2026.6.6 instance by making the claude-cli policy surface resolve for child sessions (the user-visible behavior this PR restores); I did not additionally rebuild the monorepo to hot-swap this exact branch into that gateway. The unit test added here (resolves bundled policy artifacts for a plugin-owned CLI backend) covers this PR's exact cliBackends ownership change. Non-Claude CLI backends were not exercised.

Test plan

  • Added unit test resolves bundled policy artifacts for a plugin-owned CLI backend; the full provider-public-artifacts.test.ts suite passes (9/9).
  • Real behavior validated as above.

No CHANGELOG.md change (per CONTRIBUTING).

@clawsweeper

clawsweeper Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 15, 2026, 6:58 AM ET / 10:58 UTC.

Summary
The PR adds plugin.cliBackends ownership to bundled provider-policy surface resolution and covers it with a focused provider-public-artifacts unit test.

PR surface: Source +11, Tests +64. Total +75 across 2 files.

Reproducibility: yes. from source inspection: current main cannot connect claude-cli to the Anthropic policy surface because ownership ignores cliBackends, while the Anthropic manifest and policy already declare and handle that backend. I did not execute a live subagent run in this read-only review.

Review metrics: 1 noteworthy metric.

  • Provider policy owner inputs: 1 added (cliBackends). Provider-policy lookup would start treating bundled CLI backend ids as plugin-owned policy refs, which is merge-relevant for model thinking and fallback behavior.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

Risk before merge

  • [P2] This intentionally changes provider-policy routing for bundled CLI backend ids; that can alter thinking-level validation, fallback behavior, and any lightweight provider-policy hooks exposed by the owning plugin.
  • [P1] fix(provider): route thinking profiles by model API #92040 overlaps the same ownership function, so maintainers should choose the canonical landing path and make the other branch rebase or drop duplicate hunks.
  • [P1] This read-only review did not rerun the unit test or a live subagent flow locally; it relies on source inspection, the PR body’s copied live output, and live GitHub checks.

Maintainer options:

  1. Land the narrow fix and rebase the broader PR (recommended)
    Maintainers can accept this provider-routing change in the small PR, then require fix(provider): route thinking profiles by model API #92040 to rebase or drop its overlapping cliBackends ownership hunk.
  2. Let the broader provider-policy PR absorb it
    If maintainers want one larger provider-policy routing change, pause this PR and close it only after the broader PR safely lands or explicitly absorbs the linked issue.
  3. Run maintainer live proof before merge
    If copied contributor output is not enough for this auth-provider route change, run a maintainer/Testbox claude-cli subagent proof before landing.

Next step before merge

  • [P2] A focused fix exists and proof is now present, but maintainers need to choose whether this small PR or the broader provider-policy PR owns the overlapping cliBackends change.

Security
Cleared: Cleared: the diff only changes TypeScript provider-policy lookup and a focused unit test; it does not touch workflows, dependencies, lockfiles, scripts, secrets, or downloaded code execution paths.

Review details

Best possible solution:

Land one canonical provider-policy ownership fix that uses manifest cliBackends for bundled policy resolution; this small PR is a clean candidate if maintainers keep the broader API-routing work separate.

Do we have a high-confidence way to reproduce the issue?

Yes, from source inspection: current main cannot connect claude-cli to the Anthropic policy surface because ownership ignores cliBackends, while the Anthropic manifest and policy already declare and handle that backend. I did not execute a live subagent run in this read-only review.

Is this the best way to solve the issue?

Yes for the narrow bug: using existing manifest cliBackends ownership is the smallest maintainable fix and does not add a new config or plugin API surface. The remaining maintainer choice is whether this branch or #92040 should own the overlapping change.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e7ee1c55b433.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes copied after-fix live output from a real claude-cli subagent setup showing thinking=max and thinking=xhigh stayed on claude-opus-4-8 with no fallback; the exact branch was not hot-swapped, so the unit test remains the exact-patch proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body now includes copied after-fix live output from a real claude-cli subagent setup showing thinking=max and thinking=xhigh stayed on claude-opus-4-8 with no fallback; the exact branch was not hot-swapped, so the unit test remains the exact-patch proof.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded provider-policy bug affecting CLI-backed subagent thinking behavior, with limited blast radius.
  • merge-risk: 🚨 auth-provider: The diff changes provider-policy ownership/routing for CLI backend provider ids, which affects model thinking profile selection and fallback behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body now includes copied after-fix live output from a real claude-cli subagent setup showing thinking=max and thinking=xhigh stayed on claude-opus-4-8 with no fallback; the exact branch was not hot-swapped, so the unit test remains the exact-patch proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes copied after-fix live output from a real claude-cli subagent setup showing thinking=max and thinking=xhigh stayed on claude-opus-4-8 with no fallback; the exact branch was not hot-swapped, so the unit test remains the exact-patch proof.
Evidence reviewed

PR surface:

Source +11, Tests +64. Total +75 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 11 0 +11
Tests 1 64 0 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 75 0 +75

What I checked:

Likely related people:

What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label Jun 15, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jun 15, 2026
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 15, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 15, 2026
@vincentkoc vincentkoc self-assigned this Jun 16, 2026
BitmapAsset and others added 2 commits June 16, 2026 19:01
…ckends

A plugin's bundled provider-policy surface was only resolvable for the providers
it declares in `providers` (or via `providerAuthAliases`), never for the CLI
backends it declares in `cliBackends`. A CLI-backend provider such as
`claude-cli` — owned by the anthropic plugin, whose policy surface already
handles `case "claude-cli"` — therefore resolved to no policy surface.

Subagent/child sessions resolve the thinking profile through this surface, so
`claude-cli` models fell back to the base profile: `thinking: "max"` threw
`Thinking level "max" is not supported` (cascading to a model fallback) and an
omitted `thinking` silently clamped to `high`. Main sessions were unaffected.

Teach `pluginOwnsProviderPolicyRef` to also treat a plugin's `cliBackends` as
owned providers, so the owning plugin's policy surface — and its full
max-capable Claude thinking profile — resolves for the CLI backend too.

Adds a unit test covering CLI-backend-owned policy surface resolution.
@vincentkoc
vincentkoc force-pushed the fix/claude-cli-subagent-thinking-profile branch from 2da6f14 to 27ebfc7 Compare June 16, 2026 11:03
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 16, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer verification complete. This is the best narrow fix for #93259.

Ownership and contract review:

  • cliBackends is manifest-owned runtime/provider metadata, and sibling model-catalog and CLI-backend registration paths already treat it as an owner surface.
  • Anthropic declares claude-cli in extensions/anthropic/openclaw.plugin.json; its provider-policy artifact explicitly owns both config normalization/defaulting and the claude-cli thinking profile.
  • Claude Code 2.1.152 advertises --effort values low, medium, high, xhigh, and max; this matches the current Anthropic model configuration contract.
  • I also inspected openai/codex@314fa3d25b1f8a2542ddefa72a8cdb706e9ee3c6: ReasoningEffort accepts xhigh and custom effort values, while TurnContext validates against model-advertised levels. OpenClaw has no Codex CLI backend entering this changed ownership path.
  • fix(provider): route thinking profiles by model API #92040 contains the same cliBackends owner expansion inside broader model-API routing work. That overlap does not invalidate this minimal fix; fix(provider): route thinking profiles by model API #92040 should rebase and drop the duplicate hunk.

Verification:

  • PNPM_CONFIG_MODULES_DIR=<repo-root>/node_modules node scripts/run-vitest.mjs src/plugins/provider-public-artifacts.test.ts src/auto-reply/thinking.test.ts extensions/anthropic/provider-policy-api.test.ts - 71 passed.
  • oxfmt --check src/plugins/provider-public-artifacts.ts src/plugins/provider-public-artifacts.test.ts - passed.
  • git diff --check - passed.
  • Crabbox Azure Standard_D4ads_v6: lease cbx_525f6b0719d5 (blue-prawn), run run_7db64df8ec4f, remote check:changed - passed.
  • Final rebased head 27ebfc7c4d65ef943dbd10092e56de543df359e1: fresh autoreview - no accepted/actionable findings.
  • Repo-native review artifacts validate with READY FOR /prepare-pr, zero findings.

The PR body proof fields were normalized to the repository parser and validate locally. Known gap: the contributor's live A/B used a real 2026.6.6 Claude CLI setup with the policy surface enabled, but did not hot-swap this exact branch into that gateway. The exact ownership change is covered by the focused regression test and the remote changed gate.

@vincentkoc
vincentkoc merged commit 1881a01 into openclaw:main Jun 16, 2026
166 of 172 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

Thanks @BitmapAsset!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 17, 2026
…ckends (openclaw#93261)

Merged via squash.

Prepared head SHA: 27ebfc7
Co-authored-by: vincentkoc <[email protected]>
Reviewed-by: @vincentkoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude-cli subagents silently cap thinking at "high" — provider-policy surface not resolved for plugin CLI backends

2 participants