Skip to content

fix: count every Cursor Agent assistant message instead of one turn per user message - #1513

Open
iliaal wants to merge 1 commit into
getagentseal:mainfrom
iliaal:fix/cursor-agent-full-turn-accounting
Open

iliaal wants to merge 1 commit into
getagentseal:mainfrom
iliaal:fix/cursor-agent-full-turn-accounting

Conversation

@iliaal

@iliaal iliaal commented Sep 20, 2026

Copy link
Copy Markdown

Fixes #1512.

What changed

  • Every assistant message counts as a turn: each carries the last user message forward (JSONL and legacy text parsers).
  • tool_use inputs are serialized into the output text instead of counting as zero.
  • Input tokens use the full user text; the displayed message stays truncated at 500 chars.
  • cursor-agent parse version bumped (full-turn-accounting-v1) so cached sessions re-parse.

Verification

  • 4 new regression tests (carry-forward jsonl/txt, tool-input counting, truncation split); provider suite 21/21.
  • Full suite 4317 passed, tsc clean.
  • Live corpus, September: 240 turns → 5,004 calls, 2.66M in / 1.36M out tokens, $28.40 (est.).

Still estimates — no real token counts exist on disk — and everything prices as Sonnet 4.5 (conversation_summaries is empty in practice).

…er user message

Agentic loops emit dozens of assistant messages per user message and
the parser kept only the first (on one real corpus: 247 of 4,946
messages, ~4% of assistant text). Each message now carries the last
user message forward, tool_use inputs join the output text, and input
tokens use the full user text while the display stays truncated at
500 chars. Parse version bumped so cached sessions re-parse.
@iliaal
iliaal requested a review from iamtoruk as a code owner September 20, 2026 20:26
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.

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

1 participant