Skip to content

fix(models): preserve exact authored pricing - #144182

Merged
steipete merged 1 commit into
mainfrom
codex/runtime-cost-main-22cd
Sep 10, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/runtime-cost-main-22cd

Conversation

@steipete

@steipete steipete commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Related: #130706, #142100. Builds on #144034.

What Problem This Solves

Runtime pricing could merge prices from an alias or a similarly spelled row into an exact configured model. It also normalized selected model IDs again while recovering authored prices, so alias chains could select a different row.

Why This Change Was Made

Use the existing configured-row materializer to recover authored costs, preserving exact-row precedence and resolving source aliases once. Pass the captured normalization policies through both runtime overrides and configured fallback. Remove the obsolete scoped matcher.

This removes 33 production lines across three files. Same-spelling partial costs, explicit zero, and tiered pricing retain their existing merge rules. No storage or configuration surface changes.

User Impact

An exact configured model keeps its own authored price fields. Omitted fields retain the catalog schedule instead of receiving another row's prices or materialized defaults.

Evidence

  • The original source produced eight intended regression failures, with seventeen controls passing.
  • All 177 focused cases passed, including selected-model rematerialization. After extracting test fixtures to meet the file-size guard, all 57 affected cases passed again; the public-resolver pricing table and assertion body are unchanged.
  • The complete changed gate and fresh P2 review passed on the final six-file commit. The extraction adds no production test seam or lint exception.
  • One normal full build of 0c54207e6d045042e7973fc8e3eb6f58e68165d8 passed, including declarations. Through emitted resolveModelAsync and real registries, all 32 pricing cases passed, with 64 observations of the intended caller paths. V8 coverage confirmed execution of both override and configured-fallback owners.
  • All 11,931 build files remained unchanged; 943 inventoried compiled modules loaded with zero checkout TypeScript imports or HTTP requests. Owned processes exited and synthetic state was removed. Eight additional compiled A/B controls reproduced the explicitly inherited limitation below.
  • Exact-head CI remains required before landing.

A known limitation remains: retained configurations still consult the current global runtime/source pair. A separate baseline/candidate comparison reproduced identical behavior in both directions of an authorship switch, including distinct byte-identical runtimes, same-object rebinds, and retained originals/clones through both cost callers. This cut fixes row selection within the supplied source; it does not establish retained-source isolation.

Recover source prices through the shared row materializer so aliases and literal self-prefixed rows cannot donate prices to an exact configured row. Forward captured normalization policies through runtime overrides and configured fallback, preserving same-spelling, zero, partial, and tiered pricing behavior.

Remove the obsolete scoped matcher. Keep the public resolver pricing matrix and separate its test fixtures without weakening assertions.

Known limitation: retained configurations still use the current global config/source projection. Baseline and candidate have identical A/B authorship-switching behavior; this change does not add retained-source isolation.

Related: #130706, #142100
@clawsweeper

clawsweeper Bot commented Sep 10, 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.

@steipete
steipete marked this pull request as ready for review September 10, 2026 16:23
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 12:36 PM ET / 16:36 UTC (Revision 2).

ClawSweeper review

What this changes

The PR preserves each configured model’s authored pricing by sharing exact-row selection, carrying captured alias policies through both pricing paths, and expanding regression coverage.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main still combines prices across matching aliases. No blocking defect was found, and the updated compiled-validation evidence resolves the previous review’s outstanding request.

Priority: P2
Reviewed head: 0c54207e6d045042e7973fc8e3eb6f58e68165d8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-reuse repair with meaningful regressions and completed reported compiled validation; no actionable correctness or security finding remains.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. Its updated evidence nevertheless records compiled public-resolver execution with real registries covering both changed pricing callers and resolves the prior validation request.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. Its updated evidence nevertheless records compiled public-resolver execution with real registries covering both changed pricing callers and resolves the prior validation request.
Evidence reviewed 7 items Current main still needs the repair: Current main normalizes the selected ID again, filters all equivalent source rows, and reduces their costs together. An alias can therefore donate prices to an exact destination.
Latest-release comparison: The v2026.9.3 source also contains the broad filter/reduce pricing implementation. Local release-blob inspection failed; the read-only GitHub contents request succeeded and supplied the relevant source.
Shared pricing selection: The patch selects the materialized source row using the already-selected runtime ID, then retains the existing cost merge and pricing normalization. Both production cost callers forward captured normalization policies.
Findings None None.
Security None None.

How this fits together

OpenClaw combines configured model metadata with discovered catalog prices before running an agent. This change controls which authored price fields override the catalog schedule during normal resolution and configured fallback.

flowchart TD
  A[Authored model rows] --> C[Shared row selection]
  B[Captured alias policies] --> C
  C --> D[Selected model pricing]
  E[Catalog price schedule] --> F[Merge authored prices]
  D --> F
  F --> G[Resolved or fallback model]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -33, Tests +233. Total +200 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 18 51 -33
Tests 3 315 82 +233
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 333 133 +200

Review metrics

None.

Technical review

Best possible solution:

Use the shared authored-row selector consistently for pricing, preserving explicit rates and catalog inheritance while keeping retained-source isolation as separate work.

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

Yes, source establishes the trigger: configure an alias with prices beside an exact destination with omitted prices, then resolve that destination against a source snapshot. Current main merges both rows; no execution was performed during this review.

Is this the best way to solve the issue?

Yes. Reusing the existing materializer aligns pricing with the documented row-selection contract and removes competing matching logic without changing storage, configuration, or plugin APIs.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 66f95eddbf95.

Labels

Label justifications:

  • P2: This repairs incorrect model cost estimates for configurations containing aliases or similarly spelled rows, with a bounded pricing-only effect.
  • 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. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. Its updated evidence nevertheless records compiled public-resolver execution with real registries covering both changed pricing callers and resolves the prior validation request.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2872da6 adds src/config/model-provider-rows.ts:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2872da666dba; files: src/config/model-provider-rows.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-10T16:28:07.014Z sha 0c54207 :: needs changes before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

The outstanding compiled-validation item is complete at 0c54207e6d045042e7973fc8e3eb6f58e68165d8, and the PR body now records it. One normal full build passed. The emitted resolver with real registries passed all 32 pricing cases (64 caller observations); V8 coverage confirmed both runtime override and configured-fallback paths. All 11,931 build files remained unchanged, with zero checkout TypeScript imports or HTTP requests, and all owned processes/state were cleaned up.

The eight additional A/B controls reproduce the explicitly documented inherited source-projection limitation; they are not a claim that retained-source isolation was repaired. Exact-head CI is still required before landing.

@steipete
steipete merged commit 05d86ff into main Sep 10, 2026
256 of 257 checks passed
@steipete
steipete deleted the codex/runtime-cost-main-22cd branch September 10, 2026 16:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
Recover source prices through the shared row materializer so aliases and literal self-prefixed rows cannot donate prices to an exact configured row. Forward captured normalization policies through runtime overrides and configured fallback, preserving same-spelling, zero, partial, and tiered pricing behavior.

Remove the obsolete scoped matcher. Keep the public resolver pricing matrix and separate its test fixtures without weakening assertions.

Known limitation: retained configurations still use the current global config/source projection. Baseline and candidate have identical A/B authorship-switching behavior; this change does not add retained-source isolation.

Related: openclaw#130706, openclaw#142100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

1 participant