Skip to content

ADE Stats accuracy overhaul + activity module redesign (ADE-113, ADE-114)#783

Open
arul28 wants to merge 12 commits into
mainfrom
ade/ok-need-work-both-these-868a8a2c
Open

ADE Stats accuracy overhaul + activity module redesign (ADE-113, ADE-114)#783
arul28 wants to merge 12 commits into
mainfrom
ade/ok-need-work-both-these-868a8a2c

Conversation

@arul28

@arul28 arul28 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

ADE-113 — Stats data correctness

  • Critical: prod usage service was constructed without a db handle — every ADE-DB stat (sessions, lanes, commits, code movement, clients, streaks) rendered empty in shipping builds. Now wired.
  • Daily token charts carry a real input/output/cache split (was: totals dumped into inputTokens).
  • One day-key basis everywhere: machine-local calendar days (DST-safe component math), replacing the local-midnight-ranges vs UTC-keys mismatch.
  • Codeburn-parity dedup: cross-file Claude message.id dedup, streaming keep-last (first-occurrence timestamp), Codex fork/replay keys; recursive Claude subagents/** scanning; Codex scan caps removed; cached-input double-count and reasoning/output conflation fixed.
  • Scope toggle: This project / This machine — provider ledgers filter by cwd (Claude path encoding, Codex session_meta); unfilterable providers surface scopeSupported: false.
  • ADE-originated sessions included symmetrically (Codex exclusion removed) with a visible in-ADE vs external split.
  • GitHub vs local activity are separate labeled metric groups — no more Math.max merging of incomparable measures. PR scan paginates on UPDATED_AT so long-lived PRs merged in-range are counted, with a correct early-out.
  • Estimation flags per provider (cursor/copilot = chars-based, droid = distribution) surfaced in types and UI.
  • Verified against codeburn (apps/desktop/scripts/usage-oracle.mjs): Claude token totals match exactly on closed ranges; Codex delta fully attributed to ADE-originated inclusion (external-only < 0.5%).

ADE-114 — Activity module redesign

  • New tabbed ActivityModule (Activity · Tokens · Code · Clients) replaces the arrow carousel on the new-chat surface and Settings > Stats; compact and full variants; flat card, no glow/shadow; hover/tap day tooltips; unified range vocabulary (Today/7d/30d/Year/All); event-driven refresh via usage.onUpdate (retry cap removed); skeleton loading; warm empty state; per-tab all-zero hints; streak/milestone chip; provider brand color tokens; heatmap scales to the chart area.
  • Settings > Stats rebuilt as a sectioned dashboard (Overview / Activity / AI usage / Code & PRs) with scope toggle and a quiet freshness/estimation footer.
  • New-chat hero raised, logo glow removed (clipped on small screens).
  • iOS parity port: WorkUsageActivityCarousel rebuilt as the same tabbed card; RemoteModels decodes all new optional fields (legacy hosts still decode); host sync command forwards scope.

Tests

154 usage-domain tests (14 named pipeline regressions, hand-computed 5-provider e2e fixture with DST/dedup/fork cases, 28 component tests), iOS decode tests, CI shard green, proof screenshots in the lane's proof drawer.

Closes #768. Closes #771.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Redesigned usage activity views with tabs for activity, tokens, code, and clients.
    • Added machine and project usage scopes, provider details, and ADE-versus-external token breakdowns.
    • Added selectable time ranges, interactive charts, milestone and streak indicators, and GitHub/local activity separation.
    • Added mobile support for the expanded usage statistics.
  • Bug Fixes

    • Improved usage accuracy across providers, date ranges, daylight-saving changes, and duplicated sessions.
    • Added validation for usage filters and date inputs.

Greptile Summary

This PR updates ADE usage stats accuracy and redesigns the desktop and iOS activity views. The main changes are:

  • Validation and forwarding for custom usage ranges through renderer IPC and sync commands.
  • Local-day range handling across provider ledgers, ADE database stats, and GitHub activity.
  • ADE-originated versus external token attribution with exact-range support.
  • More exact ADE database active-day, client, and streak aggregation for large event sets.
  • Unified desktop and iOS activity scoring for tokens, sessions, client interactions, local code activity, and GitHub activity.

Confidence Score: 4/5

Mostly safe to merge after fixing the stats summary issue.

The changed paths are focused and covered by tests, with one contained correctness issue in ADE database active-day and streak aggregation.

apps/desktop/src/main/services/usage/usageStatsStore.ts

T-Rex T-Rex Logs

What T-Rex did

  • Inspected the accepted anchor and confirmed the aggregation path for session_deltas and activeDateRows to clarify how summary.filesChanged and daily filesChanged are computed.
  • The attempt to run a runnable reproduction harness was blocked by the step budget, so no runnable proof artifact could be produced.
  • Collected and reviewed logs from the Vite server and Playwright probes, which show the server starting and then being killed, along with failed module requests (React, Phosphor, Zustand) returning ERR_EMPTY_RESPONSE or ERR_CONNECTION_REFUSED.
  • Validated that the validation log captures the failed wait for the [data-activity-module], explaining why the probe could not proceed.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
apps/ade-cli/src/services/sync/syncRemoteCommandService.ts Validates usage presets/scopes and forwards custom since/until timestamps to the usage tracking service.
apps/desktop/src/main/services/ipc/registerIpc.ts Adds renderer IPC validation for usage range presets and timestamps before forwarding stats requests.
apps/desktop/src/main/services/usage/usageStatsStore.ts Makes active-day and client-day summaries independent of capped chart scans, but misses file-only deltas in streak activity.
apps/desktop/src/main/services/usage/usageTrackingService.ts Tracks ADE-originated daily tokens and widens custom usage ranges to full local days for consistent provider/database/GitHub aggregation.
apps/desktop/src/renderer/components/usage/ActivityModule.tsx Unifies daily activity scoring for heatmap intensity and empty-state detection, including local and GitHub code dimensions.
apps/ios/ADE/Views/Work/WorkUsageActivityCarousel.swift Ports the unified activity scoring and GitHub code tooltip details into the iOS usage activity view.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Renderer as Desktop Renderer / iOS Client
participant IPC as IPC / Sync Command
participant Usage as UsageTrackingService
participant Providers as Provider Ledgers
participant DB as ADE Database Stats
participant GH as GitHub Scanner

Renderer->>IPC: usage.getAdeStats(preset, scope, since, until)
IPC->>IPC: validate preset/scope/timestamps
IPC->>Usage: getAdeUsageStats(args)
Usage->>Usage: resolve + widen to local-day range
Usage->>Providers: aggregate provider daily token buckets
Providers-->>Usage: totals + ADE/external split
Usage->>DB: collectAdeDatabaseUsageStats(range)
DB-->>Usage: sessions, deltas, clients, streaks, daily points
Usage->>GH: scan/cache GitHub activity(range)
GH-->>Usage: separate GitHub commits/PRs/code
Usage-->>Renderer: AdeUsageStats with daily activity dimensions
Loading
%%{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 Renderer as Desktop Renderer / iOS Client
participant IPC as IPC / Sync Command
participant Usage as UsageTrackingService
participant Providers as Provider Ledgers
participant DB as ADE Database Stats
participant GH as GitHub Scanner

Renderer->>IPC: usage.getAdeStats(preset, scope, since, until)
IPC->>IPC: validate preset/scope/timestamps
IPC->>Usage: getAdeUsageStats(args)
Usage->>Usage: resolve + widen to local-day range
Usage->>Providers: aggregate provider daily token buckets
Providers-->>Usage: totals + ADE/external split
Usage->>DB: collectAdeDatabaseUsageStats(range)
DB-->>Usage: sessions, deltas, clients, streaks, daily points
Usage->>GH: scan/cache GitHub activity(range)
GH-->>Usage: separate GitHub commits/PRs/code
Usage-->>Renderer: AdeUsageStats with daily activity dimensions
Loading

Comments Outside Diff (1)

  1. apps/desktop/src/main/services/usage/usageTrackingService.ts, line 1304 (link)

    P1 Honor exact timestamps
    tokenBreakdownForExactRange includes an entire local day whenever it intersects the requested since/until window. When a caller asks for 2026-07-01T12:00Z through 2026-07-02T12:00Z, provider tokens from all of both boundary days are included, while ADE DB and GitHub use exact timestamp comparisons. Custom ranges can return inflated provider usage for the first and last day.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/desktop/src/main/services/usage/usageTrackingService.ts
    Line: 1304
    
    Comment:
    **Honor exact timestamps**
    `tokenBreakdownForExactRange` includes an entire local day whenever it intersects the requested `since`/`until` window. When a caller asks for `2026-07-01T12:00Z` through `2026-07-02T12:00Z`, provider tokens from all of both boundary days are included, while ADE DB and GitHub use exact timestamp comparisons. Custom ranges can return inflated provider usage for the first and last day.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Fix in Claude Code

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/desktop/src/main/services/usage/usageStatsStore.ts:463
**Count file-only deltas**
`activeDateRows` excludes `session_deltas` rows where `files_changed > 0` but insertions and deletions are both zero. Those rows still contribute to `summary.filesChanged` and daily heatmap activity below, so rename/mode-only changes disappear from `activeDays` and streaks even though the same range reports code activity.

Reviews (6): Last reviewed commit: "Unify day-activity scoring across every ..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Jul 10, 2026 9:34pm

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Usage analytics pipeline

Layer / File(s) Summary
Contracts, validation, and client decoding
apps/desktop/src/shared/types/usage.ts, apps/desktop/src/main/services/ipc/registerIpc.ts, apps/ade-cli/src/services/sync/*, apps/ios/ADE/Models/RemoteModels.swift
Adds scoped usage types, validates scope and date arguments, wires database-backed stats, normalizes preload requests, and decodes optional iOS fields.
Ledger aggregation and local-day handling
apps/desktop/src/main/services/usage/ledgers/*, apps/desktop/src/main/services/usage/localDay.ts, apps/desktop/src/main/services/usage/usageStatsStore.ts, apps/desktop/src/main/services/usage/usageTrackingService.ts
Adds project and ADE attribution, estimation metadata, fork-aware Codex deduplication, local-day bucketing, bounded database scans, project snapshots, and separated GitHub/local activity.
Validation and accuracy tooling
apps/desktop/src/main/services/usage/*.test.ts, apps/desktop/scripts/usage-oracle.mjs, apps/ade-cli/src/services/sync/*.test.ts
Adds end-to-end provider fixtures, scope and refresh tests, DST coverage, GitHub pagination tests, and ADE-versus-Codeburn comparison output.
Desktop usage interface
apps/desktop/src/renderer/components/usage/*, apps/desktop/src/renderer/components/settings/AdeUsageSection.tsx, apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
Replaces the activity carousel with tabbed charts, persisted scopes and ranges, tooltips, estimation labels, provider colors, refresh subscriptions, and updated empty-state layout.
iOS usage interface
apps/ios/ADE/Views/Work/*, apps/ios/ADETests/ADETests.swift
Adds tabbed ranges, stacked token and code charts, GitHub overlays, tooltips, milestones, empty states, and decoding tests for enriched usage payloads.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • arul28/ADE#247: Overlaps with the desktop AgentChatPane integration area.
  • arul28/ADE#447: Extends the same usage stats, IPC, and shared type pipeline.

Suggested labels: desktop, ios

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.96% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: ADE stats accuracy improvements and the activity module redesign.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/ok-need-work-both-these-868a8a2c

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@arul28 arul28 changed the title accurate-stats-ui-ux -> Primary ADE Stats accuracy overhaul + activity module redesign (ADE-113, ADE-114) Jul 10, 2026
@arul28

arul28 commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

@copilot review but do not make fixes

@linear-code

linear-code Bot commented Jul 10, 2026

Copy link
Copy Markdown

ADE-113

ADE-114

Comment thread apps/ade-cli/src/services/sync/syncRemoteCommandService.ts
arul28 and others added 7 commits July 10, 2026 15:59
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>
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>
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>
Greptile P1: the host handler rebuilt getAdeUsageStats args with only
preset+scope, silently ignoring exact date ranges from synced clients.
Now validated and forwarded, with regression tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@arul28 arul28 force-pushed the ade/ok-need-work-both-these-868a8a2c branch from 4111cb2 to 3c6e7c6 Compare July 10, 2026 20:02
@arul28

arul28 commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

@codex review

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

Copy link
Copy Markdown

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: 3c6e7c6d3c

ℹ️ 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".

Comment thread apps/desktop/src/main/services/usage/usageTrackingService.ts Outdated
The end-to-end fixture asserted DST deltas that only held in a DST-crossing
timezone — assertions now derive expectations from the runtime's actual
offsets and pass under UTC and Pacific/Auckland alike. Exact since/until
requests now compute the in-ADE vs external split from a per-day
ADE-originated series over the same range as the totals (omitted when the
daily series is unavailable) instead of borrowing the whole preset window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@arul28

arul28 commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

@codex review

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

if (!dateIntersectsRange(date, range)) continue;

P2 Badge Honor exact since/until boundaries

When callers pass a custom since/until window that starts or ends mid-day, this includes every token entry for any local day that intersects the range. For example, 2026-07-01T12:00Z through 2026-07-02T12:00Z counts all provider tokens from both boundary days, while ADE DB and GitHub stats use exact timestamp comparisons, so custom range totals and daily charts can be inflated at the edges.

ℹ️ 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".

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
apps/desktop/src/main/services/usage/usageTrackingService.ts (1)

1656-1708: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Bound PR pagination for the all preset. range.since is null here, so this loop keeps fetching every PR page until history is exhausted. On large repos, a cache miss can still trigger many serial gh api graphql round-trips. Consider a page cap or another explicit bound for the unbounded preset.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/main/services/usage/usageTrackingService.ts` around lines
1656 - 1708, Bound pagination in scanGithubPullRequestPages for ranges without
range.since, such as the all preset. Add an explicit maximum page count or
equivalent limit to stop repeated gh GraphQL requests after a reasonable bound,
while preserving existing date-based termination and cursor handling.
apps/desktop/src/renderer/components/usage/ActivityModule.tsx (1)

697-713: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Move the milestone write out of useMemo.

useFooterChip performs a side effect (recordShownMilestonelocalStorage.setItem) during render. Under React 18 StrictMode double-invocation (and concurrent renders that get discarded), the milestone can be recorded on a throwaway render — a subsequent recompute then reads it back as already-shown, so fresh flips to false and the celebration animation in FooterChip never fires. Compute the chip purely and record the shown milestone in a useEffect keyed on the crossed threshold.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/usage/ActivityModule.tsx` around lines
697 - 713, Move the recordShownMilestone side effect out of useFooterChip’s
useMemo: compute the crossed milestone and fresh state purely during render,
then use a useEffect keyed by the crossed milestone threshold to record it after
commit, while preserving the existing trophy/streak chip behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/desktop/src/main/services/ipc/registerIpc.ts`:
- Around line 4877-4884: Extend validation in the usageGetAdeStats IPC handler
to mirror the remote command path: validate preset with isAdeUsageRangePreset,
and reject since or until when Date.parse returns NaN. Keep the existing object
and scope checks, and throw clear errors before calling getAdeUsageStats.

In `@apps/desktop/src/renderer/components/usage/ActivityModule.tsx`:
- Around line 129-131: Update dayValue() to include githubCommits, githubPrs,
githubAdditions, and githubDeletions in its score, using the same activity
signal as dayHasActivity(), while preserving the existing tokens, sessions, and
interactions weighting.

In `@apps/ios/ADE/Views/Work/WorkUsageActivityCarousel.swift`:
- Around line 82-93: Extend WorkUsageBucketDetail with githubAdditions and
githubDeletions plus a githubCode computed property, populate both fields from
bucket in the heatmap and bars detail(_:) builders, and update WorkUsageTooltip
to show a “+X / -Y GitHub” line when detail.githubCode > 0.
- Around line 175-184: Update the hasActivity computed property to detect daily
token usage by summing each point’s inputTokens, outputTokens, and cachedTokens,
matching WorkUsageVisualBucket.tokens, instead of relying on point.totalTokens;
retain the existing checks for sessions, code changes, GitHub activity, and
interactions.

---

Nitpick comments:
In `@apps/desktop/src/main/services/usage/usageTrackingService.ts`:
- Around line 1656-1708: Bound pagination in scanGithubPullRequestPages for
ranges without range.since, such as the all preset. Add an explicit maximum page
count or equivalent limit to stop repeated gh GraphQL requests after a
reasonable bound, while preserving existing date-based termination and cursor
handling.

In `@apps/desktop/src/renderer/components/usage/ActivityModule.tsx`:
- Around line 697-713: Move the recordShownMilestone side effect out of
useFooterChip’s useMemo: compute the crossed milestone and fresh state purely
during render, then use a useEffect keyed by the crossed milestone threshold to
record it after commit, while preserving the existing trophy/streak chip
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a78149f3-5a79-40ee-9ec8-6e268b7d7e0f

📥 Commits

Reviewing files that changed from the base of the PR and between c0e2ef0 and e971675.

⛔ Files ignored due to path filters (4)
  • docs/features/chat/README.md is excluded by !docs/**
  • docs/features/chat/composer-and-ui.md is excluded by !docs/**
  • docs/features/onboarding-and-settings/README.md is excluded by !docs/**
  • docs/features/web-client/README.md is excluded by !docs/**
📒 Files selected for processing (23)
  • apps/ade-cli/src/services/sync/syncRemoteCommandService.test.ts
  • apps/ade-cli/src/services/sync/syncRemoteCommandService.ts
  • apps/desktop/scripts/usage-oracle.mjs
  • apps/desktop/src/main/main.ts
  • apps/desktop/src/main/services/ipc/registerIpc.ts
  • apps/desktop/src/main/services/usage/ledgers/localUsageLedgers.ts
  • apps/desktop/src/main/services/usage/localDay.ts
  • apps/desktop/src/main/services/usage/usageEndToEnd.test.ts
  • apps/desktop/src/main/services/usage/usageStatsStore.ts
  • apps/desktop/src/main/services/usage/usageTrackingService.test.ts
  • apps/desktop/src/main/services/usage/usageTrackingService.ts
  • apps/desktop/src/preload/preload.ts
  • apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
  • apps/desktop/src/renderer/components/settings/AdeUsageSection.tsx
  • apps/desktop/src/renderer/components/usage/ActivityModule.tsx
  • apps/desktop/src/renderer/components/usage/UsageActivityCarousel.tsx
  • apps/desktop/src/renderer/components/usage/providerColors.ts
  • apps/desktop/src/renderer/components/usage/usage.test.tsx
  • apps/desktop/src/shared/types/usage.ts
  • apps/ios/ADE/Models/RemoteModels.swift
  • apps/ios/ADE/Views/Work/WorkNewChatScreen.swift
  • apps/ios/ADE/Views/Work/WorkUsageActivityCarousel.swift
  • apps/ios/ADETests/ADETests.swift
💤 Files with no reviewable changes (1)
  • apps/desktop/src/renderer/components/usage/UsageActivityCarousel.tsx

Comment thread apps/desktop/src/main/services/ipc/registerIpc.ts
Comment thread apps/desktop/src/renderer/components/usage/ActivityModule.tsx Outdated
Comment thread apps/ios/ADE/Views/Work/WorkUsageActivityCarousel.swift
Comment thread apps/ios/ADE/Views/Work/WorkUsageActivityCarousel.swift
…ltip gaps

Custom since/until ranges now widen to whole machine-local days for all
sources (provider snapshots are day-granular; DB/GitHub use the same aligned
instants) and the contract documents it. Renderer IPC validates preset/
since/until like the sync path. Heatmap intensity counts GitHub-only
activity on desktop and iOS; iOS tooltip carries GitHub +/− and hasActivity
derives per-day tokens from the fields hosts actually send.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@arul28

arul28 commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

Codex P2 (exact since/until mid-day boundaries) addressed in db50b32: custom ranges are now day-granular by contract — since/until widen to whole machine-local days for provider, DB, and GitHub sources alike, so edges are consistent instead of mixed-granularity. Documented on GetAdeUsageStatsArgs. @codex review

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

Copy link
Copy Markdown

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: db50b32161

ℹ️ 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".

Comment thread apps/desktop/src/main/services/usage/usageStatsStore.ts Outdated
arul28 and others added 2 commits July 10, 2026 17:29
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>
Per-client activeDays, global active days, streaks, and lastActiveAt now
come from bounded distinct-local-day SQL aggregates; the capped newest-row
slice only feeds daily chart points. Regression: 250,001 events across
three days keeps day counts exact while charts use the capped slice.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@arul28

arul28 commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

@codex review

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

Copy link
Copy Markdown

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: 4dd7b144ef

ℹ️ 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".

Comment thread apps/desktop/src/renderer/components/usage/ActivityModule.tsx
Comment thread apps/ios/ADE/Views/Work/WorkUsageActivityCarousel.swift Outdated
One helper per platform now drives both the warm-empty predicate and the
heatmap intensity over the complete daily-point field set (tokens, sessions,
interactions, local commits/prs/filesChanged/insertions/deletions, GitHub
commits/prs/additions/deletions), so local-git-only and GitHub-commit-only
days render and score consistently. iOS decodes per-day commits/prs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/arul28s-projects?upgradeToPro=build-rate-limit

@arul28

arul28 commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

select date(d.started_at, 'localtime') active_date
from session_deltas d
where ${deltaRange.sql}
and (coalesce(d.insertions, 0) > 0 or coalesce(d.deletions, 0) > 0)

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 Count file-only deltas
activeDateRows excludes session_deltas rows where files_changed > 0 but insertions and deletions are both zero. Those rows still contribute to summary.filesChanged and daily heatmap activity below, so rename/mode-only changes disappear from activeDays and streaks even though the same range reports code activity.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/main/services/usage/usageStatsStore.ts
Line: 463

Comment:
**Count file-only deltas**
`activeDateRows` excludes `session_deltas` rows where `files_changed > 0` but insertions and deletions are both zero. Those rows still contribute to `summary.filesChanged` and daily heatmap activity below, so rename/mode-only changes disappear from `activeDays` and streaks even though the same range reports code activity.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

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.

Redesign the new-chat ADE activity module Audit and correct ADE Stats data sources, ranges, and aggregation

1 participant