Skip to content

Fix Cursor provider reporting $0 for v3 bubbles and NULL createdAt rows#164

Merged
iamtoruk merged 1 commit intomainfrom
fix/cursor-cost-tracking
Apr 27, 2026
Merged

Fix Cursor provider reporting $0 for v3 bubbles and NULL createdAt rows#164
iamtoruk merged 1 commit intomainfrom
fix/cursor-cost-tracking

Conversation

@iamtoruk
Copy link
Copy Markdown
Member

Summary

  • Cursor v3 stores zero token counts in bubbles, making the provider return empty results. Now estimates tokens from text length when counts are zero.
  • NULL createdAt rows were silently dropped by SQL comparison. Now included via OR IS NULL with a fallback timestamp.
  • AgentKv entries with plain string content (not JSON arrays) were skipped. Now counted toward usage.
  • Bubbles and agentKv are both parsed instead of agentKv being a fallback-only path.
  • Subagent transcripts in subagents/ subdirectories are now discovered.
  • Fixed a timezone-dependent test assertion in day-aggregator.

Fixes #159, #163

Test plan

  • All 355 tests pass
  • Verified on a machine with Cursor v3 data: usage now shows up where it previously showed $0
  • Existing Claude Code / Codex tracking unaffected (same totals before and after)

…dAt rows

Cursor v3 stores zero token counts in bubbles, causing parseBubbles to
return empty results. The query also dropped rows with NULL createdAt
via the SQL comparison, hiding data from older Cursor versions too.

Changes:
- Remove inputTokens > 0 SQL filter, estimate tokens from text length
  when token counts are zero (same 4 chars/token ratio as agentKv)
- Include NULL createdAt rows with OR IS NULL, fall back to current
  timestamp when createdAt is missing
- Parse agentKv entries with plain string content instead of skipping
  them (not all content is a JSON array)
- Always parse both bubbles and agentKv instead of agentKv-only fallback
- Discover subagent transcripts in subagents/ subdirectories
- Fix timezone-dependent test in day-aggregator

Fixes #159, #163
@iamtoruk iamtoruk merged commit 30fd165 into main Apr 27, 2026
3 checks passed
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.

Issue: Cursor Cost Tracking Not working

1 participant