diff --git a/src/renderer/src/components/billing/plans/PlansView.tsx b/src/renderer/src/components/billing/plans/PlansView.tsx
index dee2a120e06..b92fd2d40e2 100644
--- a/src/renderer/src/components/billing/plans/PlansView.tsx
+++ b/src/renderer/src/components/billing/plans/PlansView.tsx
@@ -306,8 +306,11 @@ export function PlansView(props: PlansViewProps): React.JSX.Element {
{t(
- 'auto.components.billing.plans.footHours3',
- 'Hours reset every month, including on annual plans.'
+ 'auto.components.billing.plans.footHours4',
+ 'Hours reset every month, including on annual plans. Each seat can run {{value0}} sandboxes at once.',
+ // The cap is enforced by the control plane; the fine print states it before anyone
+ // reaches the limit card, while the Team card keeps to the marketing bullets.
+ { value0: String(offers.team.concurrentSandboxesPerSeat) }
)}
diff --git a/src/renderer/src/components/cloud-workspaces/cloud-workspace-errors.ts b/src/renderer/src/components/cloud-workspaces/cloud-workspace-errors.ts
index 8af2d1638aa..46394567b9e 100644
--- a/src/renderer/src/components/cloud-workspaces/cloud-workspace-errors.ts
+++ b/src/renderer/src/components/cloud-workspaces/cloud-workspace-errors.ts
@@ -1,6 +1,8 @@
// Copy for control-plane error codes from the team workspace registry.
import { translate } from '@/i18n/i18n'
import type { Translate } from '@/i18n/use-translate'
+import { getLastBillingStatus } from '@/components/billing/billing-summary-store'
+import { sandboxLimitFromBilling } from '@/components/worktree-creation/vm-build-failure-copy'
export function describeError(error: string, reason?: string, t: Translate = translate): string {
if (error === 'not_found') {
@@ -10,10 +12,23 @@ export function describeError(error: string, reason?: string, t: Translate = tra
)
}
if (error === 'entitlement_denied') {
- return reason === 'concurrency_limit'
+ if (reason === 'concurrency_limit') {
+ const limit = sandboxLimitFromBilling(getLastBillingStatus())
+ return limit
+ ? t(
+ 'auto.components.cloudWorkspaces.errorConcurrencyLimitCount',
+ "You're at your team's limit: your team can run {{value0}} sandboxes at once ({{value1}} per seat). Put one to sleep or delete it, then try again.",
+ { value0: String(limit.team), value1: String(limit.perSeat) }
+ )
+ : t(
+ 'auto.components.cloudWorkspaces.errorConcurrencyLimit',
+ "You're at your team's limit of running sandboxes. Put one to sleep or delete it, then try again."
+ )
+ }
+ return reason === 'member_concurrency_limit'
? t(
- 'auto.components.cloudWorkspaces.errorConcurrencyLimit',
- "You're at your team's limit of running sandboxes. Put one to sleep or delete it, then try again."
+ 'auto.components.cloudWorkspaces.errorMemberConcurrencyLimit',
+ "You're at your limit of running sandboxes. Put one to sleep or delete it, then try again."
)
: t(
'auto.components.cloudWorkspaces.errorEntitlementDenied',
diff --git a/src/renderer/src/components/worktree-creation/VmBuildFailureCard.tsx b/src/renderer/src/components/worktree-creation/VmBuildFailureCard.tsx
index 3b34cc9768a..fd5245ced1b 100644
--- a/src/renderer/src/components/worktree-creation/VmBuildFailureCard.tsx
+++ b/src/renderer/src/components/worktree-creation/VmBuildFailureCard.tsx
@@ -3,7 +3,8 @@ import { cn } from '@/lib/utils'
import { useTranslate } from '@/i18n/use-translate'
import { VmBuildReveal } from './VmBuildReveal'
import { isAccountGate, type VmBuildFailure } from './vm-build-failure'
-import { vmBuildFailureCopy } from './vm-build-failure-copy'
+import { getLastBillingStatus } from '@/components/billing/billing-summary-store'
+import { sandboxLimitFromBilling, vmBuildFailureCopy } from './vm-build-failure-copy'
import { FailureActionRow, type VmBuildFailureActions } from './VmBuildFailureActions'
import { CheckRow } from './VmBuildCheckRow'
@@ -54,7 +55,16 @@ export function VmBuildFailureCard({
}
const visible = failure ?? shown
const copy = visible
- ? vmBuildFailureCopy(visible, { cloud, canManageBilling, repoName }, t)
+ ? vmBuildFailureCopy(
+ visible,
+ {
+ cloud,
+ canManageBilling,
+ repoName,
+ sandboxLimit: sandboxLimitFromBilling(getLastBillingStatus())
+ },
+ t
+ )
: null
const headingRef = React.useRef(null)
const cardRef = React.useRef(null)
diff --git a/src/renderer/src/components/worktree-creation/vm-build-failure-copy.ts b/src/renderer/src/components/worktree-creation/vm-build-failure-copy.ts
index 35f65e34928..f9ecc31b8a2 100644
--- a/src/renderer/src/components/worktree-creation/vm-build-failure-copy.ts
+++ b/src/renderer/src/components/worktree-creation/vm-build-failure-copy.ts
@@ -1,18 +1,38 @@
import type { Translate } from '@/i18n/use-translate'
+import type { OrcaBillingStatusResult } from '../../../../shared/orca-billing'
import type { VmBuildFailure } from './vm-build-failure'
+/** The running-sandbox caps billing enforces: per member, and per team (per seat × seats). */
+export type SandboxLimit = { perSeat: number; team: number }
+
+/** Mirrors billing's checkStart limits; null until the plan has loaded. */
+export function sandboxLimitFromBilling(
+ status: OrcaBillingStatusResult | null
+): SandboxLimit | null {
+ if (status?.status !== 'ok') {
+ return null
+ }
+ const perSeat = status.entitlement.offers?.team.concurrentSandboxesPerSeat
+ if (!perSeat) {
+ return null
+ }
+ return { perSeat, team: perSeat * Math.max(1, status.entitlement.seats) }
+}
+
export type VmBuildFailureCopyContext = {
cloud: boolean
/** How the user knows the repository: its GitHub owner/name, else its name in Orca. */
repoName: string
/** False for team members who can't change billing; they are told to ask an owner or admin. */
canManageBilling: boolean
+ /** States the cap on the limit cards; omitted or null falls back to copy without numbers. */
+ sandboxLimit?: SandboxLimit | null
}
/** The card's cause-specific title and one plain-language sentence on what to do next. */
export function vmBuildFailureCopy(
failure: VmBuildFailure,
- { cloud, canManageBilling, repoName }: VmBuildFailureCopyContext,
+ { cloud, canManageBilling, repoName, sandboxLimit }: VmBuildFailureCopyContext,
t: Translate
): { title: string; body: string | null } {
switch (failure.kind) {
@@ -104,10 +124,16 @@ export function vmBuildFailureCopy(
'auto.components.worktree.creation.VmBuildFailureCard.teamLimitTitle',
'You’re at your team’s limit of running sandboxes'
),
- body: t(
- 'auto.components.worktree.creation.VmBuildFailureCard.limitBody',
- 'Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.'
- )
+ body: sandboxLimit
+ ? t(
+ 'auto.components.worktree.creation.VmBuildFailureCard.teamLimitBody',
+ 'Your team can run {{value0}} sandboxes at once ({{value1}} per seat). Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.',
+ { value0: String(sandboxLimit.team), value1: String(sandboxLimit.perSeat) }
+ )
+ : t(
+ 'auto.components.worktree.creation.VmBuildFailureCard.limitBody',
+ 'Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.'
+ )
}
case 'memberConcurrency':
return {
@@ -115,10 +141,16 @@ export function vmBuildFailureCopy(
'auto.components.worktree.creation.VmBuildFailureCard.memberLimitTitle',
'You’re at your limit of running sandboxes'
),
- body: t(
- 'auto.components.worktree.creation.VmBuildFailureCard.limitBody',
- 'Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.'
- )
+ body: sandboxLimit
+ ? t(
+ 'auto.components.worktree.creation.VmBuildFailureCard.memberLimitBody',
+ 'Each person can run {{value0}} sandboxes at once. Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.',
+ { value0: String(sandboxLimit.perSeat) }
+ )
+ : t(
+ 'auto.components.worktree.creation.VmBuildFailureCard.limitBody',
+ 'Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.'
+ )
}
case 'githubNotConnected':
return {
diff --git a/src/renderer/src/components/worktree-creation/vm-build-failure-toast.ts b/src/renderer/src/components/worktree-creation/vm-build-failure-toast.ts
index 2651fff4057..993a1f3c61b 100644
--- a/src/renderer/src/components/worktree-creation/vm-build-failure-toast.ts
+++ b/src/renderer/src/components/worktree-creation/vm-build-failure-toast.ts
@@ -4,7 +4,8 @@ import type { Translate } from '@/i18n/use-translate'
import { openPlansPage } from '@/components/billing/plans/plans-page-store'
import type { PendingWorktreeCreation } from '@/lib/workspace/creation/pending-worktree-creation'
import { classifyVmBuildFailure, type VmBuildFailure } from './vm-build-failure'
-import { vmBuildFailureCopy } from './vm-build-failure-copy'
+import { getLastBillingStatus } from '@/components/billing/billing-summary-store'
+import { sandboxLimitFromBilling, vmBuildFailureCopy } from './vm-build-failure-copy'
import { isOrcaCloudBuild } from './vm-build-steps'
import { orcaCloudRepoName } from './vm-build-repo-actions'
import type { Repo } from '../../../../shared/repo-types'
@@ -26,7 +27,11 @@ export function vmBuildFailureSummary(
recipe ? repos.find((repo) => repo.id === recipe.sourceRepoId) : undefined
)
// Unknown here; the card itself refines the copy for members once billing status loads.
- return { failure, ...vmBuildFailureCopy(failure, { cloud, canManageBilling: true, repoName }, t) }
+ const sandboxLimit = sandboxLimitFromBilling(getLastBillingStatus())
+ return {
+ failure,
+ ...vmBuildFailureCopy(failure, { cloud, canManageBilling: true, repoName, sandboxLimit }, t)
+ }
}
/** The build sheet's card as a toast, for a VM build that failed while its sheet was off screen. */
diff --git a/src/renderer/src/components/worktree-creation/vm-build-failure.test.ts b/src/renderer/src/components/worktree-creation/vm-build-failure.test.ts
index 849a60a64c3..55c7f3b7dc0 100644
--- a/src/renderer/src/components/worktree-creation/vm-build-failure.test.ts
+++ b/src/renderer/src/components/worktree-creation/vm-build-failure.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import { classifyVmBuildFailure, isAccountGate, type VmBuildFailure } from './vm-build-failure'
-import { vmBuildFailureCopy } from './vm-build-failure-copy'
+import { sandboxLimitFromBilling, vmBuildFailureCopy } from './vm-build-failure-copy'
import { orcaCloudRepoName } from './vm-build-repo-actions'
import type { Translate } from '@/i18n/use-translate'
@@ -104,6 +104,38 @@ describe('vmBuildFailureCopy', () => {
)
})
+ it('states the running-sandbox cap on the limit cards once the plan is known', () => {
+ const copy = (kind: VmBuildFailure, sandboxLimit: { perSeat: number; team: number } | null) =>
+ vmBuildFailureCopy(
+ kind,
+ { cloud: true, canManageBilling: true, repoName: 'acme/web', sandboxLimit },
+ t
+ ).body
+ expect(copy({ kind: 'concurrency' }, { perSeat: 3, team: 12 })).toContain(
+ 'Your team can run 12 sandboxes at once (3 per seat). Put one to sleep or delete it'
+ )
+ expect(copy({ kind: 'memberConcurrency' }, { perSeat: 3, team: 12 })).toContain(
+ 'Each person can run 3 sandboxes at once. Put one to sleep or delete it'
+ )
+ expect(copy({ kind: 'concurrency' }, null)).toMatch(/^Put one to sleep or delete it/)
+ })
+
+ it('derives the caps the way billing enforces them', () => {
+ const status = (seats: number, perSeat: number | null) =>
+ ({
+ status: 'ok',
+ entitlement: {
+ seats,
+ offers: perSeat === null ? null : { team: { concurrentSandboxesPerSeat: perSeat } }
+ }
+ }) as unknown as Parameters[0]
+ expect(sandboxLimitFromBilling(status(4, 3))).toEqual({ perSeat: 3, team: 12 })
+ // Billing counts at least one seat.
+ expect(sandboxLimitFromBilling(status(0, 3))).toEqual({ perSeat: 3, team: 3 })
+ expect(sandboxLimitFromBilling(status(4, null))).toBeNull()
+ expect(sandboxLimitFromBilling(null)).toBeNull()
+ })
+
it('names the repository GitHub needs to reach', () => {
const { title } = vmBuildFailureCopy(
{ kind: 'githubNotConnected' },
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index 2b97fc9d63e..1182ccaade2 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -4108,6 +4108,8 @@
"paymentFailedBodyMember": "New sandboxes can’t start until the payment goes through. Ask an owner or admin to update the payment method. Nothing was created, and you weren’t charged.",
"teamLimitTitle": "You’re at your team’s limit of running sandboxes",
"limitBody": "Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.",
+ "teamLimitBody": "Your team can run {{value0}} sandboxes at once ({{value1}} per seat). Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.",
+ "memberLimitBody": "Each person can run {{value0}} sandboxes at once. Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.",
"memberLimitTitle": "You’re at your limit of running sandboxes",
"githubNotConnectedTitle": "GitHub isn’t connected for {{repo}}",
"githubNotConnectedBody": "Orca Cloud clones your code from GitHub and needs access to this repository first. Connect GitHub, then try again. Nothing was created, and you weren’t charged.",
@@ -20540,7 +20542,7 @@
"vpSecretsTitle3": "API keys stay out of the sandbox",
"billedYearlyAmount2": "{{value0}} per seat, billed yearly",
"entPriced2": "Priced for your team",
- "footHours3": "Hours reset every month, including on annual plans.",
+ "footHours4": "Hours reset every month, including on annual plans. Each seat can run {{value0}} sandboxes at once.",
"perSeatPerMonth": "per seat per month",
"seatsPerMember_one": "{{count}} seat, one per team member",
"seatsPerMember_other": "{{count}} seats, one per team member",
@@ -20676,6 +20678,8 @@
"emptyTeamTitle": "No team workspaces yet",
"environmentName": "{{value0}} (cloud)",
"errorConcurrencyLimit": "You're at your team's limit of running sandboxes. Put one to sleep or delete it, then try again.",
+ "errorConcurrencyLimitCount": "You're at your team's limit: your team can run {{value0}} sandboxes at once ({{value1}} per seat). Put one to sleep or delete it, then try again.",
+ "errorMemberConcurrencyLimit": "You're at your limit of running sandboxes. Put one to sleep or delete it, then try again.",
"errorConflict": "This workspace is still starting or going to sleep. Nothing was changed. Try again in a moment.",
"errorConflictInline": "This workspace is still starting or going to sleep. Nothing was changed.",
"errorEntitlementDenied": "Your team's plan can't start this workspace right now. Your files are safe. Ask an owner or admin to check the plan.",