fix(cursor): handle free account pooled limit#544
Conversation
📝 WalkthroughWalkthroughTeam account detection now requires ChangesTeam account detection threshold
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugins/cursor/plugin.js (1)
595-599: 💤 Low valueConsider using
Number.isFinite()for consistency.The fix correctly prevents
pooledLimit: 0from triggering team account detection. However, the current check allowsInfinityto be treated as a team signal (Infinity > 0istrue).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
📒 Files selected for processing (3)
docs/providers/cursor.mdplugins/cursor/plugin.jsplugins/cursor/plugin.test.js
6b5f2e7 to
219c4b8
Compare
robinebers
left a comment
There was a problem hiding this comment.
Great, this LGTM. Thank you.
Description
Fixes Cursor free accounts that return
spendLimitUsage.pooledLimit: 0.OpenUsage was treating any numeric
pooledLimitas a team account signal. For free accounts, Cursor can includepooledLimit: 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: TeamandlimitType: team, but only treatspooledLimitas a team signal when it is greater than0.Related Issue
Fixes #529
Type of Change
Testing
bun run buildand it succeededbun run testand all tests passbun run test -- plugins/cursor/plugin.test.jsand all tests passScreenshots
Checklist
mainbranchSummary by cubic
Fix team detection in the Cursor provider so free accounts with
spendLimitUsage.pooledLimit: 0are treated as individual accounts, avoiding the REST fallback and missing usage data. Restores correct percent-only usage for free plans.pooledLimitas a team signal only when greater than0; keepplanName: TeamandlimitType: teamchecks.pooledLimitis0, and update docs to reflect the rule.Written for commit 219c4b8. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Documentation
Tests