Skip to content

A friendly heads-up at 400 and 450 of 500 free Bot runs on OpenBot Cloud - #2828

Open
davidmckayv wants to merge 3 commits into
mainfrom
free-runs-heads-up
Open

davidmckayv wants to merge 3 commits into
mainfrom
free-runs-heads-up

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

On OpenBot Cloud, a person now gets a friendly heads-up before their free Bot runs are used up, so the billing dialog at the limit is no surprise. Nothing is blocked or paused by it.

Built on OpenBot PR 2826 (the spec: OrganizationPlan.freeRunsUsed and freeRunsLimit). Its commit is the first in this branch, so merge 2826 first, together with its server (the backend PR pinned to it), and this rebases clean. Against a server without the fields, the app shows exactly what it does today.

What it does

Two heads-ups, once each. At 100 runs before the limit and at 50 (400 and 450 of 500), the marks worked out from the limit the server sends (freeRunsLimit - 100, freeRunsLimit - 50), never a hardcoded 500.

  • At 400: "You've used 400 of your 500 free Bot runs". Your Bots keep running as usual. When you reach 500, you'll be asked to set up billing.
  • At 450: "50 free Bot runs left". Just so you know, at 500 you'll be asked to set up billing. Until then, nothing changes and your Bots keep running.
  • A member reads "an admin will need to set up billing" instead, since an admin adds the card at the limit.
  • No price. The same bar as Settings, with the count ("400 of 500 Bot runs used"). See pricing opens https://open.bot/pricing in a new tab (target="_blank", rel="noopener noreferrer"), and Got it closes it.
  • Closing it any way is remembered in this browser, per person and mark, so it never opens again for that mark. The count is per person across organizations, so switching organization doesn't reopen it. Passing both marks between two reads shows only the later one.
  • One dialog for the whole app, mounted beside the trial-used-up dialog in the signed-in layout, so every skin and Desktop's window get it. It never opens over that dialog.

Whose count. Billing counts each person's own runs, across every organization they're in, and refuses anyone's run (member or admin) once theirs are used. So everybody gets the heads-up, with words for who sets up billing. CopilotKit employees, whose runs never stop, get none.

Where. Only where the plan read says a plan is required and the organization isn't on it (status: free) and the server sends the count. Self-hosted, Desktop Self-Contained and the personal edition answer not_required, so nothing shows there and nothing extra is asked.

Mid-session. While a heads-up could still be due, the plan is read again every minute, so the heads-up opens while the person works, their routines' runs included. Everywhere else, and past the limit, there is no polling.

Settings > Organization. The Plan row's bar reads "412 of 500 Bot runs used", the very count the server bills by. A new Pricing row below it opens the pricing page in a new tab. It's a native Item link row with the external-link icon, as on an app's Documentation row.

Nothing is blocked. The dialog only reads. stopIfNeedsCard and the server's gate are unchanged: runs go on to 500 and are refused only after, as before.

Tests

  • app/tests/free-runs-heads-up.test.tsx: the app's own screens and query client, against a server answering at the API's addresses.
    • Nothing at 399.
    • At 400, the first heads-up opens once, with no price and the pricing link in a new tab. Got it closes it, and it stays closed across a read and a reload.
    • At 450, the second opens, Escape closes it, and it stays closed.
    • Passing both marks between two reads shows only the later one.
    • Member wording.
    • Nothing when no plan is required, on the plan, for an employee, or from a server without the count.
    • The plan is polled only while a heads-up could be due.
    • At 460, with the heads-up showing, a message still sends.
    • Settings shows "412 of 500 Bot runs used" and a Pricing row opening a new tab.
    • Red/green: with the dialog never opening and the Settings row as on main, 5 of 8 fail. With the change, all 8 pass. The existing plan suites (plan-free-trial, plan-notices, plan-turns, organizations) still pass, 54 tests in all.
  • app/tests/free-runs-heads-up-layout.test.tsx (OPENBOT_APP_BROWSER=1, OPENBOT_APP_ENGINES=chromium,webkit): Chromium and WebKit, light and dark, 1440px and 390px.
    • Both heads-ups for an admin, and the second for a member, all on screen.
    • Buttons on one line, focus on Got it, nothing running sideways.
    • The dialog's width, radius, padding, surface and title size equal the trial-used-up dialog's.
    • The Pricing row lines up with the Plan row, and the count stays on one line. 40 pass.
  • End to end against the backend's real hosted server: the plan gate and free_runs on Postgres, Ops faked as in its integration tests, OPENBOT_FREE_RUNS=500. The real app dev server ran in front of it, in Chromium and WebKit, light at 1440px and dark at 390px, as an admin and a member.
    • Signed in through the Ops handoff, at 399 nothing showed.
    • The 400th run went through the real gate and was admitted, and the heads-up opened. See pricing opened a new tab on open.bot/pricing, and Got it held across a reload.
    • The 450th run was admitted, and the second heads-up opened within the minute with no reload.
    • Run 500 was admitted and run 501 refused with PLAN_REQUIRED, as before. 60 of 60 checks pass.
  • Format, lint, app typecheck, and the copy and look guards are clean.

Changelog

A heads-up before your free Bot runs are used up
OpenBot Cloud now lets you know at 400 and 450 of your 500 free Bot runs, shows your count in Settings, and links to pricing. Nothing stops until 500.

…ed, out of how many

OrganizationPlan gains freeRunsUsed and freeRunsLimit, present exactly when freeRunsUsedPercent is. They are the count and the allowance the plan gate refuses a run by, so the app can warn a person before their free runs run out and show the count in Settings. Additive: freeRunsAllowance keeps its rule of appearing only once the runs are used up.
Two dialogs, once each: at 100 runs before the limit and at 50, with the marks worked out from the limit the server sends. Each says how many runs are used, that nothing stops now, and that at the limit the person will be asked to set up billing (or an admin will, for a member). No price; a See pricing link opens open.bot/pricing in a new tab. Closing one is remembered in this browser, per person and mark. Nothing is blocked: the dialog only reads. While one could be due on Cloud, the plan is read again every minute so it opens mid-session. Settings > Organization shows the count the server bills by (412 of 500 Bot runs used) and a Pricing row. Nowhere else: self-hosted, Desktop, the personal edition and older servers send no count.
@davidmckayv

Copy link
Copy Markdown
Contributor Author

Visual check at the tested head (beb1bb1)

free-runs-heads-up-layout.test.tsx run locally in Chromium and WebKit, light and dark, 1440px and 390px: 40 of 40 pass. It uses the real Organization settings page with the dialog over it, and the existing trial-used-up dialog for comparison. All 40 shots are on pr-assets/free-runs-heads-up.

The heads-up next to the trial-used-up dialog (Chromium, light, 1440). Same surface, radius, padding, title size, bar and footer. The heads-up names no price.

Heads-up at 400 (admin) Trial used up, today

At 450, dark, 1440 (Chromium) and the member's wording at 390 (WebKit).

At 450, admin, dark At 450, member, WebKit 390 light At 450, member, WebKit 390 dark

Settings > Organization. The Plan row reads "412 of 500 Bot runs used". The Pricing row sits under it with the same insets, divider and title and description sizes as the Name and Plan rows, and the external-link icon in the chevron's place.

Chromium, light, 1440 Chromium, dark, 1440 WebKit, light, 390 WebKit, dark, 390

Review. The spec is additive: two optional response fields, and the generated clients are regenerated with it. The copy keeps to the glossary and style rules: Bot, admin, no price, no em dashes, short sentences, verbs on the buttons. The dialog was asked for, and it has the same structure as CardNeededDialog. The Settings row uses the page's own Item row. No changes needed.

This branch has not been deployed

No deployments
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