Skip to content

Unified session report drops pi sessions on the inclusive --until day #1390

Description

@ben-vargas

What happened?

ccusage session and ccusage pi session disagree about which pi sessions fall inside the same date window.

The unified report filters pi sessions by comparing the session's lastActivity against the --until date as strings. lastActivity is a full RFC3339 timestamp, so after dash removal a session at 2026-07-04T18:00:00Z becomes 20260704T180000Z, which sorts after 20260704 — and the session gets dropped even though it's on the until day. The pi session --pi-path path filters entries by date before summarizing, so it keeps the session.

Concretely, against the same store:

ccusage session --json -u 20260704        # pi session from 2026-07-04 missing
ccusage pi session --json -u 20260704     # same session present

Steps to reproduce

  1. Have a pi session whose last activity is on day X (e.g. 2026-07-04T18:00:00Z).
  2. Run ccusage session --json -u 20260704 — the session is missing from the unified output.
  3. Run ccusage pi session --json -u 20260704 — the session is there.

Expected behavior

--until is inclusive everywhere. The unified report should return the same pi sessions as the pi subcommand for the same window.

Version

v20.0.14 (also reproduced on current main)


I have a fix ready (filter entries by date before summarizing, same as the pi subcommand does) with a regression test that fails on main and passes with the fix. Happy to open a PR.

Activity

  1. pullfrog commented on Jul 4, 2026

    @pullfrog
    Contributor
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions