Skip to content

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

test: stabilize HuggingFace abort-signal assertion (#7965)

[._.]/ Adam Eivy7863ce817f31
diff --git a/server/services/loras.test.js b/server/services/loras.test.js
index 2c93e6a9a2..0e56091238 100644
--- a/server/services/loras.test.js
+++ b/server/services/loras.test.js
@@ -1067,6 +1067,16 @@ describe('installFromHuggingface', () => {
const fetchImpl = async (url, opts) => {
if (url.startsWith('https://huggingface.co/api/models/')) return mockJsonResponse(HF_MODEL);
if (url.includes('/resolve/main/pytorch_lora_weights.safetensors')) {
+ // Plan resolution probes Content-Length with a separate timed HEAD
+ // before the download claims its slot. Observe only the slot-owned
+ // GET signal so the synchronous abort assertion cannot race that probe.
+ if (opts?.method === 'HEAD') {
+ return {
+ ok: true,
+ status: 200,
+ headers: new Map([['content-length', String(validSafetensors().length)]]),
+ };
+ }
sawSignal = opts?.signal;
// Never closes on its own: this stream only ends when the abort
// listener below errors it, mirroring how real fetch aborts an