Skip to content

feat(cli): hint that Copilot usage records no per-message tokens (#349)#934

Merged
wesm merged 2 commits into
kenn-io:mainfrom
mjacobs:feat/usage-no-token-hint
Jun 30, 2026
Merged

feat(cli): hint that Copilot usage records no per-message tokens (#349)#934
wesm merged 2 commits into
kenn-io:mainfrom
mjacobs:feat/usage-no-token-hint

Conversation

@mjacobs

@mjacobs mjacobs commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

GitHub Copilot bills via a monthly premium-request quota rather than per-token, so its session files frequently record no per-message token usage. usage daily --agent copilot then shows all-zeros / $0.00 with no explanation, which reads as "spent nothing" (#349).

This adds a one-line stderr note from usage daily when the agent filter is an all-Copilot filter and the totals are zero. The agent filter accepts comma-separated lists, so IsCopilotAgentFilter treats an all-Copilot list (e.g. copilot,vscode-copilot) as Copilot. The note is an agent-property statement shown in response to an explicit --agent the user typed, so it needs no session-presence check.

Scope: this is the CLI half of #349. The dashboard hint is the harder half — to avoid showing it for an empty view it needs a timezone-correct, filter-faithful matching-session count from the sessions table (to distinguish "Copilot sessions with no usage" from "no matching sessions"), which is a cross-backend change worth its own PR. Tracked separately; this PR is intentionally scoped to the CLI.

Where to look

  • cmd/agentsview/usage.go (noTokenDataNote).
  • internal/db/usage.go (NoTokenData, IsCopilotAgentFilter).

@roborev-ci

roborev-ci Bot commented Jun 30, 2026

Copy link
Copy Markdown

roborev: Combined Review (c2a4480)

Summary verdict: One medium issue should be fixed before merge; no security findings were reported.

Medium

  • internal/service/usage.go:188: MatchingSessions is computed by translating UsageFilter to SessionFilter, but the filters are not equivalent. The mapping drops ExcludeAgent and model filters, and SessionFilter treats Project/ExcludeProject as single exact values even though usage filters support comma-separated values. This can make matchingSessions positive when the actual usage filter matches no sessions, causing the Copilot no-token-data hint to appear for an empty view.

    Fix: Count matching sessions with a query that reuses the usage filter predicates and CSV semantics, or extend SessionFilter and this mapping to preserve all relevant usage filters. Add tests for exclude_agent and multi-project exclusions.


Panel: ci_default_security | Synthesis: codex, 6s | Members: codex_default (codex/default, done, 6m9s), codex_security (codex/security, done, 46s) | Total: 7m1s

@mjacobs mjacobs force-pushed the feat/usage-no-token-hint branch from c2a4480 to 5ad8c5e Compare June 30, 2026 22:36
@mjacobs mjacobs changed the title feat(usage): explain all-zeros Usage for non-tokenized Copilot sessions (#349) feat(cli): hint that Copilot usage records no per-message tokens (#349) Jun 30, 2026
@roborev-ci

roborev-ci Bot commented Jun 30, 2026

Copy link
Copy Markdown

roborev: Combined Review (5ad8c5e)

No issues found.


Panel: ci_default_security | Synthesis: codex | Members: codex_default (codex/default, done, 4m24s), codex_security (codex/security, done, 27s) | Total: 4m51s

@wesm wesm merged commit b7cc70d into kenn-io:main Jun 30, 2026
12 checks passed
@mjacobs mjacobs deleted the feat/usage-no-token-hint branch June 30, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants