Skip to content

feat(referral): show tweet share rules and lower default daily limit fallback#731

Merged
Felarof (felarof99) merged 2 commits intomainfrom
feat/referral-rules-and-daily-limit
Apr 16, 2026
Merged

feat(referral): show tweet share rules and lower default daily limit fallback#731
Felarof (felarof99) merged 2 commits intomainfrom
feat/referral-rules-and-daily-limit

Conversation

@felarof99
Copy link
Copy Markdown
Contributor

Summary

  • 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. The rules render in both the Usage page and inline in ChatError when credits are exhausted.
  • Lower the UsagePage daily-limit fallback from 10050 so the loading-state placeholder matches the gateway's actual default.

Test plan

  • Open app.html#/settings/usage and confirm the three bullet rules appear above the Share button.
  • Trigger a CREDITS_EXHAUSTED error in chat and confirm the same rules render inline in the error block.
  • Confirm the Daily Credits ring shows X / 50 (not X / 100) before the gateway response loads.

🤖 Generated with Claude Code

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-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 16, 2026

Greptile Summary

This PR surfaces the three referral validation rules (@browserOS_ai mention, 30-minute window, single-use) directly in the ShareForCredits component — which renders on the Usage page and inline in ChatError when credits are exhausted — and lowers the UsagePage daily-limit loading placeholder from 100 to 50.

The only notable nit is a case inconsistency: the displayed rule says @browserOS_ai while getShareOnTwitterUrl() pre-fills the tweet with @browseros_ai (all lowercase). Twitter handles are case-insensitive so validation won't break, but aligning both strings prevents user confusion.

Confidence Score: 5/5

Safe 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

Filename Overview
packages/browseros-agent/apps/agent/components/referral/ShareForCredits.tsx Adds three validation rules as a bullet list; minor case inconsistency between the displayed handle (@browserOS_ai) and the pre-filled tweet handle (@browseros_ai) in submit-referral.ts
packages/browseros-agent/apps/agent/entrypoints/app/usage/UsagePage.tsx Lowers the dailyLimit fallback from 100 → 50 to match the gateway's actual default; straightforward, no issues.

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)"]
Loading
Prompt To Fix All With AI
This 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

@felarof99 Felarof (felarof99) merged commit fc00ed2 into main Apr 16, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant