CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

Fix: Refresh pricing for unknown models

Open iam-brain opened this issue 4 months ago • 0 comments

Closes #2017

When a usage report contains a model without pricing, CodexBar now joins or starts one shared models.dev refresh and reruns the report only after the requested pricing is confirmed in the persisted catalog. Exact model IDs and token usage remain cached while pricing is unavailable.

TTL and unknown-model refreshes are coalesced per cache file. Every catalog attempt bounds another unknown-model attempt within the process, and a successful catalog fetch persists its 15-minute cooldown through fetchedAt for app/CLI process boundaries. The report has an explicit one-retry boundary.

Validation:

  • focused pipeline tests cover overlapping and sequential TTL/unknown refreshes, failed refresh bounding, background-refresh races, unresolved models, and cache-save failure
  • end-to-end fetcher test covers retroactive repricing
  • swiftformat --lint and strict SwiftLint on changed files
  • Swift frontend parsing and generated parser hash check
  • required review gate with no unresolved High or Medium findings

Full local XCTest remains blocked because Command Line Tools lacks actool, while the selected Xcode beta license has not been accepted. GitHub Actions provides the executable macOS test signal.

iam-brain avatar Jul 10 '26 00:07 iam-brain