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
address review (codex): gate dataset quality tier on trainability
[._.]/ Adam Eivy570ea57a2b37
diff --git a/client/src/pages/LoraDatasetDetail.jsx b/client/src/pages/LoraDatasetDetail.jsxindex 0d72b4561f..1a641fd262 100644--- a/client/src/pages/LoraDatasetDetail.jsx+++ b/client/src/pages/LoraDatasetDetail.jsx@@ -57,6 +57,7 @@ const deriveReadiness = (images, triggerWord) => {const word = (triggerWord || '').trim();const ready = list.filter((img) => img.status === 'ready');const captioned = ready.filter((img) => captionHasTriggerWord(img.caption, word));+ const trainable = !!word && captioned.length >= MIN_TRAINING_IMAGES;return {total: list.length,ready: ready.length,@@ -64,8 +65,10 @@ const deriveReadiness = (images, triggerWord) => {rendering: list.filter((img) => img.status === 'rendering').length,required: MIN_TRAINING_IMAGES,recommended: RECOMMENDED_TRAINING_IMAGES,- trainable: !!word && captioned.length >= MIN_TRAINING_IMAGES,- quality: qualityTier(captioned.length),+ trainable,+ // Mirror of computeDatasetReadiness: gate the tier on trainability so a+ // record with enough images but no trigger word never shows green.+ quality: trainable ? qualityTier(captioned.length) : 'insufficient',};};@@ -345,7 +348,9 @@ export default function LoraDatasetDetail() {? 'Ready to train — strong dataset': readiness.quality === 'minimum'? `Trainable now · ${Math.max(0, (readiness.recommended ?? 20) - (readiness.captioned ?? 0))} more for best quality`- : `Add + caption ${Math.max(0, (readiness.required ?? 10) - (readiness.captioned ?? 0))} more to train`}+ : (readiness.captioned ?? 0) >= (readiness.required ?? 10)+ ? 'Set a trigger word to train'+ : `Add + caption ${(readiness.required ?? 10) - (readiness.captioned ?? 0)} more to train`}</div></div></div>diff --git a/server/lib/loraDataset.js b/server/lib/loraDataset.jsindex 5b1ec90f86..97a810044f 100644--- a/server/lib/loraDataset.js+++ b/server/lib/loraDataset.js@@ -258,6 +258,7 @@ export function computeDatasetReadiness(dataset) {const triggerWord = trim(dataset?.triggerWord);const readyImages = images.filter((img) => img.status === 'ready');const captioned = readyImages.filter((img) => captionHasTriggerWord(img.caption, triggerWord));+ const trainable = !!triggerWord && captioned.length >= MIN_TRAINING_IMAGES;return {total: images.length,ready: readyImages.length,@@ -265,7 +266,13 @@ export function computeDatasetReadiness(dataset) {rendering: images.filter((img) => img.status === 'rendering').length,required: MIN_TRAINING_IMAGES,recommended: RECOMMENDED_TRAINING_IMAGES,- trainable: !!triggerWord && captioned.length >= MIN_TRAINING_IMAGES,- quality: datasetQualityTier(captioned.length),+ trainable,+ // Gate the tier on trainability, not the raw captioned count: with no+ // trigger word captionHasTriggerWord counts every caption, so a record+ // with enough images but a missing/empty trigger would otherwise report+ // 'good' while trainable is false — and the UI would turn green "Ready to+ // train" while the train gate rejects the run. 'minimum'/'good' therefore+ // imply trainable by construction.+ quality: trainable ? datasetQualityTier(captioned.length) : 'insufficient',};}diff --git a/server/lib/loraDataset.test.js b/server/lib/loraDataset.test.jsindex 677e01eddf..c405f9c6cf 100644--- a/server/lib/loraDataset.test.js+++ b/server/lib/loraDataset.test.js@@ -205,6 +205,17 @@ describe('computeDatasetReadiness', () => {expect(mk(RECOMMENDED_TRAINING_IMAGES)).toMatchObject({ quality: 'good', trainable: true });});+ it('reports insufficient quality when there is no trigger word, even with plenty of images', () => {+ // Without a trigger word captionHasTriggerWord counts every caption, so+ // captioned can clear the recommended target while the dataset is NOT+ // trainable. quality must stay 'insufficient' so the UI never turns green+ // "Ready to train" while the train gate rejects the run.+ const images = Array.from({ length: RECOMMENDED_TRAINING_IMAGES + 5 }, (_, i) => img({ id: `i${i}` }));+ const out = computeDatasetReadiness({ triggerWord: '', images });+ expect(out.captioned).toBeGreaterThanOrEqual(RECOMMENDED_TRAINING_IMAGES);+ expect(out).toMatchObject({ trainable: false, quality: 'insufficient' });+ });+it('datasetQualityTier brackets on the min and recommended thresholds', () => {expect(datasetQualityTier(0)).toBe('insufficient');expect(datasetQualityTier(MIN_TRAINING_IMAGES - 1)).toBe('insufficient');