cctally 1.94.2 → 1.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -944,10 +944,10 @@ def _check_db_version_ahead(s: DoctorState) -> CheckResult:
944
944
  # gather layer injects the real constant, so this only guards a hand-
945
945
  # built DoctorState that omitted it. It sat at 1000 against a current
946
946
  # constant of 1008 for eight epochs, which made this guard report a
947
- # current index as a mismatch; corrected with the 1009 bump
947
+ # current index as a mismatch; keep this in lockstep with core
948
948
  # (#496 S5b §6.1). It stays a literal because this kernel is pure and
949
949
  # must not import `_cctally_core`.
950
- epoch = 1009
950
+ epoch = 1010
951
951
  mismatch = uv > legacy_head and uv != epoch
952
952
  return {"user_version": uv, "legacy_head": legacy_head, "epoch": epoch,
953
953
  "mismatch": mismatch}
@@ -726,6 +726,17 @@ _unknown_codex_model_warnings: set[str] = set()
726
726
  # directly comparable.
727
727
  CODEX_LEGACY_FALLBACK_MODEL = "gpt-5"
728
728
 
729
+ # OpenAI's model catalog describes ``codex-auto-review`` as the hidden model
730
+ # used by the Guardian approval-review subagent, not as a public billable model
731
+ # with its own rate card. The canonical ccusage Codex adapter resolves that
732
+ # identifier to the model current when it appeared; its 2026-04-23-and-later
733
+ # mapping is gpt-5.5, which covers every retained auto-review event observed for
734
+ # issue #535. Keep this as a normalization map rather than a duplicate pricing
735
+ # row so pricing drift continues to have one source of truth per rate card.
736
+ CODEX_MODEL_ALIASES: dict[str, str] = {
737
+ "codex-auto-review": "gpt-5.5",
738
+ }
739
+
729
740
  # Per-model fast-tier price multipliers, ported from ryoppippi/ccusage
730
741
  # fast-multiplier-overrides.json ("exact" map — Codex/gpt entries only; the
731
742
  # upstream claude-opus-* entries are for ccusage's Claude adapter and never
@@ -742,7 +753,14 @@ CODEX_FAST_MULTIPLIER_FALLBACK = 2.0
742
753
 
743
754
  def _codex_fast_multiplier(model: str) -> float:
744
755
  """Fast-tier price multiplier for a Codex model (standard tier = 1.0)."""
745
- return CODEX_FAST_MULTIPLIER_OVERRIDES.get(model, CODEX_FAST_MULTIPLIER_FALLBACK)
756
+ return CODEX_FAST_MULTIPLIER_OVERRIDES.get(
757
+ _canonical_codex_model(model), CODEX_FAST_MULTIPLIER_FALLBACK,
758
+ )
759
+
760
+
761
+ def _canonical_codex_model(model: str) -> str:
762
+ """Return the priced model name for a known Codex runtime alias."""
763
+ return CODEX_MODEL_ALIASES.get(model, model)
746
764
 
747
765
 
748
766
  def _codex_config_requests_fast_service_tier(content: str) -> bool:
@@ -768,12 +786,13 @@ def _codex_config_requests_fast_service_tier(content: str) -> bool:
768
786
  def _resolve_codex_pricing(model: str) -> tuple[dict[str, Any] | None, bool]:
769
787
  """Return (pricing_dict, is_fallback).
770
788
 
771
- Returns (entry, False) when the model has a direct pricing entry. Returns
772
- (gpt-5-entry, True) when the model is unknown — matches upstream's
773
- LEGACY_FALLBACK_MODEL semantics. Returns (None, True) only if the fallback
774
- model itself is missing from the pricing dict (programming error; warn once).
789
+ Returns (entry, False) when the model has a direct pricing entry or a known
790
+ canonical alias. Returns (gpt-5-entry, True) when the model is unknown —
791
+ matches upstream's LEGACY_FALLBACK_MODEL semantics. Returns (None, True)
792
+ only if the fallback model itself is missing from the pricing dict
793
+ (programming error; warn once).
775
794
  """
776
- direct = CODEX_MODEL_PRICING.get(model)
795
+ direct = CODEX_MODEL_PRICING.get(_canonical_codex_model(model))
777
796
  if direct is not None:
778
797
  return direct, False
779
798
  fallback = CODEX_MODEL_PRICING.get(CODEX_LEGACY_FALLBACK_MODEL)
@@ -782,7 +801,7 @@ def _resolve_codex_pricing(model: str) -> tuple[dict[str, Any] | None, bool]:
782
801
 
783
802
  def _is_codex_fallback(model: str) -> bool:
784
803
  """True iff `model` would resolve via the LEGACY_FALLBACK_MODEL path."""
785
- return model not in CODEX_MODEL_PRICING
804
+ return _canonical_codex_model(model) not in CODEX_MODEL_PRICING
786
805
 
787
806
 
788
807
  def _resolve_model_pricing(model: str, warn: bool = True) -> dict[str, Any] | None: