Concurrency self serve
For Cloud this allows you to add concurrency to your environments by purchasing the add-on and then allocating concurrency.
It also adds a project limit (default 10) to organizations.
⚠️ No Changeset found
Latest commit: d2be4b21b2fbd5b28944828b19347a9a2bd7605c
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Walkthrough
Adds end-to-end concurrency management: new UI components (ConcurrencyIcon, InputNumberStepper), SideMenu entry and path builder, a full Remix concurrency route with loader/action, ManageConcurrencyPresenter, AllocateConcurrencyService and SetConcurrencyAddOnService, platform helpers for per-environment defaults and billing integration, updates to concurrency calculations in background worker and task triggers, toast/feedback URL integration, Prisma schema/migration adding Organization.maximumProjectCount with project-limit enforcement, storybook examples, and multiple supporting type and prop changes across models, services, presenters, and routes.
Estimated code review effort
🎯 5 (Critical) | ⏱️ ~120 minutes
Areas requiring extra attention:
- ManageConcurrencyPresenter.server.ts — plan limits, environment filtering, aggregation, and error paths
- routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.concurrency/route.tsx — loader/action, zod schemas, allocation UI and modal flows, redirect/error messaging
- v3 services: allocateConcurrency.server.ts and setConcurrencyAddOn.server.ts — validation, DB updates, side effects (updateEnvConcurrencyLimits), billing and email branches
- services/platform.v3.server.ts — getDefaultEnvironmentConcurrencyLimit, setConcurrencyAddOn, setPlan tryCatch/result handling and runtime-aware defaults
- Database migration and prisma schema change for maximumProjectCount and related project creation guard (ExceededProjectLimitError)
- models/project.server.ts and models/organization.server.ts — project count enforcement and per-environment limit wiring
- UI integrations: Toast.tsx Action handling, Feedback.tsx URL-driven open behavior and new onOpenChange prop, InputNumberStepper rounding/commit semantics and accessibility
- Path/routing changes: pathBuilder.concurrencyPath, SideMenu wiring, removed redirect route — verify links and redirects
- Concurrency calculations updated in createBackgroundWorker.server.ts and triggerTaskV1.server.ts — ensure runtime effects and clamping logic are correct
- Storybook additions and new input variants — ensure examples and variant styling match component APIs
Pre-merge checks and finishing touches
❌ Failed checks (1 warning, 1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
| Description check | ❓ Inconclusive | The PR description provides a clear explanation of the changes (concurrency self-serve with screenshot and project limit) but does not follow the required template structure with checklist, testing, and changelog sections. | Follow the repository's PR template by including the required checklist, testing steps, changelog section, and other template elements to ensure consistency and completeness. |
✅ Passed checks (1 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The PR title 'Concurrency self serve' accurately reflects the main objective of enabling self-serve concurrency management for Cloud environments and organization project limits. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
concurrency-self-serve
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 6ab5a07b78b6da35cb30967e1881c0c15edf448c and d2be4b21b2fbd5b28944828b19347a9a2bd7605c.
⛔ Files ignored due to path filters (1)
-
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
-
apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.billing/route.tsx(2 hunks) -
apps/webapp/app/routes/_app.orgs.$organizationSlug_.select-plan/route.tsx(2 hunks) -
apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx(9 hunks) -
apps/webapp/package.json(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/webapp/package.json
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 2681
File: apps/webapp/app/services/platform.v3.server.ts:258-302
Timestamp: 2025-11-14T16:03:06.917Z
Learning: In `apps/webapp/app/services/platform.v3.server.ts`, the `getDefaultEnvironmentConcurrencyLimit` function intentionally throws an error (rather than falling back to org.maximumConcurrencyLimit) when the billing client returns undefined plan limits. This fail-fast behavior prevents users from receiving more concurrency than their plan entitles them to. The org.maximumConcurrencyLimit fallback is only for self-hosted deployments where no billing client exists.
🧬 Code graph analysis (1)
apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx (5)
apps/webapp/app/services/platform.v3.server.ts (1)
setPlan(339-400)apps/webapp/app/utils/numberFormatter.ts (1)
formatCurrency(25-27)apps/webapp/app/components/DefinitionTooltip.tsx (1)
DefinitionTip(5-33)apps/webapp/app/components/primitives/Paragraph.tsx (1)
Paragraph(88-107)apps/webapp/app/components/environments/EnvironmentLabel.tsx (1)
EnvironmentLabel(70-126)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
- GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
- GitHub Check: typecheck / typecheck
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (7)
apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.billing/route.tsx (1)
86-86: LGTM! Clean integration of concurrency addon pricing.The destructuring of
addOnPricingfrom loader data and passingaddOnPricing.concurrencyto thePricingPlanscomponent correctly wires through the new concurrency addon pricing feature to the billing settings UI.Also applies to: 145-145
apps/webapp/app/routes/_app.orgs.$organizationSlug_.select-plan/route.tsx (1)
48-48: LGTM! Consistent prop wiring.The addition of
addOnPricingand passing it toPricingPlansmirrors the implementation in the billing settings route, maintaining consistency across the codebase.Also applies to: 60-60
apps/webapp/app/routes/resources.orgs.$organizationSlug.select-plan.tsx (5)
14-14: LGTM! Necessary imports for concurrency addon pricing.The new imports (
AddOnPricing,formatCurrency,EnvironmentLabel) are all properly utilized throughout the file to support the concurrency addon pricing feature.Also applies to: 49-50
159-161: Minor improvement: Explicit await for better error context.Adding
awaitbeforesetPlanmakes the asynchronous flow more explicit and can provide slightly better stack traces for debugging. While functionally equivalent to returning the Promise directly, this is a minor improvement in code clarity.
232-232: LGTM! Type-safe prop threading.The addition of
concurrencyAddOnPricingtoPricingPlansPropsand its propagation toTierPromaintains type safety through the component hierarchy. This public API change correctly enables rendering of dynamic concurrency addon pricing in the Pro tier.Also applies to: 242-242, 265-270
761-764: LGTM! Dynamic pricing string correctly computed.The dynamic pricing string correctly converts
centsPerStepto dollars (/ 100) and usesformatCurrencywith rounding enabled for clean display. This replaces the previous static content with data-driven addon pricing information.
982-1017: Excellent UX enhancement with per-environment breakdown!The enhanced tooltip content provides clear visibility into concurrency limits for each environment (PRODUCTION, STAGING, PREVIEW, DEVELOPMENT). Using
EnvironmentLabelfor consistent rendering and showing the expandable "+" indicator whencanExceedis true gives users a comprehensive understanding of their concurrency allocation.
[!TIP]
📝 Customizable high-level summaries are now available in beta!
You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
- Provide your own instructions using the
high_level_summary_instructionssetting.- Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
- Use
high_level_summary_in_walkthroughto move the summary from the description to the walkthrough section.Example instruction:
"Divide the high-level summary into five sections:
- 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
- 📓 References — List relevant issues, discussions, documentation, or related PRs.
- 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
- 📊 Contributor Summary — Include a Markdown table showing contributions:
| Contributor | Lines Added | Lines Removed | Files Changed |- ✔️ Additional Notes — Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.