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: render object/place LoRA variation-axis chips in the generate-batch dialog (#1322)
[._.]/ Adam Eivy26c5b45d11c7
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 5d3e839186..1430c6a263 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -60,6 +60,8 @@## Fixed+- **Object and place LoRA datasets can now override their Lighting/Settings variation axes in the generate-batch dialog.** The object/place LoRA feature was functional server-side (`deriveVariationAxes` applies kind-appropriate lighting/setting defaults), but `LoraDatasetDetail` hard-coded `expressionOptions`/`outfitOptions` to `[]` for non-character kinds, so `GenerateBatchDialog`'s `options.length > 0` guards were always false and the relabeled "Lighting"/"Settings" chip lists never rendered — users could only ever use the server defaults, and the per-kind relabel logic was dead code. The dataset detail now exposes the server-derived axes via a new `GET /api/lora-datasets/:id/variation-axes` endpoint, and the client seeds the chips from that vocab (instead of duplicating the object/place axis constants client-side), so the overrides flow through the existing `expressions`/`outfits` generate params. (`server/services/loraDatasetGenerate.js`, `server/routes/loraDatasets.js`, `client/src/pages/LoraDatasetDetail.jsx`, #1322)+- **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)diff --git a/client/src/pages/LoraDatasetDetail.jsx b/client/src/pages/LoraDatasetDetail.jsxindex 4f9dcb67b2..65ac265f06 100644--- a/client/src/pages/LoraDatasetDetail.jsx+++ b/client/src/pages/LoraDatasetDetail.jsx@@ -23,6 +23,7 @@ import ImportGalleryDialog from '../components/loraTraining/ImportGalleryDialog'import UniverseCharacterPicker from '../components/loraTraining/UniverseCharacterPicker';import {getLoraDataset,+ getLoraDatasetVariationAxes,patchLoraDataset,uploadLoraDatasetImages,sliceLoraDatasetRefSheet,@@ -205,6 +206,7 @@ export default function LoraDatasetDetail() {const [dataset, setDataset] = useState(null);const [loadError, setLoadError] = useState(null);const [subject, setSubject] = useState(null);+ const [variationAxes, setVariationAxes] = useState(null);const [triggerDraft, setTriggerDraft] = useState(null);const [triggerSaving, setTriggerSaving] = useState(false);const [uploading, setUploading] = useState(false);@@ -238,6 +240,21 @@ export default function LoraDatasetDetail() {// eslint-disable-next-line react-hooks/exhaustive-deps}, [dataset?.character?.universeId, dataset?.character?.entryKind, dataset?.character?.entryId]);+ // Object/place variation axes (Lighting/Settings) live as server-side+ // constants in deriveVariationAxes — fetch them so the generate-batch+ // override chips render without mirroring the vocab client-side. Characters+ // seed their chips from live canon (expressions/wardrobes) instead.+ useEffect(() => {+ if (!datasetId || subjectKind(dataset) === 'characters') {+ setVariationAxes(null);+ return;+ }+ getLoraDatasetVariationAxes(datasetId, { silent: true })+ .then(setVariationAxes)+ .catch(() => setVariationAxes(null));+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [datasetId, dataset?.character?.entryKind]);+// Readiness is derived from the live local images (not the server's snapshot// on `dataset.readiness`) so manual caption edits / deletes reflect in the// counts + Train gate immediately, without a refetch per keystroke.@@ -353,12 +370,16 @@ export default function LoraDatasetDetail() {const recaptionAll = () => startCaption(true);const expressionOptions = useMemo(- () => (subjectKind(dataset) === 'characters' ? (subject?.expressions || []).map((e) => e?.name).filter(Boolean) : []),- [dataset, subject],+ () => (subjectKind(dataset) === 'characters'+ ? (subject?.expressions || []).map((e) => e?.name).filter(Boolean)+ : (variationAxes?.expressions || [])),+ [dataset, subject, variationAxes],);const outfitOptions = useMemo(- () => (subjectKind(dataset) === 'characters' ? (subject?.wardrobes || []).map((w) => w?.name).filter(Boolean) : []),- [dataset, subject],+ () => (subjectKind(dataset) === 'characters'+ ? (subject?.wardrobes || []).map((w) => w?.name).filter(Boolean)+ : (variationAxes?.outfits || [])),+ [dataset, subject, variationAxes],);const hasReferenceSheet = !!(subject?.referenceSheetImageRef|| Object.values(subject?.referenceSheets || {}).some(Boolean));diff --git a/client/src/services/apiLoraTraining.js b/client/src/services/apiLoraTraining.jsindex 485889cbc2..6fce734145 100644--- a/client/src/services/apiLoraTraining.js+++ b/client/src/services/apiLoraTraining.js@@ -30,6 +30,11 @@ export const createLoraDataset = ({export const getLoraDataset = (id) => request(`/lora-datasets/${id}`);+// Server-derived variation axes (expressions/outfits for characters; lighting/+// settings for objects & places) — seeds the generate-batch override chips.+export const getLoraDatasetVariationAxes = (id, options = {}) =>+ request(`/lora-datasets/${id}/variation-axes`, options);+export const patchLoraDataset = (id, patch) =>request(`/lora-datasets/${id}`, { method: 'PATCH', body: JSON.stringify(patch) });diff --git a/server/routes/loraDatasets.js b/server/routes/loraDatasets.jsindex 6a71a97df1..40918a523a 100644--- a/server/routes/loraDatasets.js+++ b/server/routes/loraDatasets.js@@ -25,7 +25,7 @@ import {reconcileRenderingImages,updateImageCaption,} from '../services/loraDatasets.js';-import { generateDatasetImages, sliceReferenceSheet } from '../services/loraDatasetGenerate.js';+import { generateDatasetImages, getDatasetVariationAxes, sliceReferenceSheet } from '../services/loraDatasetGenerate.js';import { attachCaptionSseClient, startCaptionRun } from '../services/loraDatasetCaption.js';import { LORA_DATASET_ENTRY_KINDS, computeDatasetReadiness } from '../lib/loraDataset.js';@@ -65,6 +65,13 @@ router.get('/:id', asyncHandler(async (req, res) => {res.json({ ...dataset, readiness: computeDatasetReadiness(dataset) });}));+// Live variation axes (expressions/outfits for characters; lighting/settings+// for objects & places) so the generate-batch dialog seeds its override chips+// from the server vocab instead of duplicating the object/place axis constants.+router.get('/:id/variation-axes', asyncHandler(async (req, res) => {+ res.json(await getDatasetVariationAxes(req.params.id));+}));+const patchSchema = z.object({triggerWord: triggerWordSchema.optional(),// Reassign the dataset to a different universe subject. Universe + entry iddiff --git a/server/services/loraDatasetGenerate.js b/server/services/loraDatasetGenerate.jsindex 892f7ceb70..d18ff17f56 100644--- a/server/services/loraDatasetGenerate.js+++ b/server/services/loraDatasetGenerate.js@@ -208,6 +208,20 @@ export function deriveVariationAxes(character) {};}+/**+ * Live variation axes (expression/outfit for characters; lighting/setting for+ * objects & places) for a dataset's subject — the same vocab the generator+ * defaults to. Exposed so the generate-batch dialog can seed its override+ * chips from the server vocab instead of mirroring the object/place axis+ * constants client-side. Throws 409 when the subject was deleted (mirrors+ * the generate/slice paths); the caller fetches it silently.+ */+export async function getDatasetVariationAxes(datasetId) {+ const dataset = await getDataset(datasetId);+ const { subject } = await loadDatasetSubject(dataset);+ return deriveVariationAxes(subject);+}+// Load the dataset's live canon subject (generation + slicing both need// the current canon, not the dataset's snapshot). 409 when the subject// was deleted from the universe after the dataset was created.diff --git a/server/services/loraDatasetGenerate.test.js b/server/services/loraDatasetGenerate.test.jsindex ae390829a8..3e170a2e90 100644--- a/server/services/loraDatasetGenerate.test.js+++ b/server/services/loraDatasetGenerate.test.js@@ -1,5 +1,21 @@-import { describe, it, expect } from 'vitest';-import { buildDatasetImagePrompt, deriveVariationAxes } from './loraDatasetGenerate.js';+import { describe, it, expect, vi, beforeEach } from 'vitest';++// Mock the data deps so getDatasetVariationAxes can be exercised without a+// real universe/dataset store — it's a thin getDataset → live-subject →+// deriveVariationAxes wrapper, and the live-subject lookup is the part the+// pure-function tests above can't cover.+vi.mock('./loraDatasets.js', async (importOriginal) => ({+ ...(await importOriginal()),+ getDataset: vi.fn(),+}));+vi.mock('./universeBuilder.js', async (importOriginal) => ({+ ...(await importOriginal()),+ getUniverse: vi.fn(),+}));++import { buildDatasetImagePrompt, deriveVariationAxes, getDatasetVariationAxes } from './loraDatasetGenerate.js';+import { getDataset } from './loraDatasets.js';+import { getUniverse } from './universeBuilder.js';// Pure-function coverage for the kind-aware prompt builder + variation axes.// These are the highest-risk new logic in the object/place feature: a@@ -106,3 +122,37 @@ describe('deriveVariationAxes', () => {expect(axes.outfits).toEqual(['signature outfit']);});});++describe('getDatasetVariationAxes', () => {+ beforeEach(() => {+ getDataset.mockReset();+ getUniverse.mockReset();+ });++ it('returns lighting/setting axes for an object subject', async () => {+ getDataset.mockResolvedValue({ character: { entryKind: 'objects', universeId: 'u1', entryId: 'o1' } });+ getUniverse.mockResolvedValue({ objects: [{ id: 'o1', name: 'Runed Blade' }] });++ const axes = await getDatasetVariationAxes('ds1');+ expect(axes.expressions).toContain('soft studio lighting');+ expect(axes.outfits).toContain('plain studio plinth');+ });++ it('derives character axes from the live canon subject', async () => {+ getDataset.mockResolvedValue({ character: { entryKind: 'characters', universeId: 'u1', entryId: 'c1' } });+ getUniverse.mockResolvedValue({+ characters: [{ id: 'c1', name: 'Kessa', expressions: [{ name: 'smiling' }], wardrobes: [{ name: 'ranger cloak' }] }],+ });++ const axes = await getDatasetVariationAxes('ds1');+ expect(axes.expressions).toEqual(['smiling']);+ expect(axes.outfits).toEqual(['ranger cloak']);+ });++ it('throws 409 when the subject was deleted from the universe', async () => {+ getDataset.mockResolvedValue({ character: { entryKind: 'places', universeId: 'u1', entryId: 'gone' } });+ getUniverse.mockResolvedValue({ places: [] });++ await expect(getDatasetVariationAxes('ds1')).rejects.toMatchObject({ status: 409 });+ });+});