Skip to content

feat(dashboard): show weekly token pace#534

Open
Komzpa wants to merge 3 commits intoSoju06:mainfrom
Komzpa:codex/weekly-token-pace
Open

feat(dashboard): show weekly token pace#534
Komzpa wants to merge 3 commits intoSoju06:mainfrom
Komzpa:codex/weekly-token-pace

Conversation

@Komzpa
Copy link
Copy Markdown
Contributor

@Komzpa Komzpa commented May 2, 2026

Summary

  • add a dashboard Weekly pace card that compares actual weekly token consumption against schedule
  • compute pace by summing token/credit budgets per account, using each account's own reset time and window
  • model weekly reset replenishment as the full account budget, not only current unused credits
  • hide Recovery options when the pool is on pace and no throttle/account action is needed
  • preserve weekly capacity/remaining fields in the frontend schema and document the behavior in OpenSpec

Why

A nearly empty account near its weekly reset should not look scary, and a healthy pool should not tell the operator to do recovery work. The card compares actual remaining tokens to expected remaining tokens per account, then derives display percentages from aggregate token totals instead of averaging account percentages.

Live data sanity check

Checked the real codex-lb usage history around the "tokens were insufficient, then an account was added, then tokens were sufficient" case:

  • 2026-05-03 18:13 UTC: 6-account pool was danger, about 91.5% used vs 76.4% scheduled, short by about 18.8K credits.
  • 2026-05-03 18:16 UTC: after adding the unused Pro account, actual 7-account pool became on track, about 64.1% used vs 53.6% scheduled, projected low-water about 31.7K credits.
  • Counterfactual without the new Pro account at 2026-05-03 18:16 UTC stayed danger, short by about 18.7K credits.

That matches the intended continuity context: adding a real account turns the pool from insufficient to sufficient, and the card should stop showing Recovery options once the pool is safe.

Validation

  • cd frontend && bun run test -- ./src/features/dashboard/utils.test.ts ./src/features/dashboard/components/weekly-credits-pace-card.test.tsx
  • cd frontend && bun run typecheck
  • cd frontend && bun run lint (passes with two pre-existing warnings in account-multi-select.tsx)
  • cd frontend && bun run build (passes with existing Vite chunk-size/dynamic-import warnings)
  • git diff --check
  • earlier branch validation also covered .venv/bin/python -m pytest tests/integration/test_dashboard_overview.py::test_dashboard_overview_combines_data

openspec CLI is not installed in this workspace, so I could not run local OpenSpec validation.

@Komzpa Komzpa force-pushed the codex/weekly-token-pace branch 7 times, most recently from b9a9ce2 to d5b3f5e Compare May 3, 2026 14:31
@Komzpa Komzpa force-pushed the codex/weekly-token-pace branch 4 times, most recently from 39843cc to d377b18 Compare May 3, 2026 19:45
@Komzpa Komzpa force-pushed the codex/weekly-token-pace branch from d377b18 to 5df0354 Compare May 3, 2026 19:51
@Komzpa Komzpa marked this pull request as ready for review May 4, 2026 14:55
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5df035489a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.filter((account) => account.resetAtMs > nowMs)
.map((account) => ({
resetAtMs: account.resetAtMs,
topUpCredits: Math.max(0, account.fullCredits - account.remainingCredits),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Model first reset as full replenishment

In buildWeeklyPoolProjection, the first reset event initializes topUpCredits as fullCredits - remainingCredits, which is the amount already consumed, not the amount needed at reset time to restore the account to full. This underestimates post-reset capacity and can falsely project shortfall/depletion (and therefore trigger "danger" status plus pause/throttle recommendations) for accounts whose real burn is sustainable across weekly resets; for example, an account mid-cycle with moderate usage can be marked as depleting even though each reset would keep it above zero.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant