Repository navigation
fix(prompts): show an organization whose plan ended its own plan in Plan & usage, not Starter's - #1671
Merged
Conversation
…lan & usage, not Starter's Follow-up from the read-only browser check. /api/prompts/usage read the plan with planFromOrgRow, which gives an organization without an active subscription Starter's limits, so an ended Growth workspace's Plan & usage fold said "Starter plan · 25 of 50 on Starter · Upgrade to Growth". - plan-guard.ts: usagePlanFromOrgRow is the plan to show usage against. While the subscription is active or trialing it's planFromOrgRow's; once it has ended (cloud), the plan the row names, Enterprise overrides merged, marked ended. planFromOrgRow is unchanged for every other caller. - The summary's plan gets `ended: true` and the new cta `choose_plan` then (ended is left out otherwise, so other answers are as before). - The cards say "Growth plan · ended", 0 slots left, and "Your Growth plan has ended · Choose a plan", linking to the plan page as the other upgrades do. - The MCP's prompt usage read (getPromptUsageFor) reads it the same way. Only seen once an ended workspace can open the dashboard (the read-only web part, ansvisor#1599). The coach skills list plan.cta's values; they'll need choose_plan in their own docs PR. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd bulk import, and say so in get_prompt_usage Review follow-up. - locationQuotaFromUsage read only locationLimit, so with the plan ended the cards said 0 slots left while the Add Prompt dialog and bulk import still let 154 more in. An ended plan's quota now reads as full. - get_prompt_usage's description told the agent "Slots left = locationLimit − locationsUsed" with no word of plan.ended, so it would say an ended Growth plan had 154 left. It now names `ended` and the choose_plan cta, and says no slot is left until a plan is chosen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 28, 2026
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
What I checked:
- Own change. Two commits (10d7088, 8e2bc66) on 3f6a4d4. It merges cleanly on main (b591947) and with #1670, #1674 and #1675. With #1599 it has one small conflict, in
web/src/lib/mcp/data.ts's imports (#1599 addsassertSubscriptionActive, this addsusagePlanFromOrgRow): keep both lines. - The plan shown.
usagePlanFromOrgRowgives the plan the row names, Enterprise overrides merged, once the subscription is notactiveortrialingon cloud. Otherwise it'splanFromOrgRow, which is unchanged, so no limit or cost moves./api/prompts/usageand the MCP'sgetPromptUsageForboth read it, and the summary carriesended: trueandcta: 'choose_plan'only then. Other answers are as before.cta.choose_planis inen.json, and the link goes to the plan page like the other upgrades.
- Before the API deploy. Web only, so nothing waits on it. On main an ended workspace is still sent away from the Prompts page, so the new card text is only seen once #1599 lands. The MCP answer changes on merge.
- Tests. The three named files, the rest of
dashboard/prompts/andlib/mcppass at the head (143).
Follow-ups:
- The Add Prompt dialog and bulk import for an ended plan.
locationQuotaFromUsagesetsmaxPromptstoused, so both read as full, which is right. But their text then names that number as the plan's limit: "Your Growth plan tracks up to 46 active prompt locations and 46 are in use … Pause or remove prompts or locations to free a slot" (prompts/page.tsx:837), and the same inbulk-import-prompts.tsx:265. Pausing frees nothing here. PassingendedthroughLocationQuotaand showing "Your Growth plan has ended · Choose a plan" in both would match the card. This only shows once #1599 opens the page, so it can land with or right after #1599. - The Slots left card's color. For an ended plan it shows 0, but
tonecomes from the old limit's meter (46 of 200 is "normal"), so the 0 and the Choose a plan link stay in the normal color. Treatingendedasfullfortonewould match the "no slot left" message. - As the description says,
past_dueandunpaidalso read as ended here; one shared source with #1599'sreadOnlyReasonwould settle the wording.
This was referenced Oct 28, 2026
Merged
8 of 13 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Nov 6, 2026
…and choose_plan (#2214) The three coach-skill fixes #1808, #1694 and #1671 left for a docs PR, in the MCP skill and its standalone copy: - A brand needs a topic before any prompt: accept_prompt_suggestion is refused on a brand without one (#1808). The skill says so, and offers a topic suggestion first. - list_action_history reads an action 7, 14 and 30 days after it closed (#1694): reading_day and final are documented, and an outcome before day 30 is reported as a reading so far. The outcome list gains mixed. - get_prompt_usage marks an ended plan with plan.ended and the choose_plan cta (#1671): no slot is left until a plan is chosen. Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9 (cherry picked from commit 17b7ea8) Co-authored-by: Claude <[email protected]>
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.
Summary
Prompts › Plan & usage shows an organization whose plan ended its own plan, not Starter's.
Found in the read-only browser check (#1614).
/api/prompts/usageread the plan withplanFromOrgRow, which gives an organization without an active subscription Starter's limits. So an ended Growth workspace's Plan & usage fold said "Starter plan · 25 of 50 on Starter · Upgrade to Growth".usagePlanFromOrgRow(plan-guard.ts) picks the plan to show usage against:planFromOrgRow;ended.planFromOrgRowitself is unchanged, so limits and costs are untouched.ended: trueand a new cta,choose_plan. Other answers are as before.getPromptUsageFor) reads the plan the same way.Pre-push review fixes (8e2bc66):
locationQuotaFromUsagecounts an ended plan's quota as full, so the Add Prompt dialog and bulk import agree with the card that no slot is left.get_prompt_usage's description namesendedand thechoose_plancta, and says no slot is left until a plan is chosen. Before, an agent would say an ended Growth plan had 154 slots left.Checked in the browser (local, cloud mode, demo org set to Growth + canceled for the check, then restored):
/api/prompts/usageanswersplan: { key: 'growth', name: 'Growth plan', ended: true, cta: 'choose_plan' }. The page itself redirects an ended workspace on main; it opens once #1599 lands.Follow-ups:
past_dueandunpaidalso read as "ended" here. feat(web): let a workspace whose plan ended browse read-only, with one "Choose a plan" dialog #1599'sreadOnlyReasoncalls thempayment_failed("update your card"), so the two should share one source once feat(web): let a workspace whose plan ended browse read-only, with one "Choose a plan" dialog #1599 merges.plan.ctalist needschoose_plan, in a separate docs PR.Related issue
Follow-up from the read-only work (#1599, #1614).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd web && npx vitest run src/lib/guards/plan-guard.test.ts src/app/api/prompts/usage/route.test.ts "src/app/[locale]/(dashboard)/dashboard/prompts/_usage-cards.test.tsx"Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks were run in one tree with this batch's ten follow-up branches merged, and again after the review fixes:
npm test: 246 files, 3,343 tests passed;vitest: 447 files, 4,352 tests passed (after the review fixes).A pre-push review was run on all ten branches.
🤖 Generated with Claude Code