Skip to content

Conversation

@mmabrouk
Copy link
Member

@mmabrouk mmabrouk commented Jan 15, 2026

Summary

  • Add cache invalidation for entitlements subscription cache when a plan is switched
  • Ensures that plan changes (upgrades/downgrades) take effect immediately without waiting for cache expiry

Problem

When a user switched their subscription plan (e.g., from Pro to Business), the entitlements cache was not being invalidated. This caused:

  • The old plan's entitlements to remain in effect
  • Features like SSO and Domains to be blocked even after upgrading to Business
  • Users had to wait for cache expiry or manually clear Redis to see their new plan's features

Solution

Added a call to invalidate_cache() at the end of process_event() in the subscription service, which clears the entitlements:subscription cache for the organization after any subscription event is processed.

Testing

  1. Create a new organization with Pro plan
  2. Try to access SSO settings (should be blocked)
  3. Upgrade to Business plan
  4. SSO settings should now be accessible immediately (no Redis flush needed)
CleanShot.2026-01-15.at.20.42.58.mp4

When a subscription plan is changed, the entitlements cache was not being
invalidated, causing the old plan's entitlements to remain in effect until
the cache expired or was manually cleared.

This fix adds cache invalidation for the 'entitlements:subscription' namespace
after any subscription event is processed, ensuring that plan changes take
effect immediately.
@vercel
Copy link

vercel bot commented Jan 15, 2026

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

Project Deployment Review Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jan 15, 2026 7:42pm

Review with Vercel Agent

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. Backend bug Something isn't working labels Jan 15, 2026
@mmabrouk mmabrouk requested a review from jp-agenta January 15, 2026 19:43
@jp-agenta jp-agenta merged commit abcb394 into feat/add-multi-orgs-domains-and-sso Jan 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants