Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: wrap period controls on mobile and reconcile reset boundary on early recovery
Adam Eivye6ad053d8c9d
diff --git a/client/src/components/usage/ProviderQuotaBody.jsx b/client/src/components/usage/ProviderQuotaBody.jsxindex 6b39407f49..52bf8a92a6 100644--- a/client/src/components/usage/ProviderQuotaBody.jsx+++ b/client/src/components/usage/ProviderQuotaBody.jsx@@ -131,7 +131,7 @@ export default function ProviderQuotaBody({ quota, showActivity = true, showNote{quota.metrics?.length > 0 && (<div className="space-y-1.5 sm:space-y-2">{availablePeriods.length > 1 && (- <div className="flex items-center gap-1" role="group" aria-label="Usage period">+ <div className="flex flex-wrap items-center gap-1" role="group" aria-label="Usage period">{availablePeriods.map((p) => {const active = selectedPeriod === p.key;return (@@ -139,7 +139,7 @@ export default function ProviderQuotaBody({ quota, showActivity = true, showNotekey={p.key}type="button"onClick={() => setSelectedPeriod(p.key)}- className={`px-2 py-0.5 rounded text-[10px] sm:text-xs font-medium transition-colors ${+ className={`px-1.5 sm:px-2 py-0.5 rounded text-[10px] sm:text-xs font-medium transition-colors ${active? 'bg-port-accent text-white shadow-xs': 'text-gray-400 hover:text-white bg-port-bg border border-port-border'diff --git a/server/services/imageGenQuota.js b/server/services/imageGenQuota.jsindex 1321d6efeb..7d8633c974 100644--- a/server/services/imageGenQuota.js+++ b/server/services/imageGenQuota.js@@ -152,8 +152,14 @@ export async function recordImageGenOutcome({ mode, ok, error = '', at = Date.noif (ok) {// A render that succeeded proves the backend is serving again — clear a// block that outlived its stated reset (providers round "approximately").- if (entry.blockedUntil && (!entry.lastResetAt || entry.blockedUntil > entry.lastResetAt)) {- entry.lastResetAt = entry.blockedUntil;+ if (entry.blockedUntil || entry.blockedAt) {+ if (entry.blockedUntil && at >= entry.blockedUntil) {+ entry.lastResetAt = Math.max(entry.lastResetAt || 0, entry.blockedUntil);+ } else {+ // Early recovery before forecasted reset (or block without stated reset):+ // the reset occurred at or before this successful render.+ entry.lastResetAt = at;+ }}entry.blockedAt = null;entry.blockedUntil = null;@@ -345,7 +351,9 @@ export async function getImageGenQuota({ enabledModes = [], now = Date.now(), pe},};- const lastReset = entry.lastResetAt ?? (entry.blockedUntil && now >= entry.blockedUntil ? entry.blockedUntil : null);+ const lastReset = (entry.lastResetAt && entry.lastResetAt <= now)+ ? entry.lastResetAt+ : (entry.blockedUntil && now >= entry.blockedUntil ? entry.blockedUntil : null);if (lastReset && lastReset <= now) {const recentReset = allRenders.filter((r) => r.at >= lastReset);const failedReset = recentReset.filter((r) => !r.ok).length;diff --git a/server/services/imageGenQuota.test.js b/server/services/imageGenQuota.test.jsindex 095a09a8b9..259d696189 100644--- a/server/services/imageGenQuota.test.js+++ b/server/services/imageGenQuota.test.js@@ -382,4 +382,24 @@ describe('getImageGenQuota', () => {expect(resetCard.period).toBe('reset');expect(resetCard.metrics[0].value).toBe('1 render · reset');});++ it('reconciles reset boundary when rendering recovers early before forecasted reset', async () => {+ const forecastedReset = now + 2 * 60 * 60 * 1000;+ const earlyRecoveryTime = now - 30 * 60 * 1000;+ // Failed render with forecasted reset 2 hours into future+ await recordImageGenOutcome({+ mode: 'agy',+ ok: false,+ error: `quota will reset in approximately 2 hours (around ${new Date(forecastedReset).toISOString()})`,+ at: now - 60 * 60 * 1000,+ });+ // Early successful render before forecastedReset+ await recordImageGenOutcome({ mode: 'agy', ok: true, at: earlyRecoveryTime });++ const card = await getImageGenQuota({ enabledModes: ['agy'], now });+ const metric = card.metrics[0];+ expect(metric.periods.reset).toBeDefined();+ expect(metric.periods.reset.count).toBe(1);+ expect(metric.periods.reset.value).toBe('1 render · reset');+ });});