Skip to content

fix(billing): Free plan shows the trial up front, search joins the hosted-key gate, trial and plan-end emails - #10389

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix/free-plan-experience
Nov 25, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
fix/free-plan-experience

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Chat paywall up front: a payer whose plan doesn't include Chat now sees a one-line notice above the empty composer ("Chat with Sim is included with paid plans" plus the upgrade link, or who to ask), instead of finding out from the modal after typing. It offers "Start a 14-day free trial" when the viewer is eligible.
  • Trial is visible where we upsell Free:
    • /api/billing (personal) returns proTrialEligible, from a new isProTrialEligible that getProTrialCheckoutParams now shares.
    • The upgrade page's Pro card says "Start free trial" for an eligible personal checkout.
    • The Chat paywall, the hosted-key 402 and both free-tier emails mention Pro's free trial.
    • Pro/Max feature lists and the email "Pro includes" box lead with Sim-hosted models & tools. The welcome email says Free, not Community.
  • Web search joins the hosted-key gate: it always runs on Sim's Exa key passed as the tool's own key, which skipped mayUseHostedKey. A free payer now gets the same 402 as every other hosted tool.
  • Free credits copy: the pricing FAQ and costs docs say what Free credits cover (runs, code execution, KB indexing, AI-assisted editing) and that hosted models/tools and Chat are paid.
  • Trial ending reminder: customer.subscription.trial_will_end emails the date, the charge (from the Stripe price) and how to cancel. Idempotent per subscription and trial end.
  • Plan ended: when a paid plan is deleted and its owner isn't covered by another paid plan, one email says hosted models, tools and Chat stopped and how to keep workflows running (BYOK or a plan).
  • Schedules: a scheduled run refused Sim's hosted key disables its schedule immediately with a paid_plan_required reason, instead of failing 100 times first. Other failures still count toward the limit.
  • Start paid plan now: a trialing payer can end the trial early from Settings → Subscription (POST /api/billing/end-trial, session-only billing.trial.end operation, own trialing personal subscription only, Stripe trial_end: 'now'). The trial-exhausted usage card points there.

Type of Change

  • Bug fix
  • New feature

Testing

  • New lib/billing/free-plan.integration.ts (real Postgres; Stripe, mail and schedule notifications stubbed), 9 cases: search refused for a free payer and allowed for a paid one; schedule disabled on the hosted-key refusal and counted otherwise; trial reminder sent once across redeliveries and not for a non-trialing sub; end-trial for your own trial, refused for a paid plan and for another account's trial.
  • Proved red: reverting the search gate, the schedule disable, the reminder's idempotency key and the trial-status check each fails its case.
  • trial.integration.ts (25) passes.
  • Unit tests beside changed files pass (billing routes, schedule execution, webhooks, home, upgrade, subscription hooks, emails, API route inventory).
  • Ran check:source-conventions, check:boundaries, check:comment-hygiene, check:file-names, check:api-validation:strict, check:client-boundary, check:test-patterns, check:api-contract-routes, check:permission-group-enforcement, check:application-graph, check:route-verbs, check:mapper-operation. CI runs type-check and the full audits.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Nov 25, 2026 12:23am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Critical impact] The PR appears safe to merge; the latest change prevents false plan-ended notices when coverage cannot be checked.

Summary

This PR adds trial offers, billing emails, an option to start paying early, and paid-plan checks for hosted search. Schedules stop immediately when a run is refused a hosted key.

  • The home screen explains when Chat needs a paid plan.
  • Eligible personal payers see a free-trial offer on the Pro card.
  • Web search checks the payer before using Sim’s key.
  • Schedules turn off when a run needs a paid plan.
  • Trialing payers can start their paid plan early.
  • Trialing subscribers get a reminder with the end date and charge.
  • Payers hear when their last paid plan ends.
  • Free-plan copy explains credit uses and paid features.

Reviews (4) · Last reviewed commit: "fix(billing): skip the plan-ended notice..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 35 files

This PR changes payment, billing, or quota logic. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 35 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 35 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 35 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 force-pushed the fix/free-plan-experience branch from fcf92bd to da279fd Compare November 25, 2026 00:16
@waleedlatif1
waleedlatif1 merged commit 25952cf into staging Nov 25, 2026
84 of 85 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/free-plan-experience branch November 25, 2026 00:23

This branch was successfully deployed

1 active deployment
Preview — da279fdf Deployed Nov 25, 2026 by vercel[bot]
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