Skip to content

fix(anthropic): don't crash models list when a configured Sonnet 5 model has no cost - #102186

Merged
steipete merged 4 commits into
openclaw:mainfrom
VACInc:fix/models-list-sonnet5-cost-crash
Jul 9, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
VACInc:fix/models-list-sonnet5-cost-crash

Conversation

@VACInc

@VACInc VACInc commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

openclaw models list could crash when a configured Claude Sonnet 5 row reached provider normalization without cost metadata. Configured-list and discovery rows are intentionally partial projections, so cost is not guaranteed at those call sites.

Why This Change Was Made

Sonnet 5 pricing normalization now uses one missing-cost-safe flat-cost comparator shared by Anthropic, Amazon Bedrock Mantle, and Anthropic Vertex. This fixes all three reachable sibling normalizers at their provider-owned boundary instead of padding display rows with invented runtime fields or catching and hiding normalization failures.

User Impact

Configured Sonnet 5 models list normally, retaining image capability and context metadata, without requiring provider credentials or cost fields in configuration.

Evidence

  • 95 focused SDK, CLI E2E, and provider tests passed on Blacksmith Testbox.
  • openclaw models list rendered anthropic/claude-sonnet-5 as text+image with 1000k context and exited 0 in a credential-free isolated environment.
  • Independent source-blind validation passed table and --plain runs in two fresh homes.
  • pnpm check:changed, formatting, Plugin SDK API generation/check, and fresh Codex autoreview passed.

Contributor implementation and regression context by @VACInc; maintainer follow-up broadens the fix across the full sibling surface.

@openclaw-barnacle openclaw-barnacle Bot added extensions: anthropic size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 8, 2026
@clawsweeper

clawsweeper Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 5:06 PM ET / 21:06 UTC.

Summary
The branch adds a missing-cost-safe model cost comparator, applies it to Anthropic, Anthropic Vertex, and Amazon Bedrock Mantle Sonnet 5 normalization, and updates focused CLI/provider/SDK coverage plus SDK surface metadata.

PR surface: Source +4, Tests +67, Generated 0, Other 0. Total +71 across 11 files.

Reproducibility: yes. by source inspection. Current main builds configured provider list rows without cost and passes them into provider normalization, where the Sonnet 5 normalizers dereference model.cost fields directly; I did not run a live repro in this read-only review.

Review metrics: 2 noteworthy metrics.

  • Sibling Sonnet 5 normalizers: 3 covered. Anthropic, Anthropic Vertex, and Bedrock Mantle shared the missing-cost comparison invariant, so this avoids a one-sided provider fix.
  • Plugin SDK public helper: 1 added. The new helper expands the public provider-model-shared SDK surface and needs intentional maintainer acceptance before merge.

Stored data model
Persistent data-model change detected: vector/embedding metadata: extensions/anthropic/index.test.ts, vector/embedding metadata: src/plugin-sdk/provider-model-shared.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

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

Risk before merge

  • [P1] The new modelCostsEqual export becomes part of the public provider-model-shared Plugin SDK surface if merged, so maintainers should intentionally accept that API rather than letting a bug fix accidentally expand the contract.

Maintainer options:

  1. Accept the SDK helper (recommended)
    Merge after exact-head CI if maintainers intentionally want modelCostsEqual as a supported provider-model-shared helper.
  2. Make the comparator private first
    Before merge, move the cost comparator out of the public SDK surface or keep provider-local comparisons and refresh generated SDK metadata.

Next step before merge

  • No automated repair is needed; the remaining action is maintainer acceptance of the additive public SDK helper and normal exact-head merge review.

Maintainer decision needed

  • Question: Should OpenClaw accept modelCostsEqual as an additive public helper on openclaw/plugin-sdk/provider-model-shared for this Sonnet 5 cost-normalization fix?
  • Rationale: The code fix is correct, but repository policy treats Plugin SDK surface additions as compatibility-sensitive API direction that needs maintainer intent.
  • Likely owner: steipete — He authored the maintainer follow-up commits that created the shared helper, refreshed the SDK baseline, and updated the surface budgets.
  • Options:
    • Accept the public helper (recommended): Land this shape after exact-head CI because three bundled providers share the same missing-cost comparison invariant and the SDK baseline/budget updates make the new API explicit.
    • Keep the comparator private: Move the comparator to an internal/private location or keep it local to providers, then regenerate the SDK baseline and surface budgets before merge.

Security
Cleared: No concrete security or supply-chain issue was found; the diff changes provider normalization, tests, generated SDK hash metadata, and a budget constant without touching workflows, dependencies, secrets, or install execution.

Review details

Best possible solution:

Land this provider-owned normalization fix after exact-head CI if maintainers accept the additive SDK helper; otherwise keep the comparator private or provider-local and refresh the SDK artifacts.

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

Yes by source inspection. Current main builds configured provider list rows without cost and passes them into provider normalization, where the Sonnet 5 normalizers dereference model.cost fields directly; I did not run a live repro in this read-only review.

Is this the best way to solve the issue?

Yes, conditional on maintainer acceptance of the additive SDK helper. The fix stays at the provider-owned normalization boundary and covers all three sibling normalizers instead of padding display rows or catching failures later.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority CLI/provider crash fix with a limited configured Sonnet 5 model-list blast radius.
  • merge-risk: 🚨 compatibility: The PR adds a public Plugin SDK helper, making the comparator part of the supported provider-model-shared API if merged.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports after-fix Testbox validation plus a credential-free openclaw models list run that rendered the configured Sonnet 5 row, which is sufficient live-output proof for this non-visual CLI/provider bugfix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports after-fix Testbox validation plus a credential-free openclaw models list run that rendered the configured Sonnet 5 row, which is sufficient live-output proof for this non-visual CLI/provider bugfix.
Evidence reviewed

PR surface:

Source +4, Tests +67, Generated 0, Other 0. Total +71 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 4 23 19 +4
Tests 5 109 42 +67
Docs 0 0 0 0
Config 0 0 0 0
Generated 1 2 2 0
Other 1 2 2 0
Total 11 136 65 +71

What I checked:

Likely related people:

  • steipete: He is the current assignee, authored the PR commits that broaden the fix across sibling providers and SDK metadata, and appears repeatedly in recent Anthropic/provider SDK history. (role: recent area contributor and likely follow-up owner; confidence: high; commits: ed4a23270f5c, ef0338e315a6, 8f07db95680f; files: src/plugin-sdk/provider-model-shared.ts, extensions/anthropic/register.runtime.ts, extensions/anthropic-vertex/provider-catalog.ts)
  • vincentkoc: Recent file history shows work on Claude model support and shared provider SDK surfaces adjacent to this cost-normalization helper. (role: recent provider SDK contributor; confidence: medium; commits: f305e707a359, 203160354219, eea777c9fc9c; files: src/plugin-sdk/provider-model-shared.ts, extensions/anthropic/register.runtime.ts, extensions/anthropic-vertex/provider-catalog.ts)
  • vortexopenclaw: GitHub file history shows the Claude Sonnet 5 support commit touching the central provider-model and normalizer surfaces that this PR repairs. (role: introduced related Sonnet 5 support; confidence: medium; commits: 1f6ddb5df089; files: src/plugin-sdk/provider-model-shared.ts, extensions/anthropic/register.runtime.ts, extensions/anthropic-vertex/provider-catalog.ts)
  • VACInc: Beyond authoring this PR's initial fix, recent merged history shows prior work on the model-list row path affected by the configured-row reproduction. (role: reporter, PR author, and prior model-list contributor; confidence: medium; commits: 5ca980126187, 6e8982f7a0fd; files: extensions/anthropic/register.runtime.ts, extensions/anthropic/index.test.ts, src/commands/models/list.rows.ts)
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.
Review history (5 earlier review cycles)
  • reviewed 2026-07-08T13:20:29.587Z sha bff34ee25d651b25252f76a8ea95497490b1594b :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T20:28:10.923Z sha 82622fd1804dc2d3c4d297f0c987f2266d248ccc :: needs changes before merge. :: [P2] Guard the Vertex Sonnet 5 cost comparison too
  • reviewed 2026-07-09T20:44:57.723Z sha a60f74881e962c305f007ab9324ff80d651e248a :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T20:52:31.484Z sha a60f74881e962c305f007ab9324ff80d651e248a :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T20:59:27.643Z sha 8f07db9 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 8, 2026
@VACInc
VACInc force-pushed the fix/models-list-sonnet5-cost-crash branch from bff34ee to 82622fd Compare July 8, 2026 13:25
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 8, 2026
@steipete steipete self-assigned this Jul 9, 2026
@steipete
steipete marked this pull request as ready for review July 9, 2026 20:22
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 9, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Jul 9, 2026
@steipete
steipete force-pushed the fix/models-list-sonnet5-cost-crash branch from 82622fd to 63610e0 Compare July 9, 2026 20:31
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations extensions: anthropic-vertex size: S docs Improvements or additions to documentation and removed size: XS labels Jul 9, 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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 9, 2026
VACInc and others added 4 commits July 9, 2026 21:54
…del has no cost

applyAnthropicSonnet5Cost read params.model.cost.input unconditionally, so
'openclaw models list' aborted with 'Cannot read properties of undefined
(reading input)' whenever config supplied an anthropic Sonnet 5 model row
without cost metadata (e.g. an agents.defaults.models runtime binding).
Guard with optional chaining — a costless model now falls through and gets
the canonical Sonnet 5 cost applied.

Co-Authored-By: Claude Fable 5 <[email protected]>
@steipete
steipete force-pushed the fix/models-list-sonnet5-cost-crash branch from a60f748 to 8f07db9 Compare July 9, 2026 20:54
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 9, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Maintainer closeout for exact head 8f07db95680fc468b131d4651a027c597b30243b:

  • Refactored the fix into one shared missing-cost-safe comparator in src/plugin-sdk/provider-model-shared.ts, then migrated all three provider siblings that share the invariant: Anthropic, Amazon Bedrock Mantle, and Anthropic Vertex.
  • Added provider-level regression coverage, shared SDK coverage, and an actual models list row assertion for a configured model whose cost metadata is absent.
  • Blacksmith Testbox tbx_01kx4736snnbdg5dpq7ngnwb6k: 95 focused tests passed.
  • Credential-free live CLI proof: openclaw models list exited 0 and rendered anthropic/claude-sonnet-5 text+image 1000k no no; --plain also exited 0.
  • Source-blind Blacksmith validation tbx_01kx47ytex0fe8vd8mp5kay147: 4/4 behavior clauses passed across table and plain output.
  • Broad pnpm check:changed, touched-file formatting, generated Plugin SDK API baseline check, and git diff --check all passed after the current-main rebase.
  • The first exact-head matrix exposed one missed generated contract: this new public callable SDK export required the pinned surface budgets to move by one. The final stack includes only those two count updates; fresh autoreview and the static surface-report check passed.
  • Fresh autoreviews found no accepted/actionable findings for the runtime refactor (confidence 0.87) or final CI-metadata repair (confidence 0.82).
  • Final exact-head hosted run 29049523186 passed after rerunning one transient TUI PTY shard; the rerun succeeded without code changes: https://github.com/openclaw/openclaw/actions/runs/29049523186/job/86227976497
  • Earlier hosted matrix (all other lanes green; surface-budget failure diagnosed and fixed): https://github.com/openclaw/openclaw/actions/runs/29048222784

Known proof gaps: none for this credential-free CLI path.

@steipete
steipete merged commit 740e768 into openclaw:main Jul 9, 2026
168 of 171 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
…del has no cost (openclaw#102186)

* fix(anthropic): don't crash models list when a configured Sonnet 5 model has no cost

applyAnthropicSonnet5Cost read params.model.cost.input unconditionally, so
'openclaw models list' aborted with 'Cannot read properties of undefined
(reading input)' whenever config supplied an anthropic Sonnet 5 model row
without cost metadata (e.g. an agents.defaults.models runtime binding).
Guard with optional chaining — a costless model now falls through and gets
the canonical Sonnet 5 cost applied.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(models): normalize missing Sonnet 5 costs

Co-authored-by: VACInc <[email protected]>

* chore(plugin-sdk): refresh API baseline

* ci(plugin-sdk): update surface budgets

---------

Co-authored-by: VACInc <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
mattzyha added a commit to mattzyha/openclaw that referenced this pull request Aug 31, 2026
…s/deploy.sh; close catalog-warning item, root-cause models-list crash

- spec TL;DR: both rsyncs, post-deploy dist-runtime import assertion, layout row
  for dist-runtime, pointer to the scripted deploy.
- .matt/scripts/deploy.sh: detached build, backup both trees, rsync both,
  assertion + marker grep, RESTART_REASON.md, deferred restart, rollback line.
  Dry-run self-test passed on the live trees.
- status: model-catalog warning closed (gone at 20:48/21:02 boots, mechanism
  of disappearance noted as unpinned); models list crash traced to
  applyAnthropicSonnet5Cost lacking upstream's modelCostsEqual guard
  (upstream 740e768 / openclaw#102186, not in v2026.7.1-2).

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation extensions: anthropic extensions: anthropic-vertex merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts 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.

2 participants