From 6bfffd2cbaed2f5744fb296ff83a09f3360f4b0c Mon Sep 17 00:00:00 2001 From: dtzp555-max Date: Mon, 20 Apr 2026 13:17:11 +1000 Subject: [PATCH] chore(server): revert stale-cache compensation for hallucinated endpoint (#23) Removes the stale-cache fallback branches in handleUsage() and handleStatus() originally introduced by cb6c2a8 (2026-04-12). Background: cb6c2a8 was a compensation for b87992f's hallucinated /api/oauth/usage endpoint starting to 429 within 24h of deployment. Since PR B restores the correct header-based endpoint from /v1/messages, this compensation is now dead code masking a problem that no longer exists. Changes: - handleUsage: remove `else if (usageCache.data)` stale fallback - handleStatus: remove `else if (usageCache.data)` stale fallback - USAGE_CACHE_TTL: already reset to 5min in PR B's rewritten block (cb6c2a8 had bumped it to 15min as further compensation) Depends on #21 (PR B: restore header-based /usage). Merge PR B first. Co-authored-by: Oracle Public Cloud User Co-authored-by: Claude Opus 4.6 --- server.mjs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/server.mjs b/server.mjs index b0e26b9..f2983bf 100644 --- a/server.mjs +++ b/server.mjs @@ -930,9 +930,6 @@ async function handleUsage(_req, res) { data = await fetchUsageFromApi(); if (!data.error) { usageCache = { data, fetchedAt: now }; - } else if (usageCache.data) { - // Fallback to stale cache on error (e.g. 429 rate limit) - data = { ...usageCache.data, _stale: true, _fetchError: data.error }; } } // Always attach live model stats and proxy stats (not cached) @@ -1004,8 +1001,6 @@ async function handleStatus(_req, res) { usage = await fetchUsageFromApi(); if (!usage.error) { usageCache = { data: usage, fetchedAt: now }; - } else if (usageCache.data) { - usage = { ...usageCache.data, _stale: true }; } }