fix(quota): honor trialing as Pro + surface desktop-limit errors to the user#2733
Merged
Merged
Conversation
Three related fixes around plan limits: 1. quota: a *trialing* subscription now grants Pro quotas. The quota path checked `SubscriptionStatus == active` exactly, but IsSubscriptionActive() (used everywhere else) counts trialing as active — so every trial org was silently throttled to Free limits (e.g. 2 concurrent desktops). Switch both the org and user paths to IsSubscriptionActive(). Regression test added. 2. surface limits: when a spec-task/desktop session can't start because the org is at its concurrent-desktop limit, the auto-wake cold-start path retried it as if transient and finally stamped the generic "agent never connected (#2397)" error — hiding the real cause. maybeKickColdStart now does a quota pre-check (gated on EnforceQuotas, mirroring checkLimits): if the org is at the desktop limit it marks the interaction errored immediately with a clear, actionable message instead of burning retries on a non-retryable limit. 3. admin UI: rename the "Activate Trial" action to "Activate" (menu item, dialog title, submit button) — it activates a plan, not just a trial. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Came out of a real prod incident: a find-ai spec task "failed" with the generic
#2397 agent never connected, but the actual cause was the org hitting its concurrent-desktop limit (2) — and it was on the free limit despite having an active trial.Three fixes:
1. Trialing subscriptions now get Pro quotas (the real bug)
The quota path decided Pro vs Free with
SubscriptionStatus == activeexactly, butIsSubscriptionActive()(used elsewhere) countstrialingas active. So every trial org was silently throttled to Free limits (2 desktops, etc.). Both org + user paths now useIsSubscriptionActive(). Regression test added (TestGetQuotas_UserTrialingGetsProQuotas).2. Surface the desktop-limit to the user (stop hiding it as #2397)
When a session can’t start because the org is at its concurrent-desktop limit, the auto-wake cold-start path retried it as transient and finally stamped the generic “agent never connected (#2397)” banner.
maybeKickColdStartnow does a quota pre-check (gated onEnforceQuotas, mirroringcheckLimits): at-limit → mark the interaction errored immediately with a clear, actionable message (Desktop limit reached (N). Stop a running desktop session, or raise your organizations concurrent-desktop limit, then retry.) — no wasted retries on a non-retryable limit.3. Rename "Activate Trial" → "Activate"
Admin users panel: menu item, dialog title, submit button. It activates a plan, not just a trial.
Testing
go test ./pkg/quota/green incl. the new trialing test;go build ./pkg/server/+ server test pkg compile;yarn buildclean.activebump I did on find-ai unnecessary going forward.🤖 Generated with Claude Code