Skip to content

fix(anthropic): repair CLI compatibility during model discovery - #162989

Open
fuller-stack-dev wants to merge 5 commits into
openclaw:mainfrom
fuller-stack-dev:fix/claude-model-cli-compatibility
Open

fuller-stack-dev wants to merge 5 commits into
openclaw:mainfrom
fuller-stack-dev:fix/claude-model-cli-compatibility

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes Claude CLI model selection failing when discovery advertises a model that the selected Claude installation is too old to run.

User Impact

Model discovery can update supported, user-owned native, npm and Homebrew Claude installations, then refresh the available model menu. Failed repairs show guidance and a retry deadline; ordinary reads reuse that result, and an explicit refresh retries once. Existing configuration stays unchanged.

Why This Change Was Made

Discovery and execution share compatibility facts and maintenance admission. Known incompatible models stop before execution; explicit unknown model IDs still reach Claude without being advertised as verified. Unsupported or unowned installations receive manual-update guidance.

The current integration also preserves rejected-launcher verification across restarts, cancellation and concurrent owners. Safely verified older models remain usable after a failed installer, and runtime updates renew native model menus.

Evidence

Current signed candidate: 86fa1301298864521d7cde08fd57c28dedbc66e3.

  • Focused current integration passed 166 tests across 11 files. Subsequent reproduced review findings passed 41 installer cases, 12 catalog cases, 3 native-menu expiry cases and 22 readiness cases on the final affected source.
  • Core and extension types and scoped type-aware lint passed. Independent API reviews covered the full candidate and each substantive repair; final repair review found no actionable P0-P2 findings.
  • Full pnpm build passed on the exact signed candidate in 25m 23.9s. Build metadata identifies 86fa1301298864521d7cde08fd57c28dedbc66e3; source remained clean. Current source-blind public-command replay and its terminal recording are pending, and remain required before merge. Exact-head CI is queued; dependency and security-authority checks passed.
  • Historical red/base observation, real credential-free npm upgrade, and historical validation details. These are October 1 evidence for candidate afabe7af37605d7449063d5d5ecbd48847b352b1, retained with their original source identities. All 17 published objects were recovered and hash-verified; they are not claimed as final-head proof.

No live Anthropic inference was used. Earlier public-command validation used a private external Claude fixture. Its unscoped synthetic-auth error also reproduced on unmodified canonical main. The pending current replay covers scoped compatibility and explicit selection with the same private fixture.

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime commands Command implementations agents Agent runtime and tooling extensions: anthropic size: XL labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The branch checks Claude Code model compatibility during discovery and execution, repairs verified local installations, and adds an authorized manual retry through a running Gateway.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The owner split and validation account are useful, but cancellation and diagnostic defects prevent a clean correctness verdict.
Proof confidence 🌊 off-meta tidepool Not applicable: MEMBER authorship exempts ordinary contributor proof. The body reports real npm repair and same-Gateway recovery, but linked storage artifacts were inaccessible to this reviewer. Authority checks reach the updater boundary without a concrete unresolved forbidden-principal violation. New cooldown records use the existing isolated plugin-state schema and require no existing-data migration.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Merge readiness

⛔ Blocked before merge - 5 items remain

This maintainer-authored PR remains useful: current main lacks the compatibility preparation, and the related OAuth work addresses a different path. Two introduced correctness gaps need repair.

Priority: P2
Reviewed head: c9516e2388f79d27b6f98d2849b94ed627dab73a
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should the execution guard reject explicitly configured Claude model families absent from OpenClaw's bundled manifest?
  • Recommendation: Preserve explicit model passthrough: Enforce known minimum versions while leaving explicitly configured unknown families unverified and available for the CLI to handle.
  • Why: The branch intentionally changes previously permissive model passthrough, and source inspection cannot establish acceptance of that user-facing restriction.

Before merge

  • Make joining a shared compatibility check cancellable (P2) - When discovery or another turn is already checking this installation, a second local turn enters this wait. Aborting the second turn does not settle it until the first promise finishes, potentially after the 15-minute installer budget, because its signal is checked only afterward. This retains the canceled turn's queue and cleanup resources. Race this caller's wait against its signal while leaving the shared operation running.
  • Carry compatibility recovery details into public model results (P2) - Failed repair and unsupported-installation messages are placed in runtimeCompatibilityReason, but no production path consumes that field. models-list-result.ts and runtime-choice projection serialize only unavailableReason and unavailableUntil, so callers receive an unavailable model without the installer/version explanation or retry guidance. Publish a typed compatibility diagnostic through the model response contract and cover the actual response projection.
  • Resolve merge risk (P1) - Configured Claude model families absent from the bundled manifest now fail before execution even when the installed CLI may support them; explicit acceptance of this compatibility restriction is not recorded.
  • Complete next step (P2) - Confirm whether explicitly configured unknown Claude model families should remain executable or require bundled catalog membership.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P2] Make joining a shared compatibility check cancellable — extensions/anthropic/cli-readiness.ts:331-333
  • [P2] Carry compatibility recovery details into public model results — src/agents/model-catalog-decisions.ts:308-314
Agent review details

How this fits together

The model catalog combines provider access and runtime readiness into choices shown to CLI and Gateway clients. Anthropic now supplies installation compatibility facts, while core coordinates maintenance with active agent turns.

flowchart TD
  A[Model discovery or agent turn] --> B[Anthropic compatibility check]
  B --> C[Selected Claude executable]
  C --> D{Compatible version?}
  D -->|No| E[Verified installer and idle maintenance]
  E --> B
  D -->|Yes| F[Ready model and execution]
  D -->|Unresolved| G[Unavailable model and recovery guidance]
Loading

Technical review

Best possible solution:

Keep plugin-owned compatibility checks and idle maintenance, publish actionable recovery details, and preserve explicit model passthrough unless the stricter catalog policy is accepted.

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

Yes, source establishes the readiness gap and both review findings: join an in-progress compatibility check and cancel its second caller, or project a failed compatibility result through models.list. No target code was executed during this read-only review.

Is this the best way to solve the issue?

Partly: Anthropic-owned version policy and core maintenance admission are coherent, but shared-wait cancellation and public diagnostics are incomplete; unknown-model rejection also needs a compatibility decision.

Full review comments:

  • [P2] Make joining a shared compatibility check cancellable — extensions/anthropic/cli-readiness.ts:331-333
    When discovery or another turn is already checking this installation, a second local turn enters this wait. Aborting the second turn does not settle it until the first promise finishes, potentially after the 15-minute installer budget, because its signal is checked only afterward. This retains the canceled turn's queue and cleanup resources. Race this caller's wait against its signal while leaving the shared operation running.
    Confidence: 0.97
  • [P2] Carry compatibility recovery details into public model results — src/agents/model-catalog-decisions.ts:308-314
    Failed repair and unsupported-installation messages are placed in runtimeCompatibilityReason, but no production path consumes that field. models-list-result.ts and runtime-choice projection serialize only unavailableReason and unavailableUntil, so callers receive an unavailable model without the installer/version explanation or retry guidance. Publish a typed compatibility diagnostic through the model response contract and cover the actual response projection.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 98d3fdae4449.

Merge-risk options

Maintainer options:

  1. Retain configured model passthrough (recommended)
    Preserve explicit unknown-model execution while retaining checks for known version requirements.
  2. Approve the stricter execution boundary
    Accept that unlisted model families stop working and record the affected upgrade and recovery behavior.

Security

None.

Evidence

What I checked:

  • Pinned introduction: Reviewed the merge-base-to-head production and test changes using the supplied introduction identities; the original PR head is distinct from the GitHub test merge. (c9516e2388f7)
  • Still necessary on main: Current main registers the existing Claude backend without prepareModelCatalog. The same registration in v2026.9.7 also lacks the new compatibility hook. (extensions/anthropic/register.runtime.ts:651, 98d3fdae4449)
  • Release comparison: The latest release's Anthropic registration has no installation-compatibility preparation hook. (extensions/anthropic/register.runtime.ts:665, c074824a27c9)
  • Uncancellable shared wait: The Anthropic readiness owner waits directly on another caller's pending promise. Local execution awaits this hook before acquiring its runtime lease; the joining caller's cancellation is checked only after shared work settles. (extensions/anthropic/cli-readiness.ts:331, c9516e2388f7)
  • Compatibility diagnostics stop before publication: runtimeCompatibilityReason is produced by model decisions but has no production consumer. Public model projection reads only unavailableReason and unavailableUntil, so installer/version recovery text is omitted from model-list responses. (src/agents/model-catalog-decisions.ts:312, c9516e2388f7)
  • Authority and installation safeguards: Manual refresh captures current operator.write authority, subscribes to revocation, and propagates cancellation. Installer commands recheck that authority before spawning; installation selection separately verifies ownership and path permissions. No concrete authorization bypass was found. (src/gateway/server-methods/models-compatibility-refresh.ts:27, c9516e2388f7)

PR surface

Source +1796, Tests +2294, Docs +45. Total +4135 across 54 files.

View PR surface stats
Area Files Added Removed Net
Source 37 1959 163 +1796
Tests 15 2301 7 +2294
Docs 2 48 3 +45
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 54 4308 173 +4135

Review metrics

Metric Value Why it matters
Production versus regression coverage production +1796 net lines; tests and fixtures +2292 net lines Production growth has a stated purpose: installer verification, durable cooldowns, and shared maintenance admission.
Gateway refresh contract 1 optional request parameter and 1 capability added Manual compatibility retries now require operator.write and a Gateway advertising the new capability.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This addresses bounded Claude CLI readiness failures rather than a demonstrated core outage.
  • merge-risk: 🚨 compatibility: The new execution whitelist can reject existing configured model families that previously reached Claude Code.
  • merge-risk: 🚨 availability: A canceled turn joining shared compatibility work can remain pending through a long installer operation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a regression proving a canceled second readiness caller settles while the first check remains pending.
  • Verify failed compatibility guidance survives the public models.list response.
  • Resolve the compatibility policy for explicitly configured unknown model families.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 1, 2026, 4:51 PM ET / 20:51 UTC.

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review October 14, 2026 18:43
@clawsweeper

clawsweeper Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 86fa1301298864521d7cde08fd57c28dedbc66e3
  • Maintainer: @fuller-stack-dev
  • Repository role: maintain

These security sensitive changes were made:

  • src/agents/model-auth-availability.types.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/method-scopes.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-model-catalog-auth.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-hello.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui commands Command implementations docs Improvements or additions to documentation extensions: anthropic gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant