lynkr 9.14.14 → 9.14.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/difficulty-anchors.json +12 -0
- package/package.json +2 -2
- package/scripts/harvest-followup-eval.js +87 -0
- package/src/api/router.js +344 -39
- package/src/cache/embeddings.js +30 -3
- package/src/clients/cursor-utils.js +791 -0
- package/src/clients/databricks.js +136 -4
- package/src/clients/health-probe.js +10 -0
- package/src/config/index.js +10 -0
- package/src/orchestrator/index.js +8 -0
- package/src/orchestrator/sse-transformer.js +37 -3
- package/src/routing/affinity-store.js +136 -1
- package/src/routing/capabilities.js +6 -0
- package/src/routing/complexity-analyzer.js +8 -4
- package/src/routing/harness-envelope.js +71 -0
- package/src/routing/index.js +98 -13
- package/src/routing/intent-score.js +108 -75
- package/src/routing/jev-router.js +131 -25
- package/src/routing/model-registry.js +6 -3
- package/src/routing/model-tiers.js +2 -0
- package/src/routing/passthrough-route.js +20 -1
- package/src/routing/risk-analyzer.js +8 -1
- package/src/routing/shortfall.js +12 -6
- package/src/routing/task-ledger.js +443 -0
- package/src/routing/telemetry.js +44 -2
- package/src/routing/vision.js +1 -1
package/src/cache/embeddings.js
CHANGED
|
@@ -145,6 +145,9 @@ const STRICT = process.env.LYNKR_EMBEDDINGS_STRICT === 'true';
|
|
|
145
145
|
function _noteFallback(providerName, err) {
|
|
146
146
|
fallbackCount += 1;
|
|
147
147
|
lastProviderError = err?.message || String(err);
|
|
148
|
+
// Cooldown counts from the LAST failed dial, not the first attempt's start —
|
|
149
|
+
// the in-place retry delay must not eat into the cooldown window.
|
|
150
|
+
lastProviderAttempt = Date.now();
|
|
148
151
|
if (embeddingProviderAvailable !== false) {
|
|
149
152
|
embeddingProviderAvailable = false;
|
|
150
153
|
degradedSince = Date.now();
|
|
@@ -168,6 +171,14 @@ function _noteRecovery(providerName) {
|
|
|
168
171
|
degradedSince = null;
|
|
169
172
|
}
|
|
170
173
|
|
|
174
|
+
// One in-place retry before tripping degradation: a single transient failure
|
|
175
|
+
// (Ollama cold-loading the model at boot, a blip mid-restart) was flipping
|
|
176
|
+
// the WHOLE provider to hash embeddings for a full cooldown after every
|
|
177
|
+
// server start (recurring live incident, last 2026-09-26). A short backoff
|
|
178
|
+
// absorbs the blip; a provider that is actually down fails twice and
|
|
179
|
+
// degrades exactly as before.
|
|
180
|
+
const TRANSIENT_RETRY_DELAY_MS = 1500;
|
|
181
|
+
|
|
171
182
|
function _wrapProvider(providerName, providerFn) {
|
|
172
183
|
return async (text) => {
|
|
173
184
|
// While degraded, only re-attempt the provider after the cooldown; serve
|
|
@@ -184,9 +195,25 @@ function _wrapProvider(providerName, providerFn) {
|
|
|
184
195
|
const result = await providerFn(text);
|
|
185
196
|
_noteRecovery(providerName);
|
|
186
197
|
return result;
|
|
187
|
-
} catch (
|
|
188
|
-
|
|
189
|
-
|
|
198
|
+
} catch (firstErr) {
|
|
199
|
+
// Already-degraded providers get no second chance (this attempt WAS the
|
|
200
|
+
// post-cooldown probe); healthy ones earn one retry before the flip.
|
|
201
|
+
if (embeddingProviderAvailable !== false) {
|
|
202
|
+
await new Promise((r) => setTimeout(r, TRANSIENT_RETRY_DELAY_MS));
|
|
203
|
+
try {
|
|
204
|
+
const result = await providerFn(text);
|
|
205
|
+
_noteRecovery(providerName);
|
|
206
|
+
logger.debug({ provider: providerName, error: firstErr?.message },
|
|
207
|
+
'[Embeddings] Transient provider failure absorbed by retry');
|
|
208
|
+
return result;
|
|
209
|
+
} catch (secondErr) {
|
|
210
|
+
_noteFallback(providerName, secondErr);
|
|
211
|
+
if (STRICT) throw secondErr;
|
|
212
|
+
return generateHashEmbedding(text);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
_noteFallback(providerName, firstErr);
|
|
216
|
+
if (STRICT) throw firstErr;
|
|
190
217
|
return generateHashEmbedding(text);
|
|
191
218
|
}
|
|
192
219
|
};
|