You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fair-use enforcement does not escalate free-tier users who exhaust monthly credits #6083
The fair-use classifier never escalates free-tier users who exhaust their 1200 min/month credits. Every enforcement stage transition (none→warning→throttle→restrict) requires misuse_score >= 0.7 from the LLM classifier, but the classifier scores 0.10-0.35 for these users because their conversations are genuinely personal.
4 free whale users hit all soft caps (2h/day, 8h/3-day, 10h/week) consuming 78-163h/week speech — but the classifier clears them every time. Meanwhile, audio still goes to Deepgram even after credits are exhausted, incurring cost for conversations that will be locked anyway.
Root Cause
The escalate_enforcement() function in backend/utils/fair_use.py gates every stage transition on misuse_score >= FAIR_USE_CLASSIFIER_MISUSE_THRESHOLD (0.7). The classifier evaluates content type (audiobooks, podcasts, etc.) — not volume. For free users, the question isn't "is this an audiobook?" but "have you used your allocation?" The existing system design is good but doesn't support free-tier users.
Proposed Fix
Bypass classifier score for free users with exhausted credits: in escalate_enforcement(), when has_transcription_credits(uid) == False and user is on basic plan, escalate based on violation count alone (no LLM score gate needed).
Skip Deepgram when credits exhausted: in both sync.py (skip deepgram_prerecorded()) and transcribe.py (skip dg_socket.send(chunk)), don't send audio to STT when free user's monthly quota is used up. Currently both paths still send audio to Deepgram for conversations that will be locked — pure cost waste.
Keep classifier for paid users: the content-type classifier remains the right tool for unlimited-plan abuse detection.
Acceptance Criteria
Free users who exhaust monthly credits escalate through warning→throttle→restrict based on violation count, without requiring classifier misuse_score >= 0.7
Deepgram calls are skipped in sync.py when free user credits exhausted
Deepgram audio forwarding is skipped in transcribe.py when free user credits exhausted
Classifier still runs and gates enforcement for paid users (no change to paid-user path)
Existing fair-use stages, notifications, and phrasing are preserved
Activity
feat: add free-tier enforcement to fair-use engine (#6083)
feat: skip Deepgram for sync when free credits exhausted (#6083)
feat: block DG sends for free users with exhausted credits (#6083)
test: add unit tests for free-tier fair-use enforcement (#6083)
chore: add test_fair_use_free_tier.py to test.sh (#6083)
Redesign free-exhausted enforcement: direct restrict via ensure_free_…
Update transcribe.py for direct-restrict architecture (#6083)
Update sync.py for direct-restrict architecture (#6083)
Rewrite tests for direct-restrict architecture (#6083)
Change sync DG budget exhausted response from 200 to 429 (#6083)
Update test to expect 429 for DG budget exhausted sync response (#6083)
Fix P1: add kill-switch/exempt guards + skip hard-block for free-exha…
Fix P2: scope DG usage recording to restrict stage + fix 429 payload (#…
Add tests for kill-switch, exempt UIDs, and hard-block interaction (#…
75 remaining items
Move has_transcription_credits and is_paid_plan to top-level imports (B…
Update tests for top-level subscription imports in fair_use (BasedHar…
Simplify free-exhausted: use synthetic score instead of direct restri…
Update sync DG budget gate to use get_enforcement_stage (BasedHardwar…
Update transcribe DG budget gate to use get_enforcement_stage (BasedH…
Rewrite tests for simplified free-exhausted graduated escalation (Bas…
Move classify_user_purpose and send_notification to top-level imports (…
Fix sync DG budget: check before processing, record after (BasedHardw…
Start DG tracking proactively when soft caps trigger (BasedHardware#6083
Update test stubs for top-level imports in fair_use (BasedHardware#6083)
Revert classify_user_purpose and send_notification to lazy import pat…
Update test_fair_use_async mocks for lazy import getters (BasedHardwa…
Update test_fair_use_free_tier mocks for lazy import getters (BasedHa…
Add test coverage for exception handling and synthetic metadata (Base…
chore(app): bump version to 1.0.528+795 (BasedHardware#6121)