YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: don't inflate usage counter on rate-limited requests
Louis Beaumont70bd5d1753bd
diff --git a/packages/ai-gateway/src/services/usage-tracker.ts b/packages/ai-gateway/src/services/usage-tracker.tsindex 20f327e62..d9a4a7039 100644--- a/packages/ai-gateway/src/services/usage-tracker.ts+++ b/packages/ai-gateway/src/services/usage-tracker.ts@@ -115,6 +115,16 @@ export async function trackUsage().bind(today, tier, userId || null, deviceId).run();dailyCount = 1;} else {+ // Check limit BEFORE incrementing — don't inflate counter on rejected requests+ if (existing.daily_count >= limits.dailyQueries) {+ return {+ used: existing.daily_count,+ limit: limits.dailyQueries,+ remaining: 0,+ allowed: false,+ resetsAt: getNextResetTime(),+ };+ }// Increment countdailyCount = existing.daily_count + 1;await env.DB.prepare(