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([codex5-client-error-reporter]): prune dedup map before the has-check
[._.]/ Adam Eivy021a7334d27b
diff --git a/client/src/lib/clientErrorReporter.js b/client/src/lib/clientErrorReporter.jsindex 4af6f99e2b..796504b4a0 100644--- a/client/src/lib/clientErrorReporter.js+++ b/client/src/lib/clientErrorReporter.js@@ -163,13 +163,17 @@ export async function reportClientError(input) {return { sent: false, reason: 'rate-limited' };}hash = hashError(payload.message, payload.stack, payload.source);+ // Prune BEFORE the dedup check — otherwise an expired entry stays in+ // the map until some unrelated accepted send triggers pruneRecent,+ // silently suppressing recurrences past the 60s window for the rest+ // of the tab's lifetime.+ pruneRecent(now);if (recentHashes.has(hash)) {return { sent: false, reason: 'duplicate' };}recentHashes.set(hash, now);lastSentAt = now;- pruneRecent(now);} catch {return { sent: false, reason: 'caught' };}diff --git a/client/src/lib/clientErrorReporter.test.js b/client/src/lib/clientErrorReporter.test.jsindex 0ba1c66ecc..c4927ee00a 100644--- a/client/src/lib/clientErrorReporter.test.js+++ b/client/src/lib/clientErrorReporter.test.js@@ -133,6 +133,26 @@ describe('reportClientError', () => {Date.now = realNow;});+ it('accepts the same error again once its dedup window has expired', async () => {+ const payload = {+ type: 'error',+ message: 'recurring',+ error: Object.assign(new Error('recurring'), { stack: 'Error\n at foo (foo.js:1:1)' }),+ };+ const first = await reportClientError(payload);+ expect(first.sent).toBe(true);++ // Jump past the 60s dedup window (and well past the 1s throttle).+ const realNow = Date.now;+ vi.spyOn(Date, 'now').mockReturnValue(realNow() + 90 * 1000);++ const second = await reportClientError(payload);+ expect(second.sent).toBe(true);+ expect(globalThis.fetch).toHaveBeenCalledTimes(2);++ Date.now = realNow;+ });+it('rate-limits reports that arrive faster than once per second', async () => {const first = await reportClientError({ type: 'error', message: 'a' });expect(first.sent).toBe(true);diff --git a/server/services/clientErrors.js b/server/services/clientErrors.jsindex 1baa23c4e3..1879489913 100644--- a/server/services/clientErrors.js+++ b/server/services/clientErrors.js@@ -138,6 +138,11 @@ export async function recordClientError(rawPayload) {const payload = sanitize(rawPayload);const hash = hashError(payload);+ // Prune BEFORE the dedup check — otherwise an expired entry keeps+ // suppressing the same error until some unrelated accepted write happens+ // to trigger pruneRecent. A recurring error past the 24h window would+ // never surface a fresh Review Hub alert.+ pruneRecent(now);if (recentHashes.has(hash)) {return { accepted: false, reason: 'duplicate' };}@@ -168,7 +173,6 @@ export async function recordClientError(rawPayload) {if (!item) return { accepted: false, reason: 'review-hub-write-failed' };recentHashes.set(hash, now);- pruneRecent(now);return { accepted: true, itemId: item.id };}diff --git a/server/services/clientErrors.test.js b/server/services/clientErrors.test.jsindex fb061b3450..93a4d8db6c 100644--- a/server/services/clientErrors.test.js+++ b/server/services/clientErrors.test.js@@ -152,6 +152,27 @@ describe('recordClientError', () => {expect(arg.metadata.source).toBe('/assets/index-abc.js');});+ it('accepts the same error again once its dedup window has expired', async () => {+ const payload = {+ type: 'error',+ message: 'recurring error',+ stack: 'Error: recurring\n at foo (foo.js:1:1)',+ };+ const first = await recordClientError(payload);+ expect(first.accepted).toBe(true);++ // Jump past the 24h dedup window AND past the 1s throttle.+ const realDateNow = Date.now;+ const ONE_DAY_AND_CHANGE = 25 * 60 * 60 * 1000;+ vi.spyOn(Date, 'now').mockReturnValue(realDateNow() + ONE_DAY_AND_CHANGE);++ const second = await recordClientError(payload);+ expect(second.accepted).toBe(true);+ expect(review.createItem).toHaveBeenCalledTimes(2);++ Date.now = realDateNow;+ });+it('strips a `#fragment` from URL fields too (OAuth implicit-grant tokens)', async () => {await recordClientError({type: 'error',