Skip to content

feat(build): enforce concurrent native build limits with upgrade UX#2739

Merged
riderx merged 8 commits into
mainfrom
cursor/native-build-concurrency-ux-e3cb
Jul 23, 2026
Merged

feat(build): enforce concurrent native build limits with upgrade UX#2739
riderx merged 8 commits into
mainfrom
cursor/native-build-concurrency-ux-e3cb

Conversation

@riderx

@riderx riderx commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary (AI generated)

  • Improve native build concurrency enforcement with a clear customer-facing 429 that includes active build count, plan limit, plan name, and an upgrade URL.
  • Fail early on /build/request (before upload/job creation) and keep transactional enforcement on /build/start.
  • Persist concurrency failures on the build row so the dashboard shows the error + Upgrade CTA.
  • Update the Capgo CLI to print the upgrade message and open the plans page.
  • Emit Bento event user:native_build_concurrency_limit (preference usage_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:

Native build concurrency upgrade CTA

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.ts
  • Lint / typecheck
  • CI unit, DB, backend (both shards), Cloudflare (both shards), CLI suite (on prior green run)
  • CodeRabbit review comments addressed and resolved
  • Wire Bento automation for user:native_build_concurrency_limit when email is ready

Generated with AI

Open in Web Open in Cursor 

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added native build concurrency protection to prevent builds from exceeding plan limits.
    • Added clear error messages with current limits and direct links to upgrade plans.
    • Added upgrade actions in build error dialogs and build tables.
    • Builds blocked by concurrency limits now fail cleanly and provide actionable guidance.
  • Documentation

    • Updated usage-limit alert setup guidance to include native build concurrency notifications.

cursoragent and others added 2 commits July 23, 2026 14:48
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>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5d1482b2-a7c6-4672-ad51-fb32f3d3c746

📥 Commits

Reviewing files that changed from the base of the PR and between d56c130 and 0b3da5c.

📒 Files selected for processing (6)
  • cli/src/build/request.ts
  • docs/BENTO_EMAIL_PREFERENCES_SETUP.md
  • src/components/tables/BuildTable.vue
  • supabase/functions/_backend/public/build/concurrency.ts
  • tests/build-start-log-token.test.ts
  • tests/native-build-concurrency.unit.test.ts
📝 Walkthrough

Walkthrough

Native 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.

Changes

Native build concurrency flow

Layer / File(s) Summary
Centralized concurrency state and enforcement
supabase/functions/_backend/public/build/concurrency.ts, tests/native-build-concurrency.unit.test.ts
Adds shared concurrency state, plan-limit checks, upgrade URL and error helpers, telemetry notifications, request prechecks, and standardized reservation failures with expanded coverage.
Build request and startup integration
supabase/functions/_backend/public/build/request.ts, supabase/functions/_backend/public/build/start.ts, tests/build-request-plan-gate.unit.test.ts, tests/build-start-log-token.test.ts
Checks concurrency before builder job creation, includes upgrade metadata in plan errors, and marks builds failed when startup reservation reaches the concurrency limit.
CLI and web upgrade actions
cli/src/build/request.ts, src/components/tables/BuildTable.vue, docs/BENTO_EMAIL_PREFERENCES_SETUP.md
Parses and surfaces 429 upgrade errors in the CLI, adds plan navigation in build error UI, and documents the native-build concurrency Bento event.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested labels: codex

Suggested reviewers: wcaleniewolny

🚥 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
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: enforcing native build concurrency limits with upgrade UX.
Description check ✅ Passed The description covers summary, motivation, impact, visuals, and test plan, but it omits the template's Checklist section.

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

@codspeed-hq

codspeed-hq Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing cursor/native-build-concurrency-ux-e3cb (0b3da5c) with main (42b818a)2

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (7e18610) during the generation of this report, so 42b818a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
@cursor
cursor Bot temporarily deployed to deepsec-pr July 23, 2026 14:51 Inactive
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
@cursor
cursor Bot temporarily deployed to deepsec-pr July 23, 2026 15:00 Inactive
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
@cursor
cursor Bot temporarily deployed to deepsec-pr July 23, 2026 15:15 Inactive
@cursor
cursor Bot marked this pull request as ready for review July 23, 2026 15:32
@cursor

cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@cursor
cursor Bot requested a review from Dalanir July 23, 2026 15:33

@cursor cursor 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.

Stale comment

Risk: medium. Not approving: Cursor Bugbot was skipped (usage limit) and did not complete analysis. Human review is needed before merge.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver

@cursor
cursor Bot requested a review from WcaleNieWolny July 23, 2026 15:33
@coderabbitai coderabbitai Bot added the codex label Jul 23, 2026

@cursor cursor 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.

Stale comment

Risk: high. 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; reviewers assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver External

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7e18610 and d56c130.

📒 Files selected for processing (9)
  • cli/src/build/request.ts
  • docs/BENTO_EMAIL_PREFERENCES_SETUP.md
  • src/components/tables/BuildTable.vue
  • supabase/functions/_backend/public/build/concurrency.ts
  • supabase/functions/_backend/public/build/request.ts
  • supabase/functions/_backend/public/build/start.ts
  • tests/build-request-plan-gate.unit.test.ts
  • tests/build-start-log-token.test.ts
  • tests/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)

Comment thread cli/src/build/request.ts
Comment thread docs/BENTO_EMAIL_PREFERENCES_SETUP.md
Comment thread src/components/tables/BuildTable.vue Outdated
Comment thread src/components/tables/BuildTable.vue
Comment thread supabase/functions/_backend/public/build/concurrency.ts
Comment thread supabase/functions/_backend/public/build/concurrency.ts
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>
@cursor
cursor Bot temporarily deployed to deepsec-pr July 23, 2026 15:45 Inactive
@cursor

cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@cursor cursor 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.

Stale comment

Risk: medium. Not approving: Cursor Bugbot was skipped due to usage limits and did not complete analysis. Human reviewers (Dalanir, WcaleNieWolny) are already assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver

@cursor cursor 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.

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.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver External

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tests/native-build-concurrency.unit.test.ts
Comment thread tests/build-start-log-token.test.ts
Comment thread src/components/tables/BuildTable.vue
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
@cursor
cursor Bot deployed to deepsec-pr July 23, 2026 15:50 Active
@cursor

cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@cursor cursor 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.

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.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver External

@cursor cursor 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.

Risk: medium. Not approving: Cursor Bugbot was skipped (usage limit) and did not complete analysis. Human reviewers (Dalanir, WcaleNieWolny) are already assigned and the PR has human approval.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver

@sonarqubecloud

Copy link
Copy Markdown

@riderx
riderx merged commit 0dbea29 into main Jul 23, 2026
43 of 44 checks passed
@riderx
riderx deleted the cursor/native-build-concurrency-ux-e3cb branch July 23, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants