Repository navigation
Switch workspace and preselect the fitting plan on the trial wall - #1475
Merged
Merged
Conversation
The trial-ended wall now lists the user's other workspaces, so someone in several workspaces can leave an ended one for a paid one. The plan picker preselects the smallest plan the workspace fits in (Team past Starter's limits) and says which counts a plan does not cover. Licence usage counts users by active membership, not by primary workspace.
helpcodeai
enabled auto-merge (squash)
November 3, 2026 09:08
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Three problems on the Cloud trial-ended wall for people with more than one workspace.
No way to switch workspace. The wall covers the whole app, and the sidebar's workspace switcher sits behind it. Someone whose second workspace's trial ended could not get back to their paid one.
Wrong plan preselected. Starter was always preselected, even for a workspace already past Starter's limits.
Wrong user count.
GET /api/license/usagecounted users byUser.organizationId, i.e. the user's primary workspace. Members invited from another workspace were left out, and deactivated members were counted.The Stripe side (a second workspace sent to the first one's billing portal) is fixed on the site: HelpCode-ai/anythingmcp-website#488.
Changes
license-wall.tsx): with more than one workspace, the wall names the current workspace and lists the others under "Switch to another workspace". It is shown for every role and uses the existingswitchOrg.card-trial.ts,plan-picker.tsx,license-wall.tsx):CloudPlan.limitsgives Starter 5 connectors / 3 MCP servers / 1 user and Team 15 / 10 / 3.limitsExceeded,smallestFittingPlan,selectionForUsage,describeUsage./api/license/usageand preselects the smallest plan that fits, Team when nothing does. It keeps the billing period, and a plan the admin clicks is never moved afterwards.license-guard.service.ts):getUsagecounts users as activeorganizationMemberrows of the workspace (deactivatedAt: null).Type
Cloud and self-hosted
getUsagenow counts active members of the workspace, which on a single-tenant instance matches the seat count used elsewhere (countActiveSeats).Testing
Commands and results:
packages/backend:npx jest --maxWorkers=4 src/license src/adapters: 710 suites passed, 1 skipped (newgetUsagespec)packages/backend:npx tsc --noEmit -p tsconfig.json: clean (afternpx prisma generate)packages/frontend:npx tsc --noEmit -p tsconfig.json: cleanpackages/frontend: eslint on the changed files: 0 errors, 2set-state-in-effectwarnings that were already there before this changepackages/frontend:npx playwright test --workers=4: 330 passed. New tests cover the helpers, Team preselected with the "This workspace has…" note, the workspace switch posting/organizations/switch, and no switch with a single workspace.Checklist