Merged
Conversation
Contributor
Greptile OverviewGreptile SummaryThis PR implements a comprehensive upgrade upsell flow for Onyx Craft when users hit their free message limits. The changes span both backend rate limiting configuration and frontend UI for the upgrade experience. Key Changes:
Issues Found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ChatPanel
participant UsageLimits as useUsageLimits Hook
participant API as Backend API
participant StreamingHook as useBuildStreaming
participant Modal as UpgradePlanModal
User->>ChatPanel: Load Craft page
ChatPanel->>UsageLimits: Fetch usage limits
UsageLimits->>API: GET /api/build/rate-limit
API-->>UsageLimits: {isLimited, messagesUsed, limit, limitType}
UsageLimits-->>ChatPanel: Return limits
alt User at limit (isLimited=true)
User->>ChatPanel: Try to send message
ChatPanel->>ChatPanel: Check limits?.isLimited
ChatPanel->>Modal: Show upgrade modal
Modal-->>User: Display "reached limit" message
User->>Modal: Click "Upgrade"
Modal->>User: Navigate to /admin/billing
else User under limit (isLimited=false)
User->>ChatPanel: Send message
ChatPanel->>StreamingHook: streamMessage(sessionId, message)
StreamingHook->>API: POST /api/build/sessions/{id}/message
alt Rate limit hit during stream
API-->>StreamingHook: 429 Rate Limit Error
StreamingHook->>StreamingHook: Catch RateLimitError
StreamingHook->>ChatPanel: Update session.error = RATE_LIMIT_EXCEEDED
ChatPanel->>ChatPanel: Detect error via useEffect
ChatPanel->>Modal: Show upgrade modal
ChatPanel->>UsageLimits: refreshLimits()
else Message sent successfully
API-->>StreamingHook: Stream response packets
StreamingHook-->>ChatPanel: Update session with messages
ChatPanel->>UsageLimits: refreshLimits()
UsageLimits->>API: Fetch updated limits
end
end
|
5c2c2fa to
594a595
Compare
wenxi-onyx
approved these changes
Jan 28, 2026
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.
Description
hide session limit
How Has This Been Tested?
locally

Additional Options
Summary by cubic
Shows an upgrade modal when users hit Craft message limits and makes paid limits configurable with per-user overrides. Also hides the sessions count when limit is unlimited (limit=0).
New Features
Migration
Written for commit 594a595. Summary will update on new commits.