Repository navigation
feat(pm-aggregator): quota analytics & projection section - #9363
Conversation
Rebuilds the flat "at risk" quota strip into an anchored Analytics & projection section (Drew 2026-11-13): per-pool key-value cards with current %, reset time + duration until reset, projected time-to-wall (least-squares over the pool's own dated percent readings in the snapshot store, period-matched by reset instant with a 2h tolerance for gatherer jitter), and the unlock picture (what frees at reset vs what stays walled on a longer window). Week-over-week duration- until-wall where both endpoints are real projections. Burn (calls, input/output/cache tokens, in:out ratio, cache share, recorded cost + tokens-per-dollar) comes from the route_attempt ledger in opencode.db, joined per pool by credential id (quota- current's credential ids) or provider id; time scales last hour / today / 7d (+ 7d-vs-prior-7d WoW), breakdowns by model, effort and provider leg with usage ratios, hour-of-day / day-of-week patterns and a 21-day daily table with US federal holidays labelled. Activity (sessions, sub-sessions, turns, tool calls, skill uses, mcpx calls, fleet subcommand uses inferred from shell transcripts and labelled inferred) comes from session_v2 / session_message on a stale-while-revalidate cache; the heavy tool-part scan never blocks a page load. New read API: /api/quota-analytics.json. Every number names its source in the UI; inferred series are labelled inferred; unmeasurable metrics are absent, not invented. 16 new oracle tests for the projection / WoW / ratio math.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 25 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
What
Rebuilds the /quota page's flat "at risk" strip into a proper Analytics & projection section (Drew's 2026-11-13 order), plus a read API at
/api/quota-analytics.json.Section layout (all anchored, deep-linkable)
#analytics-summary— at-risk strip: every pool window ≥80% used, walled or projected to wall before reset, each linking to its pool card, with unlock time (local) + duration and "after unlock: still walled" where that applies.#analytics-pools/#pool-<id>— per-pool key-value cards: per window — % used, window type, reset (absolute local + duration until), projected time-to-wall (absolute + duration) from the pool's own dated readings, walls-before-reset verdict, unlock picture; burn today + 7d (calls, in/out/cache tokens, in:out ratio, cache share, recorded cost, tok/$) with the attribution basis named (credential id / provider id).#analytics-breakdowns— all-route burn at last hour / today / 7d with week-over-week; model usage ratio table (call share + token share + ratios + recorded $), effort table, provider-leg table.#analytics-patterns— hour-of-day (7d), day-of-week (full history), 21-day daily bars with US federal holidays labelled.#analytics-activity— sessions, sub-sessions, turns, tool calls by name, skill uses, mcpx calls, fleet subcommand uses inferred from shell transcripts (labelled inferred in the UI).Data honesty rules
route_attempt.credential_idto quota-current's credential ids (verified live: 71.6% of attempts carry one; Antigravity attempts carry none, so its pools attribute by provider id and say so).Tests
src/quota-analytics.test.ts): projection states, period jitter tolerance, WoW math, ratio math, unlock picture, holiday table, duration formatting.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.