Skip to content

Free usage-based trial: progress in Settings and a dialog once it's used up - #2112

Merged
davidmckayv merged 3 commits into
mainfrom
free-runs-screens
Nov 24, 2026
Merged

davidmckayv merged 3 commits into
mainfrom
free-runs-screens

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

OpenBot Cloud's free trial is now counted in runs, not days. This is the app side of it: people see how much of the trial they've used, and once it's gone they're told plainly, every time they try something that needs a Bot to run.

This branch is built on free-runs-spec (the OrganizationPlan fields status: free, freeRunsUsedPercent and freeRunsAllowance, and the regenerated client). Its two commits are in this branch, so merge that PR first and this one rebases clean.

What changes

Settings > Organization, Plan row. On the free trial it shows "Free trial" with a progress bar and "N% used". No count or limit is shown. Once paid it shows the plan and its renewal date. When a card is needed, admins get Add a card as before.

Trial-used-up dialog. One dialog for the whole app, mounted once in the signed-in layout next to the other app-wide dialogs, so every skin and the Desktop window get it. It names the size of the trial (the server only sends freeRunsAllowance once it's used up), says OpenBot is $5 a month for each member from here, and shows the same bar at 100%. Admins get one button to the payment page (addCardUrl). Members are told to ask an admin, with no button. It opens by itself once, for a person in an organization, when the plan read first says the trial is used up. The browser remembers this (localStorage, never throws), so a reload or Back from the payment page doesn't reopen it. After that it opens every time the person tries something that uses the AI. Closing it lasts until the next try. When it opens it reads the plan again, and closes by itself if a card has been added in the meantime. When a refusal opens it before that fresh read lands, the refusal's addCardUrl decides admin or member, so an admin never sees the member's line. The bar, the dialog's title and the server's refusal all begin "You've used your free trial."

How AI actions are caught

  • A check in front of each action that starts a run (stopIfNeedsCard()), so the dialog opens and nothing is sent:
    • the message composer (single-Bot chat, conversations, group chats and Home); the words stay in the box
    • Carry on, and buttons a Bot draws in a conversation
    • Run now on a routine, on a goal and on a check-in
    • Work on it on a check-in item
    • Try again on a task that couldn't finish
    • starting a voice call, and its Try again
  • As a backstop, any PLAN_REQUIRED refusal from the server opens the same dialog: a REST ClientError (in lib/client.ts, so every generated operation is covered) and a refused Bot run on the AG-UI stream (stoppedReason in lib/copilot/stopped-turn.ts). An action that skips the check still shows the dialog.

Banner and words. The bar over every page shows nothing while runs are left. Once the trial is used up it says so, with Add a card for admins. lib/plan/words.ts no longer counts days or mentions a 30-day trial. needsCard stays true for none and past_due, and is false for free.

Sign-up wording. "Free usage-based trial" (no number) appears on the web Cloud sign-in (a short line of its own under the button, "New accounts start on a free usage-based trial.", with "usage-based" never split), on Desktop's OpenBot Cloud row ("Your Bots run in our cloud. Free usage-based trial.", kept to one line as the setup window's layout test requires), and on the OpenBot Cloud choice in Move to OpenBot Cloud. Desktop's Cloud sign-in sits directly under that row, so it doesn't repeat it.

Progress primitive. shadcn's Progress in components/ui/progress.tsx, built on the Base UI already used by every other primitive in components/ui (@base-ui/react 1.7.0, already a dependency). No new package.

Tests

  • app/tests/plan-free-trial.test.tsx uses the app's own screens and query client against a server answering at the API's addresses. It covers:
    • the Plan row at 42% shows the bar and "42% used", and once active it shows the plan with no bar
    • with the trial used up, the dialog opens once with "500 Bot runs" and the price, and the admin's link goes to addCardUrl
    • sending a message, Run now on a routine and Run now on a goal each open the dialog and make no request
    • closing it closes it, and the next try opens it again
    • a member gets "ask an admin" with no button
    • a 402 PLAN_REQUIRED from runRoutine, and a refused Bot run, each open it
  • Red/green: with the guards and backstop taken out, the action test and the 402 test fail; with them back, all four pass.
  • Fixes from the end-to-end run, each with a test that fails before and passes after:
    • the dialog doesn't open by itself again after the page loads again
    • opened by a refusal before the plan read lands, an admin gets the admin line and the button
    • the sign-in layout keeps its line under the heading at two lines and "usage-based" whole, at 1440px and 390px, in light and dark
  • app/tests/plan-notices.test.tsx covers the new banner wording, and that nothing shows on free.
  • app/tests/plan-notices-layout.test.tsx (headless Chromium, OPENBOT_APP_BROWSER=1) adds the free, used-up and active states. It also checks the Settings bar and the dialog in light and dark, at 1440px and 390px, for overflow, with one of the app's existing dialogs drawn for comparison.
  • Desktop: App.test.tsx covers the new Cloud row and sign-in wording.

…and say the trial tidily

Fixes from the end-to-end run:

- The dialog opened by itself again on every full page load (a reload, a link opened afresh,
  Back from the payment page), because only the page remembered it had. This browser now
  remembers it per person and organization, so it opens by itself once and then only on an AI try.
- Opened by a PLAN_REQUIRED refusal while the plan as last read still said runs were left, an
  admin read the member's "Ask an admin" until the plan read again. The refusal carries the
  payment page only for an owner or an admin, so it decides who the dialog is talking to at once.
- On OpenBot Cloud's sign-in, the trial added to the line under the heading took it to three
  lines and split "usage-" from "based". That line is back to its two lines, and the trial is a
  short line of its own under the button, with "usage-based" kept whole.
- The bar, the dialog's title and the server's refusal now begin the same way ("You've used your
  free trial."), and the price reads "$5 a month for each member of this organization".
@davidmckayv
davidmckayv merged commit acbff78 into main Nov 24, 2026
37 checks passed
@davidmckayv
davidmckayv deleted the free-runs-screens branch November 24, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant