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
fix: dedupe LoRA checkpoint cards by step and hide the untrained step-0 checkpoint (#1323)
[._.]/ Adam Eivyafd4538c4c6d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex f852dbf321..5d3e839186 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -60,6 +60,8 @@## Fixed+- **The LoRA checkpoint picker no longer shows duplicate cards or offers the untrained step-0 adapter as a "Use this" option.** A run's checkpoint picker could render several identical cards — most visibly three cards all at "step 0" with the same base-model preview. Two pre-existing artifacts caused it: (1) mflux writes a `0000000_checkpoint.zip` from its `num_iterations==0` monitoring block — the *untrained* initial adapter — and `listRunCheckpoints` listed it as deployable even though promoting it is a no-op; (2) every **manual** resume is a fresh job/watcher with an empty `seen` set, so it re-emits checkpoints that already exist and `run.artifacts.checkpoints` accumulates duplicate entries for the same step. `listRunCheckpoints` now collapses to one entry per (filename-derived) step — keeping the record that captured a real loss, tie-breaking on the latest — and drops step 0 entirely, so `promoteCheckpoint(step:0)` correctly returns `CHECKPOINT_NOT_FOUND`. The segmented-training path was never affected (one watcher with a persistent `seen` set spans all segments). (`server/services/loraTraining/checkpoints.js`, #1323)+- **Deleting a brain memory now hard-prunes its mapped vector row instead of leaving a dead embedding in Postgres forever.** A user-initiated brain delete used to flow through the bridge's archive path (`UPDATE memories SET status='archived'`), which correctly hides the entry from search but left the row and its 768-dim embedding in the database indefinitely — so clearing a large import (e.g. a 1,482-record ChatGPT export) orphaned ~1,482 vectors that nothing ever reclaimed. The bridge now distinguishes a **genuine local delete** (a `{type}:deleted` / `journals:deleted` event, emitted only by the local `remove()`/`deleteJournal` paths) from a **sync-driven archive** (a peer delete arriving via the event-silent `applyRemoteRecord` → `sync:applied`): a real local delete hard-deletes the mapped memory row + embedding and drops its bridge-map entry, while a synced delete stays soft-archived so a peer un-delete can still resurrect it. A present-but-archived record is always kept soft (archived ≠ deleted). (`server/services/brainMemoryBridge.js`, #1318)- **The "Claim Issue" scheduled CoS task no longer reports an empty queue when there are claimable issues.** The task's prompt skipped any issue carrying the `plan` label, calling them "tracking/umbrella" issues. But `do-replan --issues` labels *every* migrated backlog item `plan` — atomic bug-fixes included — so that rule discarded the entire actionable backlog and the task always exited with "no eligible issue" even with dozens of ready-to-work issues open. The prompt now treats `plan` as the claimable-queue label (matching the `/do:next --issues` flow) and skips only true epics (an `epic` label or a "(epic)" title, which need per-slice shipping). Non-customized installs auto-upgrade to the corrected prompt on the next schedule load. (`server/services/taskPromptDefaults/`)diff --git a/server/services/loraTraining/checkpoints.js b/server/services/loraTraining/checkpoints.jsindex 522eb4ae64..6971f0b373 100644--- a/server/services/loraTraining/checkpoints.js+++ b/server/services/loraTraining/checkpoints.js@@ -105,7 +105,30 @@ const sampleUrl = (runId, name) =>export function listRunCheckpoints(run) {const samples = sampleByStep(run);const deployedStep = run.output?.selectedCheckpointStep ?? null;- const checkpoints = (run.artifacts?.checkpoints || [])++ // Collapse the raw checkpoint records to one entry per (filename-derived)+ // step before rendering cards. Two distinct artifacts of the run can pollute+ // this list:+ // - Duplicates: a MANUAL resume is a fresh job/wrapper/watcher with an empty+ // `seen` set, so it re-emits checkpoints that already exist → the same+ // step appears N times. Keep the entry that captured a real loss; tie-break+ // on the latest record (later in append order).+ // - The untrained step-0 checkpoint: mflux writes a `0000000_checkpoint.zip`+ // from its num_iterations==0 monitoring block — the initial, zero-training+ // adapter whose preview is the identical base-model frame and whose deploy+ // is a no-op. Drop it so it can't masquerade as a "Use this" option.+ const byStep = new Map();+ for (const c of run.artifacts?.checkpoints || []) {+ const step = checkpointStep(c);+ if (step === 0) continue;+ const existing = byStep.get(step);+ // Replace unless the existing entry has a real loss and this one doesn't.+ if (!existing || !(Number.isFinite(existing.loss) && !Number.isFinite(c.loss))) {+ byStep.set(step, c);+ }+ }++ return [...byStep.values()].map((c) => {const step = checkpointStep(c);const preview = samples.get(step) || null;@@ -118,7 +141,6 @@ export function listRunCheckpoints(run) {};}).sort((a, b) => a.step - b.step);- return checkpoints;}/**diff --git a/server/services/loraTraining/checkpoints.test.js b/server/services/loraTraining/checkpoints.test.jsindex 1fd0ef0427..00d58469e6 100644--- a/server/services/loraTraining/checkpoints.test.js+++ b/server/services/loraTraining/checkpoints.test.js@@ -145,6 +145,56 @@ describe('loraTraining/checkpoints', () => {expect(after.previewUrl).toContain('0001188_preview_image_preview_1.png');});+ it('dedupes checkpoint cards by step (manual resume re-emits the same step)', () => {+ // A manual resume is a fresh watcher with an empty `seen` set, so it+ // re-appends checkpoints that already exist. Same step → one card, and the+ // entry that captured a real loss wins over a loss-less re-emit; for two+ // real-loss records the latest (later in append order) wins.+ const run = buildRun({+ artifacts: {+ checkpoints: [+ { step: 250, path: '0000250_checkpoint.zip', loss: 0.64 },+ { step: 250, path: '0000250_checkpoint.zip', loss: null }, // re-emit, no loss+ { step: 500, path: '0000500_checkpoint.zip', loss: 0.7 },+ { step: 500, path: '0000500_checkpoint.zip', loss: 0.53 }, // later real-loss wins+ ],+ samples: ['0000250_preview_image_preview_1.png', '0000500_preview_image_preview_1.png'],+ },+ });+ const list = listRunCheckpoints(run);+ expect(list.map((c) => c.step)).toEqual([250, 500]); // not [250, 250, 500, 500]+ expect(list[0].loss).toBe(0.64); // real loss kept over the loss-less re-emit+ expect(list[1].loss).toBe(0.53); // latest real-loss record wins the tie+ });++ it('hides the untrained step-0 checkpoint from the deployable list', () => {+ // mflux's num_iterations==0 monitoring block writes 0000000_checkpoint.zip —+ // the untrained adapter. Reproduces run 90043893: three step-0 cards with+ // identical base-model previews collapse to nothing deployable.+ const run = buildRun({+ artifacts: {+ checkpoints: [+ { step: 0, path: '0000000_checkpoint.zip', loss: null },+ { step: 0, path: '0000000_checkpoint.zip', loss: null },+ { step: 0, path: '0000000_checkpoint.zip', loss: null },+ ],+ samples: ['0000000_preview_image_preview_1.png'],+ },+ });+ expect(listRunCheckpoints(run)).toEqual([]);+ // Step 0 is dropped even when real trained checkpoints sit alongside it.+ const mixed = listRunCheckpoints(buildRun({+ artifacts: {+ checkpoints: [+ { step: 0, path: '0000000_checkpoint.zip', loss: null },+ { step: 250, path: '0000250_checkpoint.zip', loss: 0.64 },+ ],+ samples: ['0000250_preview_image_preview_1.png'],+ },+ }));+ expect(mixed.map((c) => c.step)).toEqual([250]);+ });+it('resolves the latest on-disk checkpoint zip as the mflux resume point', () => {const latest = resolveLatestCheckpointArtifact(buildRun());expect(latest).toMatchObject({ step: 500 });