You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Orca sends fewer background analytics messages. Two kinds of messages that used to go out very often are now combined into a small daily summary or sent only occasionally. Nothing new is collected, and nothing changes in the app.
Files
Added
Deleted
Net
Test
1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$104
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$104
Prod
18
$\color{#1a7f37}{\Huge{\mathbf{+}}}$328
$\color{#cf222e}{\Huge{\mathbf{−}}}$271
$\color{#1a7f37}{\Huge{\mathbf{+}}}$57
What Changed
The events go out for the first send of each day on each device, then for about 1 in 10, tagged with its sampling rate, and as one total per provider per day.
Linked Issue
N/A (maintainer change)
Visual Proof
N/A: no UI change.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
agent-token-usage-reporter.test.ts covers the saved-state rules: a finished day is sent under the day it was used, earlier history is never sent, only later growth is sent after a restart, and the start day after upgrading from an older build. Ran locally on macOS; CI covers Linux and Windows.
Performance
None, because chat sends add one in-memory comparison in the existing track() path, and the token reporter sums the scan's existing daily rows once per scan (the same order of work as before) while sending far fewer events.
Risk
Riskiest part: the token reporter's saved state. If it went wrong, daily token totals would stop arriving; nothing in the app changes. An unreadable state file is logged and reporting restarts from that day; a newer build's state file is left untouched.
Reading the data: totals for the chat event now need to be weighted by sample_rate; per-install and per-day views are unaffected. Daily token rows for the same install, provider and day add up. Combined with the older per-session event, use that event for an install only before its first daily row. Known limits: a time-zone change followed by a full usage rescan can count tokens near midnight once more, and days spent on an older build that is never upgraded again aren't covered.
Backing out is a plain revert: the older build still reads its own untouched file.
Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Agent token usage is now aggregated by UTC day and sent through a daily telemetry event. The reporter tracks reported daily totals and sends positive growth for completed days. Provider stores select daily aggregates, and the analytics session ID store is removed. Native chat message sampling uses per-client UTC-day cursors persisted in telemetry settings. The tracking path passes event details and a shared timestamp to sampling.
Merge Risk: Low · up to ea649
This change moves token telemetry to daily totals. Dashboards could show slightly inconsistent per-day figures: the date contract is unclear, usage from the first partial day is included, and a rare state-write failure plus restart can double-count a day. These are telemetry accuracy issues, not user-facing failures. Reconcile the usage_day definition before or soon after merge.
Pre-merge checks: 4
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Title check
The title "Reduce background analytics volume" matches the main change. The PR reduces telemetry volume by sampling per-day chat-send events and replacing per-session token-usage snapshots with daily …
Description check
The description is mostly complete. It gives a clear ELI5, a What Changed section, a Testing section with checkboxes and test coverage details, a Performance line, a Risk section with level, rollback,…
Full details: Title check
Explanation
The title "Reduce background analytics volume" matches the main change. The PR reduces telemetry volume by sampling per-day chat-send events and replacing per-session token-usage snapshots with daily totals. The title is short and specific enough for a teammate to understand the primary change, though it does not name the two mechanisms.
Full details: Description check
Explanation
The description is mostly complete. It gives a clear ELI5, a What Changed section, a Testing section with checkboxes and test coverage details, a Performance line, a Risk section with level, rollback, and data-reading notes, and the Agent skill boundary and checklist are filled in. The Linked Issue section says N/A (maintainer change), which the template permits for maintainers. The Visual Proof section says N/A with a reason. The 'What Changed' section is thin: it gives one sentence about sampling and daily totals but does not describe the before/after behavior or the mechanism (for example the UTC-day cursor persisted in telemetry settings, or the move from per-session snapshots to daily totals with schema version 2). The Why section is missing entirely; the template asks why this approach beats alternatives. The AI Disclosure section is blank, and the pnpm lint/typecheck/test/build checklist item is unchecked without a note saying CI will cover it. These gaps are non-critical, so the description is mostly complete.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
84-84: Minor · Functional Correctness · Poor tradeoff
Growth is attributed to the scan day, not the day it occurred.
The reporter receives only cumulative session counts, so it cannot use source usage dates. Growth accrued after one scan is added to the day of the next scan. A day's total therefore omits usage accrued after its last scan and includes that usage on the next day. Totals across days stay correct.
Either pass per-day usage to the reporter through the selectSessions contract, or document that usage_day records the scan day. Keep first-scan history suppression in either case.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 8601e0fb-ff8b-47b4-8b21-86209d6946a8
Commits
Reviewing files that changed from the base of the PR and between 096a87b and 7b95313.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Addressed the review at 68e635d: old pending rows now expire by age, a failed save is retried on the next scan, and the schema comment clarifies which day a row belongs to.
No findings. The change adds no timers, polling or idle wakeups, and it does less background work than before: fewer analytics events are queued and sent.
No findings. The change adds no timers, polling or idle wakeups, and it does less background work than before: fewer analytics events are queued and sent.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
No findings. The change adds no timers, polling or idle wakeups, and it does less background work than before: fewer analytics events are queued and sent, and two local state files that grew over time are replaced by a small bounded one.
119-123: Minor · Data Integrity & Integration · Poor tradeoff
Accepted daily growth can be sent again after a restart.
publish records growth in state.reported after capture returns true, and it saves state only at the end of the scan. If that save fails, the file on disk does not include the accepted growth. unsaved retries the save only within the same process. After a restart, the reporter loads the stale file, computes the same growth, and sends it again. Daily rows are additive, so that day's total is counted twice.
If capture throws instead of returning false, the save after the loop is skipped. Progress from earlier days in that scan then exists only in memory. The declared capture contract returns Promise<boolean>, so this path depends on the production implementation.
Changing the save order does not fix this. Saving before capture loses growth whenever capture returns false. Full protection needs a stable delivery identifier with receiver-side deduplication. Otherwise, accept at-least-once delivery and document it. Choose one of these explicitly.
Cover two eligible completed days with independent baselines.
The current assertions never compare two eligible completed days. The first test starts on 2026-11-20, so 2026-11-19 is excluded as history. The second test captures no rows after the downgrade. A reported-count baseline shared across dates would pass these assertions.
Add a case that starts the reporter on 2026-11-19. At 2026-11-21, report both completed days with different totals, such as 500 and 130 tokens. Assert that both initial rows are captured. Then raise only the 2026-11-20 total to 150 tokens and report again. Assert that the second scan captures only the 20-token growth for 2026-11-20.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 3a1f1716-1c0a-44d2-b637-26405c452657
Commits
Reviewing files that changed from the base of the PR and between 83f7efd and ea6493f.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
No findings. The change adds no timers, polling or idle wakeups, and it does less background work than before: fewer analytics events are queued and sent, and two local state files that grew over time are replaced by a small bounded one.
No findings. The change adds no timers, polling or idle wakeups, and it does less background work than before: fewer analytics events are queued and sent, and two local state files that grew over time are replaced by a small bounded one.
No findings. The change adds no timers, polling or idle wakeups, and it does less background work than before: fewer analytics events are queued and sent, and two local state files that grew over time are replaced by a small bounded one.
Change. Two high-frequency analytics events are reduced: one is sent for the first occurrence each day per device and then sampled, the other becomes a small daily total. Nothing in the app changes.
Fixed during review. Sampling state survives restarts. Upgrade and downgrade keep their own state files and never overwrite each other's. Daily totals are dated by the day they belong to. Saved state is written before sending, so a crash never sends a row twice, and a failed save is retried. Unreadable or newer state files are handled safely. Unused code was removed, and the PR text was corrected.
Refuted. A suspected over-count after a worktree is removed: Orca keeps removed worktrees attributed, so it doesn't happen.
Deferred (agreed by the reviewer who raised it). A row can be lost if the app crashes right after queueing it. That's the same best-effort delivery as all other analytics. Known limits are listed in the PR's Risk section.
Verified. CI green at d4517dc. Reporter test (2 cases) passes and fails if the start-day or downgrade logic is reverted. Main and renderer typecheck and lint pass locally. Fresh repair review: clean. Perf scan at this head: clean. Blinded regression audit: its only must-fix was refuted. QA by tests: no UI.
brennanb2025
changed the title
Send fewer usage events: daily token totals and sampled chat sends
Reduce background analytics volume
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Orca sends fewer background analytics messages. Two kinds of messages that used to go out very often are now combined into a small daily summary or sent only occasionally. Nothing new is collected, and nothing changes in the app.
What Changed
The events go out for the first send of each day on each device, then for about 1 in 10, tagged with its sampling rate, and as one total per provider per day.
Linked Issue
N/A (maintainer change)
Visual Proof
N/A: no UI change.
Testing
agent-token-usage-reporter.test.tscovers the saved-state rules: a finished day is sent under the day it was used, earlier history is never sent, only later growth is sent after a restart, and the start day after upgrading from an older build. Ran locally on macOS; CI covers Linux and Windows.Performance
None, because chat sends add one in-memory comparison in the existing
track()path, and the token reporter sums the scan's existing daily rows once per scan (the same order of work as before) while sending far fewer events.Risk
Riskiest part: the token reporter's saved state. If it went wrong, daily token totals would stop arriving; nothing in the app changes. An unreadable state file is logged and reporting restarts from that day; a newer build's state file is left untouched.
Reading the data: totals for the chat event now need to be weighted by
sample_rate; per-install and per-day views are unaffected. Daily token rows for the same install, provider and day add up. Combined with the older per-session event, use that event for an install only before its first daily row. Known limits: a time-zone change followed by a full usage rescan can count tokens near midnight once more, and days spent on an older build that is never upgraded again aren't covered.Backing out is a plain revert: the older build still reads its own untouched file.
Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)