feat: Add usage limit detection and upgrade prompt#1851
Merged
charlesvien merged 22 commits intomainfrom Apr 23, 2026
Merged
Conversation
This was referenced Apr 23, 2026
Contributor
Prompt To Fix All With AIThis is a comment left during a code review.
Path: apps/code/src/shared/types/seat.ts
Line: 23
Comment:
**`PLAN_PRO` constant value changed — may break existing Pro seats**
The `PLAN_PRO` key was renamed from `"posthog-code-200-20260301"` to `"posthog-code-pro-200-20260301"`. Any existing seats stored in the database with the old `plan_key` value would no longer be matched by `isProPlan()`, causing those users to be treated as Free. This is safe only if the backend was already using the new key (making the old constant a bug) or if a migration has been coordinated. Worth explicitly confirming which direction the change goes before merging.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: apps/code/src/renderer/features/billing/components/SidebarUsageBar.tsx
Line: 49
Comment:
**`Math.ceil` vs `Math.round` inconsistency**
The text label uses `Math.round(usagePercent)` but the bar width uses `Math.ceil(usagePercent)`. At, say, 50.4% usage the label reads "50%" while the bar fills to 51%, making them visually disagree. Consider using the same rounding for both.
```suggestion
style={{ width: `${Math.min(Math.round(usagePercent), 100)}%` }}
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: apps/code/src/renderer/features/settings/components/sections/PlanUsageSettings.tsx
Line: 196
Comment:
**Spinner shown indefinitely when billing is disabled**
When `billingEnabled` is `false`, the condition `isLoading || !billingEnabled` shows a `<Spinner>` forever. In practice this section is probably only reachable when billing is enabled, but if it ever renders with `billingEnabled = false` the UI will spin indefinitely with no explanation. A cleaner approach would be to return `null` early, or show the "seat is loading" state rather than a persistent spinner.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: packages/agent/src/utils/gateway.ts
Line: 30-32
Comment:
**Missing `/v1/` version prefix**
All other gateway URL helpers (`getGatewayUsageUrl`, `getLlmGatewayUrl`) include a `/v1/` path segment, but `getGatewayInvalidatePlanCacheUrl` goes directly to `/invalidate-plan-cache`. If the backend endpoint lives under `/v1/invalidate-plan-cache`, every call will 404. Confirm the expected path with the gateway team.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "Fix lint warnings across codebase" | Re-trigger Greptile |
578c274 to
dc01db2
Compare
d736f8f to
6e33eb0
Compare
dc01db2 to
cafe9a5
Compare
6e33eb0 to
b580e94
Compare
This reverts commit eb9f1d2.
dd42679 to
567e006
Compare
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.

Problem
NOTE TO REVIEWER: You might not be able to test this without enabling the feature flag in a SEPERATE org, feel free to yolo stamp.
Free-tier users have no visibility into usage limits until requests start failing silently.
Changes
How did you test this?
Manually