feat(web): remove the daily allowance, keep counting usage

Merged
DA
11d ago
+220-423

What

Every account used to get 5,000 hosted calls per UTC day (HOSTED_DAILY_LIMIT in apps/web/server/hosted/quota.ts), refused past that in four places. This removes the ceiling and every refusal while keeping the usage record for the admin dashboard.

Deleted

  • HOSTED_DAILY_LIMIT, HostedSpend, utcDayEnd; spendHostedMeter now answers the day's count and nothing about whether it fit.
  • HostedQuotaExceeded and the throw in the brain's metered middleware; it counts and continues.
  • SEARCH_WEB_REFUSAL.ALLOWANCE_SPENT; ResearchCall.spend answers void.
  • The !allowed refusal when a voice session opens, and the quota field on session.created (clients already treat it as optional).
  • The !allowed early return in the plan notetaker.
  • Admin: CEILING_REACHED, the three findQuotaLimited* queries, the quotaLimited* / dailyLimit fields, and the "Throttled account-days" / "Throttled days" cards with the quota-exhausted note.

Kept, unrenamed: hosted_usage and its upsert, voice_session_usage and recordVoiceSeconds, every call site's count, and every admin call and activity query.

Left alone: the QUOTA_EXHAUSTED wire code, its 429 handling, and the desktop's "Voice is temporarily unavailable" note; the in-memory rate limiter in hosted/events.ts still uses them. hostedQuotaSchema stays.

A failed meter write no longer fails the call it was counting. The brain's middleware reports it (bounded message, through the host's console.warn) and runs the inference; runSearchWeb logs it and sends the search. Voice opening and the notetaker already read the database before they count, so a store that is down fails them the same way it did.

Tests

  • hosted-quota.test.ts: a day seeded at the former ceiling is counted to 5,001 and 5,002 with nothing refused, and the row holds the count.
  • hosted-brain-host-model.test.ts: three inferences past the former ceiling all run; a meter that throws is reported and the inference still runs.
  • public-research.test.ts and hosted-planning.test.ts: a search whose count could not be written is still sent and reaches the model with its source.
  • voice-service.test.ts: the spent-allowance case is gone; session.created carries no quota.
  • Admin tests drop the throttled counts and dailyLimit; the seeded busy days stay, as counts past the old ceiling that the aggregates read like any other.

Docs

PRIVACY.md, apps/web/server/README.md, docs/PLANNING.md, and the hosted_usage schema comment no longer describe an allowance or a refusal.

No migration; no renames.

šŸ¤– Generated with Claude Code


Open workspace in Conductor


Devin Review