fix(inventory): explain the locked Nous list while entitlement is pending

With the picker served from resident caches only, a cold Nous row renders
every model locked (free_tier_pending) until the background prewarm lands.
Surface why on the row's existing warning slot so the user isn't left with
an unexplained greyed-out list; never override an auth warning.
This commit is contained in:
kshitijk4poor
2026-09-03 03:53:34 +05:30
committed by kshitij
parent 401ac7e1f8
commit fb723084be
2 changed files with 15 additions and 0 deletions

View File

@@ -1017,6 +1017,14 @@ def _apply_pricing(
# paid models on its first picker open.
row["free_tier_pending"] = True
row["unavailable_models"] = list(models)
# Every model renders locked until the prewarm lands; say why
# on the existing per-provider warning surface instead of
# leaving the user staring at a greyed-out list.
if not row.get("warning"):
row["warning"] = (
"Checking Nous plan entitlement… models unlock on the "
"next picker open (or refresh)."
)
continue
if not raw_pricing:
if slug == "nous":

View File

@@ -170,6 +170,13 @@ def test_cold_nous_entitlement_keeps_models_unselectable(monkeypatch):
assert rows[0]["free_tier_pending"] is True
assert rows[0]["unavailable_models"] == ["free/model", "paid/model"]
# The whole list renders locked — the picker's per-provider warning
# surface must say why, without clobbering an existing auth warning.
assert "entitlement" in rows[0]["warning"]
rows = [{"slug": "nous", "models": ["m"], "warning": "paste NOUS_API_KEY to activate"}]
inv._apply_pricing(rows, cached_only=True)
assert rows[0]["warning"] == "paste NOUS_API_KEY to activate"
def test_prewarm_preserves_context_and_runs_once_per_profile(tmp_path, monkeypatch):