Skip to content

Cursor Agent usage severely undercounted: only first assistant message per user message parsed #1512

Closed

Description

@iliaal

Symptom

codeburn report --provider cursor-agent shows a fraction of actual Cursor Agent usage. On one real corpus: 240 turns cached vs ~4,900 assistant messages on disk (~4% of assistant text counted).

Root cause (src/providers/cursor-agent.ts)

  1. parseJsonlTranscript only emits a turn for an assistant message that immediately follows a user message. Agentic loops emit dozens of assistant messages per user message; the rest are dropped. Same bug in the legacy text parser (flushAssistant drops when pendingUsers is empty).
  2. tool_use blocks contribute only their name; the input JSON is never counted. role: 'tool' content is absent from these transcripts, so nothing else covers it.
  3. extractUserQuery truncates to MAX_USER_TEXT_LENGTH (500) and the truncated length feeds inputTokens — prompts embedding whole skill files count as ~125 input tokens.
  4. conversation_summaries in ai-code-tracking.db is empty in practice (0 rows here), and non-UUID conversation IDs are path hashes that can never match a summary row — so model is always cursor-agent-auto (priced as Sonnet 4.5) and every turn shares the file-mtime timestamp.

No real token counts exist on disk (transcripts and chats/*/store.db carry message text only), so char estimation stays — but it should cover all of the text.

Activity

  1. added
    bug
    area: cli
    provider: cursor-agent
    status: has-pr
    on Sep 22, 2026
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

    area: clibugprovider: cursor-agentstatus: has-pr

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions