Skip to content

Cursor bubbles with no createdAt are timestamped as "now", inflating today's usage #326

Closed

Description

@amosweckstrom

Summary

Cursor sessions show up as "today's usage" even when Cursor hasn't been launched in weeks. On my machine, CodeBurn 0.9.8 reported 317 Cursor calls / $7.57 for 2026-05-13, while every file under ~/Library/Application Support/Cursor/ had an mtime of 2026-04-23 or earlier and Cursor.app was not running.

Repro

  1. Have a long-lived Cursor globalStorage/state.vscdb (mine is ~1 GB).
  2. Don't open Cursor for several weeks.
  3. Run codeburn today --provider cursor.

Expected: empty / no data for today.
Actual: hundreds of "today" calls, costed at Sonnet rates.

Root cause

In src/providers/cursor.ts (verified against dist/cli.js in the published 0.9.8 build):

  1. BUBBLE_QUERY_SINCE_HEAD deliberately keeps rows with a missing createdAt:
    AND (json_extract(value, '$.createdAt') > ? OR json_extract(value, '$.createdAt') IS NULL)
  2. In parseBubbles, when created_at is null, the JS falls back to Date.now():
    const timestamp = createdAt || new Date().toISOString();

So every undated historical bubble is stamped with the current wall-clock time and bucketed into today.

Suggested fix

Drop rows with no usable timestamp instead of dating them to now — either:

  • Remove the IS NULL branch from the SQL filter, or
  • In parseBubbles, continue when createdAt is missing/invalid.

If older bubbles legitimately have an alternative timestamp field (e.g. on the parent composer), use that as a fallback before falling through to Date.now().

Environment

  • macOS 24.6.0 (Darwin)
  • Node 22.19.0 (also reproduced on the bottled node 26.0.0 via Homebrew install)
  • codeburn 0.9.8 (Homebrew)

Activity

  1. amosweckstrom commented on May 13, 2026

    @amosweckstrom
    Author

    Likely related to #325 — same user-visible symptom (historical Cursor usage attributed to today). That issue proposes file mtime as the fallback source; this one traces the fallback to new Date().toISOString() in parseBubbles (via the SQL createdAt IS NULL branch). May be the same bug with a misidentified cause, or two parallel mtime-/now-fallback paths worth fixing together.

  2. iamtoruk commented on Jul 2, 2026

    @iamtoruk
    Member

    Confirmed and fixed. Your diagnosis was exactly right: the code at the time had

    const timestamp = createdAt || new Date().toISOString()

    with the bubble query including createdAt IS NULL rows, so timestampless bubbles landed on "today". The agentKv path had the sibling bug (#325): every stream call was stamped new Date() unconditionally.

    Both were fixed in #254: the bubble scan now requires createdAt IS NOT NULL and the parser skips rows without it entirely (no fallback), and agentKv calls use the database file's mtime as a bounded last-write time instead of "now". First shipped in v0.9.7, which explains the timing: the fix merged two days before this issue was filed, so the release you were running predated it.

    Since then the Cursor parser was rebuilt again (#575, in 0.9.15): conversation-level usage is now anchored to the conversation's own creation time, so day attribution no longer depends on parse timing at all. The only remaining new Date() is a last-resort fallback when the database file cannot even be stat'ed.

    Closing as fixed in v0.9.7 and hardened further in 0.9.15. If you still see historical Cursor usage attributed to today on a current version, please reopen with the version number.

  3. dhinic-swap-tmp commented on Aug 10, 2026

    @dhinic-swap-tmp

    Reopening per the request above — same symptom, reproduced on a current version well past both the v0.9.7 and v0.9.15 (#575) fixes.

    Version: codeburn 0.9.19 (also present on 0.9.15 before upgrading)

    Repro: Two codeburn export --format json --from <today> --to <today> runs taken ~10 minutes apart on the same day. In both, the overwhelming majority of cursor-labeled session entries (1032 of 1034) shared one identical Started At timestamp — and that timestamp shifted between runs to match each run's execution time almost exactly:

    • Run 1 (11:42 UTC): 1032 entries stamped 2026-08-10T11:42:01.123Z
    • Run 2 (11:52 UTC, after the 0.9.15→0.9.19 upgrade): 1032 entries stamped 2026-08-10T11:52:05.851Z

    Only 2 of the ~1034 cursor entries had distinct, plausible per-turn timestamps. Net effect: the "Today" total (codeburn status, menu bar) is dominated by this undated backlog, re-attributed to whichever day the report happens to be run on.

    Why this is probably a different code path than the earlier fixes: #325/#326/#460 all trace to the legacy extension storage (store.db SQLite bubbles / agentKv blobs). Given #55 added support for the newer ~/.cursor/projects/*/agent-transcripts/*.jsonl format (used by current Cursor/cursor-agent CLI installs), it looks like that parser may have reintroduced the same "no usable timestamp → stamp with Date.now()" pattern in a spot the 0.9.7/0.9.15 hardening never touched, since the earlier fixes predate #55.

    Full write-up with environment details and the expected/suggested fix is in #953 (closing that one in favor of this thread to keep history together). Happy to share the raw redacted export JSON if it helps narrow down the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions