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

fix: refuse a weightless Slotstream repo and keep the download bar under 100%

Adam Eivydb9b285f0892
diff --git a/server/services/slotstreamModelManager.js b/server/services/slotstreamModelManager.js
index 11f30a697d..c2e624a871 100644
--- a/server/services/slotstreamModelManager.js
+++ b/server/services/slotstreamModelManager.js
@@ -102,9 +102,12 @@ async function planRepoDownload({ repo, token, signal, cacheDir }) {
const model = await fetchHuggingfaceModel(repo, { token, signal, blobs: true });
const siblings = Array.isArray(model?.siblings) ? model.siblings : [];
const files = selectSlotstreamRepoFiles(siblings);
- if (files.length === 0) {
+ // A repo whose only surviving files are config/tokenizer would otherwise
+ // produce a checkpoint directory with no weights in it — which the cache walk
+ // would then report as servable, and a start would fail on.
+ if (!files.some((file) => file.endsWith('.safetensors'))) {
throw new ServerError(
- `Hugging Face repo ${repo} publishes no checkpoint files PortOS can stream (no .safetensors weights).`,
+ `Hugging Face repo ${repo} publishes no weights PortOS can stream — Slotstream reads .safetensors checkpoints.`,
{ status: 422, code: 'SLOTSTREAM_NO_WEIGHTS' },
);
}
@@ -240,7 +243,10 @@ export async function downloadSlotstreamModel({ model = null, cacheDir, onProgre
onProgress({
event: 'progress',
model: repo,
- received: completedBytes + Math.max(0, received - resumedFrom),
+ // Clamped: a shard discarded for being the wrong length is credited
+ // once in `bytesOnDisk` and again as it re-transfers, which would
+ // otherwise walk the bar past 100%.
+ received: Math.min(plan.totalBytes, completedBytes + Math.max(0, received - resumedFrom)),
total: plan.totalBytes,
message: `Downloading ${entry.file}`,
});
diff --git a/server/services/slotstreamModelManager.test.js b/server/services/slotstreamModelManager.test.js
index a85bc96d51..f8f571dae7 100644
--- a/server/services/slotstreamModelManager.test.js
+++ b/server/services/slotstreamModelManager.test.js
@@ -102,6 +102,18 @@ describe('previewSlotstreamDownload', () => {
expect(preview.requiredBytes).toBe(0);
});
+ it('refuses a repo that publishes no weights it can stream', async () => {
+ // Config and tokenizer alone would make a checkpoint directory the cache
+ // walk reports as servable and a start then fails on.
+ globalThis.fetch = vi.fn(async () => new Response(JSON.stringify({
+ id: REPO,
+ siblings: [{ rfilename: 'config.json', size: 10 }, { rfilename: 'pytorch_model.bin', lfs: { size: 999 } }],
+ }), { status: 200, headers: { 'content-type': 'application/json' } }));
+
+ await expect(previewSlotstreamDownload({ model: REPO, cacheDir }))
+ .rejects.toMatchObject({ code: 'SLOTSTREAM_NO_WEIGHTS' });
+ });
+
it('refuses an unknown model before it touches the network', async () => {
await expect(previewSlotstreamDownload({ model: '../escape', cacheDir }))
.rejects.toMatchObject({ code: 'SLOTSTREAM_INVALID_MODEL' });