Skip to content

Add Cursor Cloud Agent usage attribution#2030

Open
tsonubin wants to merge 2 commits into
steipete:mainfrom
tsonubin:upstream-pr/cursor-cloud-agent-usage
Open

Add Cursor Cloud Agent usage attribution#2030
tsonubin wants to merge 2 commits into
steipete:mainfrom
tsonubin:upstream-pr/cursor-cloud-agent-usage

Conversation

@tsonubin

Copy link
Copy Markdown

Summary

  • Add a Cursor Cloud usage bar showing the share of current billing-cycle spend attributed to Cloud Agents.
  • Show the absolute Cloud Agent spend for the cycle in the menu card and CLI output.
  • Fetch Cursor's dashboard usage events as an optional enrichment, without affecting the existing Total, Auto, API, or Extra usage paths when the endpoint is unavailable.

Cursor's iOS rollout makes Cloud Agents much more practical to start away from a development machine. This gives those workflows the same at-a-glance cost visibility that CodexBar already provides for Cursor's other usage lanes.

Details

  • Fetches the current billing cycle from POST /api/dashboard/get-filtered-usage-events using the existing Cursor session cookie and required first-party Origin header.
  • Identifies Cloud Agent events from cloudAgentId or isHeadless and aggregates only chargeable positive-cost events.
  • Treats the Cloud bar as spend attribution, not a separate quota: Cloud Agents continue to draw from Cursor's shared included, API, and on-demand pools.
  • Paginates defensively and suppresses the optional Cloud enrichment rather than publishing a partial ratio when the event history exceeds the supported safety limit.
  • Keeps the new snapshot data live-only so cached usage cannot present stale Cloud Agent attribution.
  • Adds focused aggregation, endpoint, projection, menu-card, and non-chargeable-event coverage, plus provider documentation and localized string parity.

Validation

  • swift test --filter CursorCloudAgentUsageTests — 6 passed
  • swift test --filter CursorStatusProbeTests — 38 passed
  • swift test --filter CursorMenuCardModelTests — 5 passed
  • make check — passed, including SwiftFormat and strict SwiftLint
  • git diff --check — passed
  • make test — blocked in an unrelated existing suite: AdaptiveRefreshTimerTests intermittently fails refresh-count timing expectations. The sharded retry and an isolated rerun reproduced failures only in that suite; this PR does not touch adaptive refresh code.

No live provider probe or real account read was run, following the repository's no-Keychain-prompt validation guidance. Network behavior is covered with stubbed URL sessions.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 785a9c6691

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift
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.

1 participant