Skip to content

model-usage: handle numeric-string costs and ignore non-finite values #37878

Description

@shuofengzhang

Summary

The skills/model-usage/scripts/model_usage.py helper currently aggregates costs only when values are native numbers.

In practice, usage payloads may include numeric cost fields serialized as strings (for example "1.75"). Those valid values can be dropped during aggregation/model selection. The script can also accept non-finite numeric values (NaN/Infinity) that should be ignored.

Proposed improvement

  • Accept numeric-string cost values.
  • Ignore booleans and non-finite values (NaN, Infinity).
  • Add tests covering these edge cases.

Implemented by PR: #37877

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions