Skip to content

Fix: stop misattributing undated usage to 'Today'#262

Open
darthrevanyunka wants to merge 4 commits intogetagentseal:mainfrom
darthrevanyunka:fix/cursor-undated-bucketing-v2
Open

Fix: stop misattributing undated usage to 'Today'#262
darthrevanyunka wants to merge 4 commits intogetagentseal:mainfrom
darthrevanyunka:fix/cursor-undated-bucketing-v2

Conversation

@darthrevanyunka
Copy link
Copy Markdown

What this fixes

Codeburn was misreporting Cursor usage by assigning undated records to the current day. This made Today appear artificially high, and the "most active day" could shift depending on when reports or menubar refreshes were run.

Root cause

Two parser paths generated synthetic "now" timestamps when source records were undated:

  • Cursor bubble rows with missing createdAt
  • Cursor agentKv sessions with no timestamp metadata

That rebucketed historical/undated usage into the runtime date.

Why this is important

  • Daily usage charts become unreliable
  • Menubar Today values can be misleadingly large
  • Teams tracking token spend by day get incorrect trend signals

Changes

  • Require real createdAt for bubble day bucketing (skip undated bubble rows)
  • Stop defaulting agentKv timestamps to current time
  • Parse timestamp candidates from agentKv content (timestamp, createdAt, and time* variants)
  • Skip agentKv sessions when no reliable timestamp exists
  • Add regression tests for all of the above

Verification

  • npm test -- tests/providers/cursor.test.ts
  • npm run build

Made with Cursor

darthrevanyunka and others added 3 commits May 7, 2026 08:46
Cursor bubble rows without createdAt were being assigned the current time, which shifted historical usage into whichever day report ran. Require createdAt for bubble parsing and add a regression test that verifies missing timestamps are skipped.

Co-authored-by: Cursor <cursoragent@cursor.com>
agentKv sessions were always assigned the current timestamp, which inflated today's usage even when events came from earlier days. Parse timestamp candidates from agent content and skip undated sessions, with regression coverage for both paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
Clean up conflict residue from rebase by restoring the split bubble query template and removing stale agentKv mtime fallback code so the branch remains conflict-free and preserves correct timestamp bucketing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@darthrevanyunka darthrevanyunka changed the title fix(cursor): stop misattributing undated usage to 'Today' Fix: stop misattributing undated usage to 'Today' May 7, 2026
@darthrevanyunka
Copy link
Copy Markdown
Author

This PR is intended as a follow-up/complement to the recent Cursor provider fixes (including #257 and related work), focusing on one remaining day-bucketing edge case: undated records can still be assigned synthetic timestamps and drift into Today buckets.

What this PR tightens:

bubble rows: do not bucket rows without real createdAt into the current day
agentKv: avoid synthetic now bucketing; use embedded timestamp metadata when present, otherwise skip undated sessions
Why this matters:

prevents moving most-active-day behavior
keeps menubar and daily trend data consistent with actual event timing
Happy to split or trim scope if maintainers prefer this as a narrower patch.

@iamtoruk
Copy link
Copy Markdown
Member

iamtoruk commented May 7, 2026

Nice catch on the undated bucketing - tested locally and the fix is solid. Two small things before we merge:

  1. takeUserMessage() (line 197) is now unused since you inlined the shift. Can you remove it?
  2. Line 528 still passes source.path as a third arg to parseAgentKv but the signature only takes two params now. Harmless but should match.

Happy to merge once those are cleaned up.

Apply maintainer-requested cleanup by removing an unused helper and matching the parser invocation to the current function signature.

Co-authored-by: Cursor <cursoragent@cursor.com>
@darthrevanyunka
Copy link
Copy Markdown
Author

All done and tested

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