Skip to content

perf(cli): ingesting one call rewrites its whole month #1001

Closed

Description

@blafourcade

Problem

Ingesting one call rewrites its whole month partition of the usage ledger (usage-ledger-adapter.ts). At 265k records that takes about 3 s, measured for #993. It runs in the async catch-up hook, so no session waits, but the cost grows with the month.

Scope

  • Make an ingest cost what it adds, not the size of its month.
  • Keep what the rewrite guarantees today: one record per call (message.id:requestId, per tool), the largest total wins, written under the lock and only when content changes.

Acceptance criteria

Activity

  1. blafourcade commented on Oct 15, 2026

    @blafourcade
    ContributorAuthor

    Fixed by #1031 (fcb6022 on next): the ledger is partitioned by day, so one ingest reads and rewrites about three days instead of the whole month.

  2. moved this from Ideation to Done in AIDD Roadmapon Oct 15, 2026
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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions