Conversation
…eatmap The requestId deduplication added in 0.5.1 (#32) only covered the global status-bar cost path (readJsonlFile/readAllUsage). Project-level costs, the burn-rate prediction, and the usage heatmap each had their own JSONL parsing loop with no deduplication, so those figures were still inflated 2-4x in agentic sessions. - Add shared readUsageEntries() to jsonlReader.ts: deduplicated entries with validated ms timestamps and normalized usage fields - Rewire projectCost.ts, prediction.ts, and webview/heatmap.ts onto it - Add readUsageEntries unit tests - Make the "aggregates costs for active days" heatmap test deterministic (hours-ago offsets crossed midnight when run before 03:00 local) - Document the shared reader requirement in docs/DATA.md Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ZLCLQeudf1LQBnBSyyr4f
This was referenced Jul 7, 2026
long-910
pushed a commit
that referenced
this pull request
Jul 7, 2026
The ubuntu job failed on the pre-existing heatmap test flake that only reproduces between 02:00 and 03:00 local time; the fix ships in #37. Empty commit to re-run CI outside that window. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ZLCLQeudf1LQBnBSyyr4f
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.
Summary
The
requestIddeduplication introduced in 0.5.1 (#32) only covered the global status-bar cost path (readJsonlFile/readAllUsage). Three other features each had their own ad-hoc JSONL parsing loop with no deduplication, so they still counted every streamed content-block line and inflated their figures 2–4× in agentic sessions:src/data/projectCost.ts) — status bar suffix and dashboard Project cardsrc/data/prediction.ts) — also skews rate-limit and budget exhaustion estimatessrc/webview/heatmap.ts) — daily and hourly aggregatesChanges
jsonlReader.ts:readJsonlFilededupe (byrequestId, falling back tomessage.id) and additionally validates timestamps and normalizes all four usage fields.readAllUsage,projectCost.ts,prediction.ts, andwebview/heatmap.tsonto it, deleting the three duplicated parsing loops.docs/DATA.md: new "Streaming Deduplication (applies to ALL readers)" section so future features go through the shared reader.CHANGELOG.md: Unreleased → Fixed entry.Tests
readUsageEntriessuite: dedupe by sharedrequestId, field normalization + ms timestamp parsing, skipping invalid entries, missing-file graceful degradation.aggregates costs for active daysused "N hours ago" offsets that cross midnight when CI runs before 03:00 local (it was failing in this session's container at 02:15 UTC). Timestamps are now anchored to local start-of-today.npm run lint✅,npm run compile✅, unit suites (jsonlReader / prediction / heatmap / cache, 34 tests) ✅ via mocha. The@vscode/test-electronrunner cannot download VS Code in this sandbox; please rely on CI for the extension-host suites.🤖 Generated with Claude Code
https://claude.ai/code/session_012ZLCLQeudf1LQBnBSyyr4f
Generated by Claude Code