ADE-117: Make usage refresh reliable and lifetime totals accurate#782
Conversation
ADE-113: wire db into prod usage service, per-day input/output/cache split, local-timezone day keys (DST-safe), codeburn-parity dedup (cross-file message ids, streaming keep-last, codex fork replay), ADE-originated attribution with symmetric inclusion, machine/project scope toggle, labeled github-vs-local activity groups (no Math.max merges), estimation flags, GitHub PR scan early-out. 14 new named regression tests. ADE-114: tabbed ActivityModule (compact/full) replaces the carousel on the new-chat surface and Settings > Stats; sectioned Stats dashboard with scope toggle, unified range vocabulary, quiet meta footer; provider brand color tokens; streak/milestone chip; warm empty state; event-driven refresh; hero moved up with logo glow removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Tabbed card parity with desktop (named tabs, unified range vocab incl. All, input/output/cache token split, GitHub underlay on code bars, tap tooltips, warm empty state, streak/milestone chip, skeleton loading, flat card without glow). Hero scooted up and logo glow removed to match. RemoteModels decodes the new optional daily fields. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Five-provider hand-computed fixture (resume/stream dedup, fork replay, project scope, ADE attribution, estimation flags, local midnight, DST). Oracle script (scripts/usage-oracle.mjs) diffs ADE token totals against codeburn JSON on real ledgers: claude exact-match on closed ranges; codex delta fully attributed to ADE-originated inclusion (external-only <0.5%). Accuracy fixes from oracle findings: recursive claude subagents/** scan, removed codex 14d/250-file/32MiB caps, cached-input double count, reasoning tokens separated from displayed output. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Warning Review limit reached
Next review available in: 28 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (10)
📒 Files selected for processing (48)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@copilot review but do not make fixes |
Correctness (three-perspective review): PR pagination now orders/stops on UPDATED_AT so long-lived PRs merged in-range are counted; GitHub-only background refresh emits usage.onUpdate so Stats stops showing stale zeros; empty-state predicate counts GitHub-only days; daily bucket scans capped at 250k newest rows with debug log. Judo: explicit scope branches in buildCostSnapshots, shared RANGE_OPTIONS, dead export + doc fix in providerColors, toDate helper in localDay. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Host-side sync command usage.getAdeStats now validates and forwards the new scope arg (was silently dropped; regression test added). Internal docs updated for the sectioned Stats dashboard, ActivityModule, localDay helpers, provider colors, and the scope/estimation/github-vs-local contracts. TUI and mobile verified in lockstep with no changes required. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
3157b8b to
64a5a8e
Compare
|
@copilot review but do not make fixes |
Heatmap cells now scale to the box: one tall row for <=7 points, 7-row calendar grid for longer ranges. Active tab with an all-zero series shows a muted hint while keeping the legend, instead of a bare chart. iOS hasActivity made github-aware to match desktop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5c968e011
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02b15d04d2
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3df0c90997
ℹ️ 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".
Union merge: keeps ADE-117's quota snapshot/refresh commands, refresh reliability, and lifetime-total accuracy alongside this lane's newer ADE-113/114 pipeline and UI work (day-granular custom ranges, IPC validation, exact-range ADE attribution, heatmap fill, iOS tabbed module). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Measured baseline
Fresh machine-local all-time scan on 2026-07-10:
Native token sources remain exact where available; providers without native token totals remain explicitly labeled as estimates.
Verification
Fixes ADE-117
Open in ADE
Greptile Summary
This PR makes usage refresh and historical activity reporting more reliable across ADE surfaces. The main changes are:
Confidence Score: 4/5
Mostly safe to merge after fixing the scoped mobile usage request.
The desktop and CLI refresh split is well covered, but the iOS stats request drops the new
scopeparameter and can show machine-wide provider totals in project views.apps/ios/ADE/Services/SyncService.swiftWhat T-Rex did
Important Files Changed
--history.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant UI as Desktop/iOS/TUI usage UI participant Remote as Sync remote command participant Usage as UsageTrackingService participant Quota as Claude/Codex quota APIs participant Ledgers as Local provider ledgers participant GitHub as GitHub activity scan UI->>Remote: usage.getQuotaSnapshot / usage.refreshQuota Remote->>Usage: getUsageSnapshot() / forceRefresh() Usage->>Quota: poll live quota windows Quota-->>Usage: windows + provider status Usage-->>UI: UsageSnapshot UI->>Remote: usage.getAdeStats(preset, scope) Remote->>Usage: "getAdeUsageStats({preset, scope})" Usage-->>UI: cached stats Usage->>Ledgers: refreshHistory() when provider costs are stale Usage->>GitHub: scan range when GitHub cache is stale Ledgers-->>Usage: provider/model breakdowns GitHub-->>Usage: refreshed usage update%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant UI as Desktop/iOS/TUI usage UI participant Remote as Sync remote command participant Usage as UsageTrackingService participant Quota as Claude/Codex quota APIs participant Ledgers as Local provider ledgers participant GitHub as GitHub activity scan UI->>Remote: usage.getQuotaSnapshot / usage.refreshQuota Remote->>Usage: getUsageSnapshot() / forceRefresh() Usage->>Quota: poll live quota windows Quota-->>Usage: windows + provider status Usage-->>UI: UsageSnapshot UI->>Remote: usage.getAdeStats(preset, scope) Remote->>Usage: "getAdeUsageStats({preset, scope})" Usage-->>UI: cached stats Usage->>Ledgers: refreshHistory() when provider costs are stale Usage->>GitHub: scan range when GitHub cache is stale Ledgers-->>Usage: provider/model breakdowns GitHub-->>Usage: refreshed usage updateComments Outside Diff (1)
apps/ios/ADE/Services/SyncService.swift, line 10554-10560 (link)usage.getAdeStatsnow acceptsscope, but this request sends onlypreset, so the host falls back to the machine-wide default. In a project-scoped Work view, iOS receives provider-ledger tokens from every local project and shows incorrect lifetime/range totals for the selected workspace.Artifacts
Repro: generated harness extracting the iOS request and exercising missing-scope host default behavior
Repro: harness output showing usage.getAdeStats args omit scope and normalize to machine scope
Repro: native iOS tool availability check showing swift and xcodebuild are unavailable
Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (4): Last reviewed commit: "fix(usage): preserve polling and RPC fal..." | Re-trigger Greptile