Conversation
`scanCopilotHistory` hardcoded `totalCostUSD: 0` behind the comment "event logs carry no token/cost rollup". The comment is wrong. session.shutdown carries a modelMetrics rollup with inputTokens, outputTokens, cacheReadTokens and cacheWriteTokens, and costSync has been pricing it the whole time — $0.0426 of gpt-5-mini reaching the cloud while `node9 scan` displayed $0.00 for the same sessions. A $0 beside a real agent does not read as "no data". It reads as free, which is the opposite of the truth and exactly the conclusion a user would act on. No new arithmetic. parseCopilotSession already exists, is tested, and is what the upload path uses; scan simply never called it. Same shape as codexSessionCost: one function, several callers. Writing a second Copilot cost function would have recreated the divergence fixed one commit ago for Codex. Copilot's own `requests.cost` is 0 in real transcripts because GitHub bills a subscription, not tokens. The existing parser already prefers it only when > 0 and otherwise prices the tokens; a test now pins that, because trusting a vendor's billing field as a consumption figure is the same confusion the "API value" relabel exists to prevent. Windowed per row date. The rows carry their own `date`, so unlike Codex no session-level guard is needed. Measured, both binaries built and run back to back over --all: copilot $0.0000 -> $2.3526 <- the change gemini unchanged codex unchanged claude +$0.41 <- this session generating activity Mutation-tested three ways: restoring the hardcoded zero, removing the window filter, and trusting Copilot's cost field all turn the new tests red. Noticed while measuring: Gemini reports $11.43 over --all, so it computes correctly and its 30-day $0 is simply an empty window — not the same class of defect. Antigravity remains a genuine $0 with no token data anywhere; that one is a display problem, and it is next.
Contributor
🛡️ node9 agent-security · ✅No agent-security findings — no injectable workflows, unsafe agent configs, or unpinned MCP servers. |
Contributor
Author
|
🎉 This PR is included in version 2.7.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
scanCopilotHistoryhardcodedtotalCostUSD: 0behind the comment "event logs carry no token/cost rollup". The comment is wrong.session.shutdowncarries amodelMetricsrollup withinputTokens,outputTokens,cacheReadTokensandcacheWriteTokens— andcostSynchas been pricing it the whole time. The upload path reported$0.0426ofgpt-5-minito the cloud whilenode9 scandisplayed$0.00for the same sessions.A
$0beside a real agent does not read as "no data". It reads as free, which is the opposite of the truth and exactly the conclusion a user would act on.No new arithmetic
parseCopilotSessionalready exists, is tested, and is what the upload path uses.scansimply never called it. Same shape ascodexSessionCost: one function, several callers.Writing a second Copilot cost function would have recreated the exact divergence fixed one commit ago for Codex — same pattern, different agent.
The vendor's own cost field is not consumption
Copilot reports
requests.cost: 0in real transcripts, because GitHub bills a subscription rather than tokens. The existing parser prefers it only when> 0and otherwise prices the tokens. A test now pins that: trusting a billing field as a consumption figure is the same confusion theAPI valuerelabel exists to prevent.Measured — both binaries built and run back to back,
--allOnly Copilot moved.
Verification
4,295 tests, typecheck, lint, format clean. Mutation-tested three ways — restoring the hardcoded zero, removing the window filter, and trusting Copilot's cost field all turn the new tests red.
Corrected while measuring
Gemini reports
$11.43over--all, so it computes correctly and its 30-day$0is an empty window, not a defect. I had grouped it with the suspects; that was wrong.Antigravity remains a genuine
$0with no token data anywhere on disk. That one is a display problem —$0should read—— and it is the next commit, not this one.🤖 Generated with Claude Code