← back to Dw Pairs Well
pairs: trip CLIP circuit-breaker on 5xx (service alive but erroring), not just on timeout/refused; 404 stays a per-sku miss
b2207f5d6adbf4f8150722459b4d63e872e30a33 · 2026-07-13 00:04:18 -0700 · Steve Abrams
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit b2207f5d6adbf4f8150722459b4d63e872e30a33
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jul 13 00:04:18 2026 -0700
pairs: trip CLIP circuit-breaker on 5xx (service alive but erroring), not just on timeout/refused; 404 stays a per-sku miss
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
server.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/server.js b/server.js
index 6263ac0..d6e5867 100644
--- a/server.js
+++ b/server.js
@@ -294,7 +294,10 @@ async function clipSimilarTop(source, k) {
body: JSON.stringify(body),
signal: AbortSignal.timeout(CLIP_TIMEOUT_MS)
});
- if (!r.ok) return null; // 404 = no stored vector for this sku
+ if (!r.ok) { // 404 = no stored vector for this sku (per-sku miss, NOT an outage)
+ if (r.status >= 500) clipTrip(); // 5xx = service alive but erroring → trip the breaker
+ return null;
+ }
const d = await r.json();
clipReset(); // reachable → close the breaker
if (!d || !d.ok || !Array.isArray(d.results) || d.results.length === 0) return null;
@@ -356,7 +359,10 @@ async function clipPairwiseMap(source, candidates) {
body: JSON.stringify({ dw_sku: source.dw_sku, candidates: skus }),
signal: AbortSignal.timeout(CLIP_TIMEOUT_MS)
});
- if (!r.ok) return {};
+ if (!r.ok) {
+ if (r.status >= 500) clipTrip(); // 5xx = service alive but erroring → trip the breaker
+ return {};
+ }
const d = await r.json();
clipReset(); // reachable → close the breaker
return (d && d.ok && d.cosines) ? d.cosines : {};
← ce3fda2 pairs: PAIRS_CLIP_DEFAULT env flag (default OFF) blends CLIP
·
back to Dw Pairs Well
·
auto-save: 2026-07-13T00:51:43 (1 files) — tools/live-link-c 79e1c62 →