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
stop reconciliation pruning a manifest row the scan reported but could not verify
[._.]/ Adam Eivy16a8da470c20
diff --git a/client/src/components/models/ModelsPanel.jsx b/client/src/components/models/ModelsPanel.jsxindex 1c80326758..99cc990b81 100644--- a/client/src/components/models/ModelsPanel.jsx+++ b/client/src/components/models/ModelsPanel.jsx@@ -108,7 +108,14 @@ export default function ModelsPanel({ report, loading, initializing = false, onR</div><p className="mt-1 text-xs text-gray-500">{report.models.downloaded.length} item{report.models.downloaded.length === 1 ? '' : 's'} · {Number.isFinite(report.models.totals.all) ? formatBytes(report.models.totals.all) : 'size unavailable'}- {` · ${fromManifest ? 'tracked, last verified' : 'scanned'} ${timeAgo(report.reconciledAt || report.generatedAt)}`}+ {' · '}+ {fromManifest+ // A manifest with no `reconciledAt` is the reachable state where+ // PortOS recorded installs but no scan has ever corroborated them+ // against the disk. "last verified never" is accurate but reads+ // like a defect; name the state instead.+ ? (report.reconciledAt ? `tracked, last verified ${timeAgo(report.reconciledAt)}` : 'tracked, not yet verified against disk')+ : `scanned ${timeAgo(report.generatedAt)}`}</p></div><div className="flex flex-wrap items-center gap-2">diff --git a/server/services/modelManifest.js b/server/services/modelManifest.jsindex cecaf3c896..bb577087cd 100644--- a/server/services/modelManifest.js+++ b/server/services/modelManifest.js@@ -248,15 +248,20 @@ export function reconcileModelManifest(downloadedModels, { sourceErrors = [], diconst now = new Date().toISOString();// A row the backend listed but whose on-disk folder could not be verified is// not evidence of anything: it must neither be adopted as a tracked install- // nor counted as absent when pruning.- const scanned = new Map((downloadedModels || [])- .filter((row) => trusted.has(row.backend) && !row.inventoryUnknown)- .map((row) => [row.id, row]));+ // NOR counted as absent when pruning. Those are two separate exclusions, and+ // filtering such a row out of `scanned` alone only buys the first — it makes+ // the row look like it was never reported at all, so the pruning loop reads a+ // model the backend positively listed as deleted and drops its manifest entry.+ // `unverified` is what keeps the second half: the id was seen, just not+ // corroborated on disk, so the existing row stands unchanged.+ const reported = (downloadedModels || []).filter((row) => trusted.has(row.backend));+ const scanned = new Map(reported.filter((row) => !row.inventoryUnknown).map((row) => [row.id, row]));+ const unverified = new Set(reported.filter((row) => row.inventoryUnknown).map((row) => row.id));const models = {};let removed = 0;for (const [id, entry] of Object.entries(manifest.models)) {- if (trusted.has(entry.backend) && !scanned.has(id)) removed += 1;+ if (trusted.has(entry.backend) && !scanned.has(id) && !unverified.has(id)) removed += 1;else models[id] = entry;}let added = 0;diff --git a/server/services/modelManifest.test.js b/server/services/modelManifest.test.jsindex b42cfd0495..4faa1541ff 100644--- a/server/services/modelManifest.test.js+++ b/server/services/modelManifest.test.js@@ -156,6 +156,24 @@ describe('reconciliation against a scan', () => {expect((await getModelManifest()).models).toEqual([]);});+ // The other half of that rule, and the one that costs data. An unverified row is+ // excluded from the scanned set, which on its own makes it indistinguishable from+ // a model the backend never mentioned — so the pruning loop would read a model+ // Ollama positively listed as deleted and drop the manifest entry for it.+ it('keeps a tracked row the scan reported but could not verify on disk', async () => {+ await recordModelInstall(localModelInventoryRow({ backend: 'ollama', modelId: 'qwen3:8b' }));+ await recordModelInstall(loraInventoryRow({ filename: 'gone.safetensors', name: 'Gone' }));++ // Ollama's API lists qwen3:8b but the disk listing did not corroborate it; the+ // LoRA store was read cleanly and simply no longer holds gone.safetensors.+ const result = await reconcileModelManifest([+ { ...localModelInventoryRow({ backend: 'ollama', modelId: 'qwen3:8b' }), inventoryUnknown: true },+ ], {});++ expect(result).toMatchObject({ added: 0, removed: 1 });+ expect((await getModelManifest()).models.map((model) => model.id)).toEqual(['ollama:qwen3:8b']);+ });+it('maps every scan source error to the backend it actually invalidates', () => {expect([...trustedInventoryBackends({})]).toEqual(['huggingface', 'lora', 'ollama', 'lmstudio']);expect([...trustedInventoryBackends({ sourceErrors: ['huggingface'] })]).not.toContain('huggingface');