Skip to content

fix(cursor): handle free account pooled limit#544

Merged
robinebers merged 1 commit into
robinebers:mainfrom
rohithgoud30:fix/cursor-free-account
Jun 4, 2026
Merged

fix(cursor): handle free account pooled limit#544
robinebers merged 1 commit into
robinebers:mainfrom
rohithgoud30:fix/cursor-free-account

Conversation

@rohithgoud30
Copy link
Copy Markdown
Contributor

@rohithgoud30 rohithgoud30 commented Jun 3, 2026

Description

Fixes Cursor free accounts that return spendLimitUsage.pooledLimit: 0.

OpenUsage was treating any numeric pooledLimit as a team account signal. For free accounts, Cursor can include pooledLimit: 0, which made the plugin incorrectly switch to the request-based fallback API and fail with unavailable usage data.

This keeps the existing team detection for planName: Team and limitType: team, but only treats pooledLimit as a team signal when it is greater than 0.

Related Issue

Fixes #529

Type of Change

  • Bug fix
  • New feature
  • New provider plugin
  • Documentation
  • Performance improvement
  • Other (describe below)

Testing

  • I ran bun run build and it succeeded
  • I ran bun run test and all tests pass
  • I ran bun run test -- plugins/cursor/plugin.test.js and all tests pass

Screenshots

SCREENSHOT_3

Checklist

  • I read CONTRIBUTING.md
  • My PR targets the main branch
  • I did not introduce new dependencies without justification

Summary by cubic

Fix team detection in the Cursor provider so free accounts with spendLimitUsage.pooledLimit: 0 are treated as individual accounts, avoiding the REST fallback and missing usage data. Restores correct percent-only usage for free plans.

  • Bug Fixes
    • Treat pooledLimit as a team signal only when greater than 0; keep planName: Team and limitType: team checks.
    • Add a test verifying percent-only free usage when pooledLimit is 0, and update docs to reflect the rule.

Written for commit 219c4b8. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Team account detection now requires a positive pooled spending limit to be classified as a team account.
  • Documentation

    • Updated account classification documentation to reflect the new team detection rule.
  • Tests

    • Adjusted test coverage to validate free-tier usage formatting when pooled limit is zero.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Team account detection now requires spendLimitUsage.pooledLimit > 0. The docs, the probe() implementation, and the cursor plugin test were updated to use and validate the new threshold.

Changes

Team account detection threshold

Layer / File(s) Summary
Pooled limit threshold update
docs/providers/cursor.md, plugins/cursor/plugin.js, plugins/cursor/plugin.test.js
Team detection now requires spendLimitUsage.pooledLimit > 0 instead of merely being present; documentation and tests updated to reflect and validate the tightened condition.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(cursor): handle free account pooled limit' directly addresses the main change—handling Cursor free accounts with pooledLimit: 0 by changing team detection logic.
Linked Issues check ✅ Passed The PR fully addresses issue #529 by fixing team account detection to only treat pooledLimit as a team signal when pooledLimit > 0, enabling free Cursor accounts to work correctly.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the pooledLimit detection logic for free Cursor accounts: plugin logic, documentation, and test case are all in scope.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
plugins/cursor/plugin.js (1)

595-599: 💤 Low value

Consider using Number.isFinite() for consistency.

The fix correctly prevents pooledLimit: 0 from triggering team account detection. However, the current check allows Infinity to be treated as a team signal (Infinity > 0 is true).

For consistency with other numeric validations in this file (lines 483, 487), consider using Number.isFinite():

 const isTeamAccount = (
   normalizedPlanName === "team" ||
   (su && su.limitType === "team") ||
-  (su && typeof su.pooledLimit === "number" && su.pooledLimit > 0)
+  (su && Number.isFinite(su.pooledLimit) && su.pooledLimit > 0)
 )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/cursor/plugin.js` around lines 595 - 599, The team-account detection
allows Infinity to count as a pooledLimit; update the pooledLimit check in the
isTeamAccount expression to use Number.isFinite for consistency with other
numeric validations (replace the typeof su.pooledLimit === "number" check with
Number.isFinite(su.pooledLimit) and keep the > 0 check). Locate the
isTeamAccount boolean where normalizedPlanName, su, and pooledLimit are
referenced and change that part to use Number.isFinite(su.pooledLimit) &&
su.pooledLimit > 0.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@plugins/cursor/plugin.js`:
- Around line 595-599: The team-account detection allows Infinity to count as a
pooledLimit; update the pooledLimit check in the isTeamAccount expression to use
Number.isFinite for consistency with other numeric validations (replace the
typeof su.pooledLimit === "number" check with Number.isFinite(su.pooledLimit)
and keep the > 0 check). Locate the isTeamAccount boolean where
normalizedPlanName, su, and pooledLimit are referenced and change that part to
use Number.isFinite(su.pooledLimit) && su.pooledLimit > 0.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b3f9778-5929-4b74-a680-c7a3adb2b466

📥 Commits

Reviewing files that changed from the base of the PR and between 860a16b and 6b5f2e7.

📒 Files selected for processing (3)
  • docs/providers/cursor.md
  • plugins/cursor/plugin.js
  • plugins/cursor/plugin.test.js

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@rohithgoud30 rohithgoud30 force-pushed the fix/cursor-free-account branch from 6b5f2e7 to 219c4b8 Compare June 3, 2026 03:00
Copy link
Copy Markdown
Owner

@robinebers robinebers left a comment

Choose a reason for hiding this comment

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

Great, this LGTM. Thank you.

@robinebers robinebers merged commit ae0e810 into robinebers:main Jun 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Openusage doesn't connect to Cursor FREE account

2 participants