feat(referral): show tweet share rules and lower default daily limit fallback#731
Conversation
Surface the three referral validation rules (must mention @browserOS_ai, posted within last 30 minutes, single-use) directly in the ShareForCredits UI so users understand submission requirements before pasting a tweet link. Also align the UsagePage daily-limit fallback (used while credits load) with the gateway default of 50. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The "Credits used today" stat was computed as `dailyLimit - credits`, which goes negative once a referral bonus pushes the balance above the daily cap (e.g. balance 294 with cap 100 showed "-194 of 100"). Clamp the math to zero and surface a separate "Bonus credits" stat when the balance exceeds the daily allowance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR surfaces the three referral validation rules ( The only notable nit is a case inconsistency: the displayed rule says Confidence Score: 5/5Safe to merge — only change warranting attention is a cosmetic handle-casing nit with no functional impact. Both changes are additive and low-risk: the rules list is purely informational UI, and the fallback value correction is a one-line constant change. The sole finding is a P2 style inconsistency in casing between the displayed mention handle and the pre-filled tweet text. No files require special attention beyond the minor nit in ShareForCredits.tsx. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User hits credits limit] --> B[ChatError: CREDITS_EXHAUSTED]
B --> C[ShareForCredits compact=true]
C --> D{Rules displayed to user}
D --> D1["① Must mention @browserOS_ai"]
D --> D2["② Posted within last 30 min"]
D --> D3["③ Single-use tweet"]
D1 & D2 & D3 --> E[Click 'Share on Twitter']
E --> F["Pre-filled tweet: @browseros_ai"]
F --> G[User posts tweet]
G --> H[Paste tweet URL into input]
H --> I[submitReferral POST /referral/submit]
I --> J{Success?}
J -->|Yes| K[+200 credits added, invalidateCredits]
J -->|No| L[Show error reason]
M[UsagePage loaded] --> N{dailyLimit from API?}
N -->|Yes| O[Show X / dailyLimit]
N -->|No / loading| P["Show X / 50 (fallback, was 100)"]
Prompt To Fix All With AIThis is a comment left during a code review.
Path: packages/browseros-agent/apps/agent/components/referral/ShareForCredits.tsx
Line: 66
Comment:
**Inconsistent Twitter handle casing**
The rule displays `@browserOS_ai`, but the pre-filled tweet generated by `getShareOnTwitterUrl()` uses `@browseros_ai` (all lowercase). Twitter handles are case-insensitive, so submissions won't fail, but users who read the rule carefully may question whether their lowercase-mention tweet is valid. Aligning both to the same casing prevents confusion.
```suggestion
Tweet must mention <span className="font-medium">@browseros_ai</span>
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(usage): handle credit balance exceed..." | Re-trigger Greptile |
Summary
@browserOS_ai, posted within last 30 minutes, single-use) directly in theShareForCreditsUI so users understand submission requirements before pasting a tweet link. The rules render in both the Usage page and inline inChatErrorwhen credits are exhausted.UsagePagedaily-limit fallback from100→50so the loading-state placeholder matches the gateway's actual default.Test plan
app.html#/settings/usageand confirm the three bullet rules appear above the Share button.CREDITS_EXHAUSTEDerror in chat and confirm the same rules render inline in the error block.X / 50(notX / 100) before the gateway response loads.🤖 Generated with Claude Code