feat(build): enforce concurrent native build limits with upgrade UX#2739
Conversation
Enforce plan concurrent-build limits with a clear customer error, upgrade link, dashboard failed-build persistence, CLI handling, and a Bento event for follow-up email automations. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 19 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughNative build concurrency enforcement is centralized across backend request and startup flows, with standardized 429 errors, upgrade URLs, telemetry, CLI handling, web upgrade navigation, tests, and Bento event documentation. ChangesNative build concurrency flow
Estimated code review effort: 4 (Complex) | ~60 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_5b344ee4-2e3f-4089-aa15-60d9c02ea5c7) |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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.
Inline comments:
In `@cli/src/build/request.ts`:
- Around line 230-266: Update throwIfBuildPlanLimitError to await the dynamic
import and browser-opening call, while preserving the existing catch that
ignores open failures. Remove reliance on the trailing wait as synchronization
so the upgrade URL opening completes before the function waits and throws.
In `@docs/BENTO_EMAIL_PREFERENCES_SETUP.md`:
- Around line 49-52: Update the “Filter to add” section in
BENTO_EMAIL_PREFERENCES_SETUP.md by inserting a blank line between the heading
text and the fenced code block, keeping the filter content unchanged.
In `@src/components/tables/BuildTable.vue`:
- Around line 196-201: Rename isNativeBuildConcurrencyError to reflect that it
also classifies plan-upgrade errors, such as isPlanUpgradeError, and update all
call sites accordingly; or remove the /settings/organization/plans match if only
native-build concurrency errors should be recognized.
- Around line 396-402: Add an explicit non-submitting type attribute to the
button rendered when isNativeBuildConcurrencyError(element.last_error) in
BuildTable, preserving its existing click navigation behavior.
In `@supabase/functions/_backend/public/build/concurrency.ts`:
- Around line 183-206: Verify that build_requests has an index supporting the
owner_org and active-status filtering used by countActiveNativeBuilds and the
related UPDATE query. If no suitable index exists, add the appropriate
migration/index and ensure both query paths can use it without changing their
behavior.
- Around line 212-245: Update assertNativeBuildConcurrencyAvailable to obtain
its PostgreSQL client with the read-only option enabled by passing true to
getPgClient(c). Keep reserveNativeBuildSlot and the existing transaction path
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5c702a2e-b283-4afc-ba5e-04614eb44ec6
📒 Files selected for processing (9)
cli/src/build/request.tsdocs/BENTO_EMAIL_PREFERENCES_SETUP.mdsrc/components/tables/BuildTable.vuesupabase/functions/_backend/public/build/concurrency.tssupabase/functions/_backend/public/build/request.tssupabase/functions/_backend/public/build/start.tstests/build-request-plan-gate.unit.test.tstests/build-start-log-token.test.tstests/native-build-concurrency.unit.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Cap-go/capacitor-updater(manual)
Await CLI upgrade-URL open, clarify plan-upgrade dashboard classifier, mark Upgrade button type=button, document org index for active-build counts, and use a read-only PG client for the request precheck. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_29ba99e4-decd-4868-87fd-f078d84cfba4) |
There was a problem hiding this comment.
Stale comment
Risk: high. Not approving: Cursor Bugbot did not complete (check skipped due to usage limit), so automated review is unavailable for this billing-sensitive build concurrency change. Human review is required; two reviewers are already assigned.
Sent by Cursor Approval Agent: Pull Request Approver External
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_ba660644-305e-4cb3-9002-1f0d38675df0) |
There was a problem hiding this comment.
Risk: high. Not approving: Cursor Bugbot did not complete (check skipped due to usage limit), so automated review is unavailable for this billing-sensitive build concurrency change. Human review is required; two reviewers are already assigned.
Sent by Cursor Approval Agent: Pull Request Approver External
|





Summary (AI generated)
/build/request(before upload/job creation) and keep transactional enforcement on/build/start.user:native_build_concurrency_limit(preferenceusage_limit) for a later upgrade email automation.Motivation (AI generated)
Pricing advertises concurrent native builds per plan, and the backend already had a hard gate at start time, but customers got a generic rate-limit style failure with no upgrade path, no dashboard persistence, no CLI guidance, and no Bento hook for follow-up email.
Business Impact (AI generated)
Protects builder capacity according to paid tiers while converting blocked builds into upgrade opportunities via CLI, dashboard, and a Bento-ready email event.
Visual changes (AI generated)
Dashboard build error row/dialog now exposes an Upgrade CTA when the failure is a plan/concurrency limit:
Test Plan (AI generated)
bunx vitest run tests/native-build-concurrency.unit.test.ts tests/build-request-plan-gate.unit.test.ts tests/build-start-log-token.test.tsuser:native_build_concurrency_limitwhen email is readyGenerated with AI
Summary by CodeRabbit
New Features
Documentation