Skip to content

Use App Server account data for the lightweight core #41

Description

@thrr87

Problem

The main Token Activity view starts local Codex history work even though Codex already returns account Token Activity. That work adds CPU, memory, sync code, and failure cases to the default product.

The current sync branch also treats facts from another Mac as local source rows. This requires source generations, projection merging, and partial-import recovery that the lightweight core does not need.

Decision

Use the Codex App Server as the only source for the lightweight core:

  • account/rateLimits/read for Usage remaining, reset times, Other limits, and banked resets;
  • account/rateLimits/updated as a sparse limit update after the first full read;
  • account/usage/read for account facts and daily Token Activity;
  • the existing single persistent App Server connection.

Do not add a custom cross-Mac sync for account Token Activity. The account API is already account-scoped, so both Macs read the same source.

Keep the existing Usage remaining history sync. Move Task, agent, model, concurrency, receipt, and source-file analytics to the opt-in work in #40.

account/usage/read has no documented update notification. Read it at startup, after wake or reconnect, and when the Token Activity view needs a newer snapshot. Do not build a second event transport for it.

Scope

  • Replace the current local Token Activity chart with daily account buckets.
  • Label the chart and values as Account.
  • Keep 24 hours, 3 days, 4 weeks, 12 weeks, and Current window ranges.
  • Keep exact weekly account totals only when the lifetime counter has a valid boundary reading. Otherwise show the bounded complete-day sum as partial.
  • Selecting Token Activity must not call thread/list, open rollout JSONL, or create/read the local analytics SQLite store.
  • Do not ship the current Token Activity file-sync work.
  • Keep the existing persistent CodexClient process and reconnect behavior.

Acceptance

  • Opening Usage remaining performs no local analytics scan.
  • Opening Token Activity performs no local analytics scan.
  • Token Activity uses account/usage/read daily buckets and shows Account provenance.
  • Current window never presents partial daily buckets as an exact weekly total.
  • Usage remaining history sync still works.
  • A reconnect performs one full account reconciliation.
  • Tests prove that neither core graph calls the local collector.
  • A real-data run records steady memory, peak memory during refresh, CPU, App Server process count, and chart load time.
  • The core is checked on two Macs signed into the same account before release.

Evidence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions