Skip to content

fix(desktop): align Usage Statistics counts with Daily Review #3695

Closed

Description

@liuxiaocs7

What happened

Settings → Usage Statistics showed three numbers that looked contradictory for the same period:

  • the activity log contained 181 rows;
  • the summary showed 10 requests;
  • Daily Review showed 151 requests.

The labels made these values look comparable even though they came from different data sources and represented different things.

The legacy Settings projection counted only persisted token_usage messages for its summary, while the log mixed those model rows with tool calls. Daily Review queried the Runtime Host canonical usage authority, including both legacy and canonical model-call records.

In the reported data:

  • 151 was the canonical model-call total;
  • 171 rows were tool calls;
  • the activity stream should therefore contain 322 rows after both sources are loaded completely.
Image Image

How to reproduce

  1. Use Maka across the legacy-to-canonical usage accounting cutover so the selected time range contains both legacy and canonical model calls.
  2. Produce multiple tool calls.
  3. Open Settings → Usage Statistics and enable detailed records.
  4. Compare the summary count and activity row count with Daily Review for the same time range.
  5. Observe that the Usage summary, mixed log, and Daily Review appear to disagree.

Expected behavior

  • Usage Statistics and Daily Review use the same Runtime Host authority and time range for the model-call total.
  • Model calls and tool calls are labelled separately.
  • The mixed table is described as an activity log rather than a request count.
  • All activity pages are loaded, including records beyond the first page.
  • Switching Runtime Hosts cannot display stale usage from the previously selected Host.
  • Aborted activity and unknown session or cost fields remain explicit.

Environment

  • Maka commit: aed0a65d3
  • OS: macOS
  • Surface: Desktop
  • Node.js: repository-supported toolchain

Additional context

Related to #2128, which tracks missing canonical attempts and incorrect interrupted-tool status in the legacy Usage projection. This issue captures the concrete cross-surface count mismatch and ambiguous activity-log labeling.

Activity

  1. testikun commented on Aug 25, 2026

    @testikun
    Contributor

    This was generated by AI during triage.

    I would like to work on this issue.

    Proposed approach

    • Make the Desktop Usage Statistics page query the selected Runtime Host's usage authority, instead of reading only the legacy transcript token_usage projection.
    • Reuse the Host's existing canonical ledger merge, so Usage Statistics and Daily Review count legacy and canonical model calls over the same range.
    • Keep the existing Settings presentation, but adapt the Host-owned summary, provider/model/tool buckets, and paged activity logs into its current view model.
    • Make the request-log loader consume every page and preserve host-scoped session identity when the selected Runtime Host changes; stale responses will be ignored.
    • Add focused regression coverage for legacy-plus-canonical counts, activity pagination, aborted/unknown fields, and switching Runtime Hosts. This does not change the Runtime Host authority or pricing semantics.

    中文摘要

    我计划让 Desktop 的“使用统计”直接读取当前选中 Runtime Host 的统一用量权威,复用已有的 legacy + canonical 合并逻辑,确保它与 Daily Review 使用同一时间范围和数据口径;同时保留现有界面,补齐分页加载、Host 切换防旧数据回写,以及中止/未知字段的回归测试。不会改动 Runtime Host 的权限或定价语义。

  2. added
    bug
    help wanted
    on Aug 25, 2026
  3. testikun commented on Aug 25, 2026

    @testikun
    Contributor

    This was generated by AI during triage.

    Implemented in PR #3761.

    Result

    • Usage Statistics now reads the selected Runtime Host's unified usage projection, matching Daily Review's legacy + canonical model-call accounting.
    • Summary, provider/model/tool buckets, and all activity-log pages share one concrete time window.
    • Host-scoped session keys are preserved; unknown sessions remain visible but are not clickable.
    • Aborted tool calls are reported separately from errors.
    • Existing Runtime Host authority and pricing semantics are unchanged.

    Verification

    • Format and lint passed.
    • Core, Runtime Host, Storage builds passed.
    • Desktop main build and preload/main checks passed.
    • Focused regression passed: runtime-host-usage-stats.test.js.

    中文摘要

    修复已提交到 PR #3761:使用统计现在复用 Daily Review 的 Runtime Host 统一用量口径,补齐分页、Host 切换、未知会话/费用和中止工具调用处理;没有改动 Runtime Host 权威或定价语义。

  4. liuxiaocs7 commented on Aug 25, 2026

    @liuxiaocs7
    MemberAuthor

    Hi, @testikun, there is already a PR(#3697) to fix this issue, thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions