fix(hoosage): count full Copilot CLI session cost - #46
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Copilot CLI's per-model
modelMetricsinsession.shutdownare incomplete: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
totalNanoAiu(written bysession.usage_checkpointandsession.shutdown) is now authoritative for cost.modelMetricsat shutdown), so running sessions show cost and long sessions are spread over the right days.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.