Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(ops): rate-limiter health must not report dev as an outage

fudjiad65cb8707681
diff --git a/api/_lib/ops/subsystem-health.js b/api/_lib/ops/subsystem-health.js
index fcd58cc02..eb3b13826 100644
--- a/api/_lib/ops/subsystem-health.js
+++ b/api/_lib/ops/subsystem-health.js
@@ -129,9 +129,15 @@ function checkRateLimiter() {
try {
const h = rateLimiterHealth();
if (!h.configured) {
- return h.durableFallback
- ? { ...base, status: 'degraded', detail: 'no Redis; money/auth buckets counting in Postgres', backend: 'postgres', hint: 'Configure UPSTASH_REDIS_REST_URL/TOKEN for sliding-window precision.' }
- : { ...base, status: 'down', detail: 'no Redis and no Postgres — money buckets fail closed', backend: 'none', hint: 'Set DATABASE_URL and/or UPSTASH_REDIS_REST_URL. Paid endpoints deny until then.' };
+ if (h.durableFallback) {
+ return { ...base, status: 'degraded', detail: 'no Redis; money/auth buckets counting in Postgres', backend: 'postgres', hint: 'Configure UPSTASH_REDIS_REST_URL/TOKEN for sliding-window precision.' };
+ }
+ // No backend at all. Outside production that is the ordinary dev posture
+ // (the memory limiter, permissive by design). In production it means every
+ // money bucket denies — a real outage.
+ return h.enforcing
+ ? { ...base, status: 'down', detail: 'no Redis and no Postgres — money buckets fail closed', backend: 'none', hint: 'Set DATABASE_URL and/or UPSTASH_REDIS_REST_URL. Paid endpoints deny until then.' }
+ : { ...base, status: 'ok', detail: 'in-memory (no Redis configured)', backend: 'memory' };
}
if (h.quotaExhausted) {
return {
diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.js
index 34be66184..24762c300 100644
--- a/api/_lib/rate-limit.js
+++ b/api/_lib/rate-limit.js
@@ -246,6 +246,10 @@ export function rateLimiterHealth() {
circuitReopensInMs: Math.max(0, circuitOpenUntil - Date.now()),
quotaExhausted: _quotaWarnedAt > 0,
durableFallback: pgAvailable(),
+ // Outside production a bucket with no backend degrades to the permissive
+ // memory limiter rather than denying, so "no Redis, no Postgres" is the
+ // normal, healthy dev/test posture — not an outage.
+ enforcing: IS_PRODUCTION,
};
}