kpi
KPI-60
· child of KPI-58 Fleet-wide usage dashboard on kpi.pensanta.com: every agent, every host, both providers, ranked Done
KPI-58 web cutover: token-usage-web.sh /, /export.json, /export.md read Postgres usage_events (pg_rank_sql contract)
Done high
bvbin-venus-cc
Elazar ruling 2026-09-03: one store. Replace sqlite reads behind /, /export.json, /export.md with fleet-tokens.sh pg_rank_sql() as the contract SQL, grouped agent+provider, host shown, same route/auth/params (window=, days=, client=). Payload + page carry 'source=postgres since 2026-09-03' and a per-host/per-provider coverage line so an unfed host renders as unfed, not quiet. ETA 2h after bin_venus_cc gets USAGE+SELECT on agent_telemetry (blocker, nw-venus-cc).
Activity
-
parent=KPI-58
-
bin_venus_cc role lacks USAGE/SELECT on agent_telemetry - grant from nw-venus-cc
-
cleared: bin_venus_cc role lacks USAGE/SELECT on agent_telemetry - grant from nw-venus-cc
-
bin_venus_cc grant landed 07:23Z (nw-venus-cc, 3 statements confirmed); 2h ETA starts now
-
Unblocked by monitor-context-cc's ruling: option (b), single shape, no wired fallback. Deleting the three sqlite3.connect sites outright rather than keeping them as a fallback - a second answer path that only shows itself when the first fails is the co-existence Elazar's one-store ruling forbade, and the day it fires nobody knows which store they are reading.
-
08:10Z, monitor-context-cc ruling on bin-venus-cc's measured finding: usage_events depth is PER-PROVIDER - claude 2026-08-25 (9d, 822 rows, 34 agents, lezama+venus), codex 2026-06-06 (89d, 24276 rows, 9 agents). 14d/28d windows exceed the claude leg, so a cross-provider rank inside them INVERTS (claude looks ~3x cheaper). APPROVED: per-window per-provider coverage floor (oldest bucket + covered span); a provider whose floor falls inside the window is labelled TRUNCATED, shown separately, EXCLUDED from the cross-provider rank. Windows are never dropped. Coverage line spec amended: newest bucket alone reads healthy in exactly the wrong case - oldest bucket per provider is now mandated. Guard is PERMANENT structure, not a transition artifact: KPI-65 makes 28d honest but the guard still fires on a future 90d window, a retention trim, or a new provider leg (whey claude next).
-
Shipped b242893, live on venus since 08:12Z. The three sqlite3.connect sites are DELETED, not fallback-wired, per the ruling. Page and fleet-tokens.sh agree to the token on all five top rows in both columns at 24h - that is the KPI-64 acceptance comparison and the reason the contract SQL was reused instead of re-derived. Truncation guard fires on 28d (claude excluded at 9d against codex 89d) and is correctly silent on 7d and 24h. source=postgres since 2026-09-03 on the page, both export payloads and the help contract; coverage line carries oldest_bucket/newest_bucket/covered_days/ranked per provider. Eight routes 200, client= gate still 400, zero exceptions. TWO DEFECTS THE SMOKE TEST CAUGHT AND READING DID NOT: psycopg2 hands back sum(bigint) as decimal.Decimal which will not multiply with float, and I translated sqlite's inclusive hour bound to a strict > while keeping the n-1 arithmetic built around inclusivity, so 24h summed 23 buckets - visible only against the CLI, because the quiet agents matched exactly and only the actively-burning ones came out low.
task
6w ago by wi-cli-venus
6w ago
2026-09-03 08:16