-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Feature request: calendar month-to-date option for the cost reporting period #2087
Copy link
Copy link
Open
Labels
P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.
Description
Activity
Metadata
Metadata
Assignees
Labels
P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.
Problem
Cost reporting (menus, inline dashboards, cost submenus/charts, widgets, and
codexbar cost) is always a rollinglast-N-days window. Many of us budget against calendar months — provider billing cycles, employer expense periods,
and personal budgets all reset on the 1st — so "spend in the last 30 days" and "spend this month" can differ
substantially mid-month. There's currently no way to see month-to-date cost without exporting and computing it
externally.
Related precedent: #689 established calendar-month pacing for Copilot premium usage. This proposal generalizes the
same idea to the shared cost reporting period.
Proposed behavior
Add a user-selectable cost reporting period with two modes:
startup clock)
The saved selection applies consistently everywhere a cost period is shown or computed: shared cost menus, inline
dashboards, cost submenus and charts, widgets, CLI default output, project breakdowns, labels, and totals.
CLI precedence: an explicit
codexbar cost --days Nalways selects a rolling N-day window and overrides the savedmonth-to-date setting, so scripts keep deterministic behavior.
Design considerations (from a working prototype implementation)
I have this implemented and validated in a prototype. The sharp edges this surfaced:
/costserve-cache keys need the resolved period(e.g.
calendar-month:2026-07) so a mode switch never relabels data fetched for a different window, and failedrefreshes must not strand the new period with a stale snapshot from the old one.
derive from entries in the same resolved window. Providers that return pre-aggregated values (e.g. Mistral) need
to recompute aggregates from daily buckets when a sub-window is selected.
last30Days...JSON field names can remain as compatibility aliases whilenew period-neutral names are introduced, so downstream consumers (Waybar/GNOME/KDE integrations, showy-quota)
don't break.
app and widget-extension locale catalogs across all 23 locales.
I suggest focused test coverage for the period resolver, CLI precedence, serve-cache identity, and widget
snapshot/localization behavior.