Skip to content

fix(hoosage): count full Copilot CLI session cost - #46

Merged
wakemeup0 merged 1 commit into
mainfrom
fix/cli-session-total-cost
Sep 29, 2026
Merged

wakemeup0 merged 1 commit into
mainfrom
fix/cli-session-total-cost

Conversation

@wakemeup0

Copy link
Copy Markdown
Contributor

Problem

Copilot CLI's per-model modelMetrics in session.shutdown are incomplete:

  • they restart after context compaction and after an interrupted run that is resumed,
  • they leave out sub-agent calls (explore/research agents on other models).

hoosage summed only those, so CLI cost was heavily undercounted. On real data for August 2026 it showed $23.70 while the sessions' own totals add up to $61.08 (one session: $6.55 counted vs. $30.10 real).

Fix

  • The session-level cumulative totalNanoAiu (written by session.usage_checkpoint and session.shutdown) is now authoritative for cost.
  • Checkpoints emit cost-only increments (0 tokens / 0 requests; those still come from modelMetrics at shutdown), so running sessions show cost and long sessions are spread over the right days.
  • At shutdown, per-model entries keep their reported cost (capped to the still-unassigned session cost); any remainder is added to the current model.
  • A drop of the session counter (older CLIs restart it on resume) is treated as a new run: earlier runs stay counted and per-model baselines restart.
  • Sessions without a session total keep the previous behaviour.
  • Entries are immutable, so the append-only shared project sync stays correct.

Verified against the real session-state data: the per-session sum of totals matches exactly (Windows Aug $61.08, WSL $399.01 overall).

Also removes the stale manual "Unreleased" changelog block left below 0.13.0.

Copilot CLI resets per-model modelMetrics after context compaction or an interrupted run and omits sub-agent calls, so summing them undercounted real cost (e.g. $23.70 instead of $61.08 for one month). Use the session-level cumulative totalNanoAiu from usage checkpoints and shutdowns as the authoritative cost, emit checkpoint increments so running sessions show cost, and treat counter drops from older CLIs as a new run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wakemeup0
wakemeup0 merged commit 73dd1b1 into main Sep 29, 2026
7 checks passed
@wakemeup0
wakemeup0 deleted the fix/cli-session-total-cost branch September 29, 2026 09:06
wakemeup0 added a commit that referenced this pull request Sep 29, 2026
## 0.13.1 (2026-09-29)

### Bug Fixes

- **hoosage:** count full Copilot CLI session cost (#46) (73dd1b1)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants