Skip to content

Cursor adapter double-counts tool calls #24

@V3RON

Description

@V3RON

CursorAgentAdapter currently treats every tool_call record as a new tool invocation, but Cursor emits both started and completed subtypes for the same call. Because normalization does not filter by subtype, the adapter can emit duplicate tool events and double count downstream activity.

Observed Findings

  • src/adapters/cursor-agent.ts handles every record with type === "tool_call" the same way.
  • The adapter does not inspect subtype, even though Cursor records include started and completed variants for the same call_id / model_call_id.
  • src/limits/max-steps.ts already treats Cursor tool_call records as subtype-aware, counting only subtype === "started".

Suggested Behavior

  • Only count or emit the initial tool invocation once per logical call.
  • Filter Cursor tool-call processing by subtype so started and completed are handled intentionally instead of both being treated as separate calls.
  • Preserve completion-only data such as tool results without incrementing counts again.

Resolution Summary

  • Cursor normalization should not double count tool calls.
  • Tool-call handling should be subtype-aware and match Cursor’s event model.

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