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 (claude): reject a dropped main seed, fix fork preview + backfill nag
[._.]/ Adam Eivy77bf847e8baa
diff --git a/client/src/components/sprites/ForkSpriteModal.jsx b/client/src/components/sprites/ForkSpriteModal.jsxindex e0b1364cc2..36eac13d07 100644--- a/client/src/components/sprites/ForkSpriteModal.jsx+++ b/client/src/components/sprites/ForkSpriteModal.jsx@@ -1,7 +1,9 @@-// Fork a character from its locked main reference (#sprite-i2i): creates a new-// sprite whose main is generated image+text→image from THIS sprite's reference-// plus a required prompt describing the change. Thin form over-// forkSpriteRecord → the server creates the record and queues the main render;+// Fork a character from its locked reference (#sprite-i2i): creates a new+// sprite whose first render is generated image+text→image from THIS sprite's+// reference plus a required prompt describing the change. The server picks the+// seed (the turnaround sheet when the source has one, else its main) and the+// fork enters the same turnaround-first workflow (#2979). Thin form over+// forkSpriteRecord → the server creates the record and queues that render;// on success we hand the new record back so the page can navigate to it.import { useEffect, useState } from 'react';@@ -12,7 +14,7 @@ import SpritePreview from './SpritePreview.jsx';import { forkSpriteRecord } from '../../services/apiSprites.js';import { useAsyncAction } from '../../hooks/useAsyncAction.js';-export default function ForkSpriteModal({ open, onClose, source, referencePath, backends, mode, onForked }) {+export default function ForkSpriteModal({ open, onClose, source, referencePath, fromTurnaround = false, backends, mode, onForked }) {const [name, setName] = useState(`${source?.name || ''} fork`);const [id, setId] = useState('');const [designPrompt, setDesignPrompt] = useState('');@@ -36,7 +38,7 @@ export default function ForkSpriteModal({ open, onClose, source, referencePath,...(forkMode ? { mode: forkMode } : {}),initImageStrength: strength,}, { silent: true });- toast.success(`Forked ${source.name} → ${record.name} — main render queued`);+ toast.success(`Forked ${source.name} → ${record.name} — ${fromTurnaround ? 'turnaround' : 'main'} render queued`);onForked(record);onClose();}, { errorMessage: 'Fork failed' });@@ -72,8 +74,9 @@ export default function ForkSpriteModal({ open, onClose, source, referencePath,/>)}<p className="text-xs text-gray-400">- The new character's main reference is generated from this reference image plus your prompt- (image+text→image). Everything else — anchors, walk cycle, atlas — starts fresh.+ The new character's {fromTurnaround ? 'turnaround sheet' : 'main reference'} is generated from this+ reference image plus your prompt (image+text→image). Everything else — the rest of the+ reference set, walk cycle, atlas — starts fresh.</p></div>diff --git a/client/src/components/sprites/ReferenceWorkflow.jsx b/client/src/components/sprites/ReferenceWorkflow.jsxindex 24dcc1adb0..f0d542ed0b 100644--- a/client/src/components/sprites/ReferenceWorkflow.jsx+++ b/client/src/components/sprites/ReferenceWorkflow.jsx@@ -100,6 +100,11 @@ export default function ReferenceWorkflow({ record, reference, renders, correcti// grid as the user left it.const anchorList = manifest?.anchors || [];const allAnchorsLocked = anchorList.length > 0 && anchorList.every((a) => a.status === 'locked');+ // A legacy character with every anchor already frozen has nothing left for a+ // sheet to improve — main and anchors are immutable — so the backfill stops+ // being a step it's missing and becomes an optional extra that only helps+ // future forks. Present it that way instead of nagging forever.+ const backfillOptional = backfilling && allAnchorsLocked;const [anchorsOpen, setAnchorsOpen] = useState(!allAnchorsLocked);// Reset the default on record switch only (deps: recordId), so it never// fights a user toggle within one character. The per-direction correction@@ -280,6 +285,7 @@ export default function ReferenceWorkflow({ record, reference, renders, correcti<h4 className="text-xs uppercase tracking-wide text-gray-500">1 · Turnaround sheet{turnaroundLocked && <span className="ml-1 text-[10px] text-port-success normal-case tracking-normal">· locked</span>}+ {backfillOptional && <span className="ml-1 text-[10px] text-gray-600 normal-case tracking-normal">· optional</span>}</h4>{turnaroundLocked ? (<div className="flex items-start gap-3">@@ -291,9 +297,11 @@ export default function ReferenceWorkflow({ record, reference, renders, correcti) : (<div className="space-y-2"><p className="text-[11px] text-gray-500">- {backfilling- ? 'This character was built before turnaround sheets. Generate one from its locked main reference — the remaining directional anchors will be drawn from it, so accessories stay on the same side of the body.'- : 'One image, four views (front · right · back · left). Every later render is redrawn from it, so a bag or pocket keeps the same anatomical side from every angle.'}+ {backfillOptional+ ? 'This character predates turnaround sheets and its reference set is already complete, so a sheet won’t change any locked artifact. Generating one is optional — it only gives future forks of this character all four sides to work from.'+ : backfilling+ ? 'This character was built before turnaround sheets. Generate one from its locked main reference — the remaining directional anchors will be drawn from it, so accessories stay on the same side of the body.'+ : 'One image, four views (front · right · back · left). Every later render is redrawn from it, so a bag or pocket keeps the same anatomical side from every angle.'}</p><textareavalue={designPrompt}@@ -551,7 +559,10 @@ export default function ReferenceWorkflow({ record, reference, renders, correctiopen={forkOpen}onClose={() => setForkOpen(false)}source={{ id: recordId, name: record.name }}- referencePath={manifest.mainReference.path}+ // Preview exactly what the fork will attach: the server's+ // lockedSeedArtifact prefers the sheet over the main.+ referencePath={turnaroundLocked ? manifest.turnaround.path : manifest.mainReference.path}+ fromTurnaround={turnaroundLocked}backends={backends}mode={mode}onForked={(rec) => onForked?.(rec)}diff --git a/server/services/sprites/reference.js b/server/services/sprites/reference.jsindex 14cd8b32ae..19224adbf4 100644--- a/server/services/sprites/reference.js+++ b/server/services/sprites/reference.js@@ -346,6 +346,12 @@ async function startReferenceGenerationImpl(recordId, body, upload = null) {fromTurnaround: turnaroundLocked,});if (turnaroundLocked) {+ // The sheet IS the seed here, so a caller-supplied one has nowhere to go.+ // Reject rather than silently dropping it (the route accepts an upload for+ // this target because a legacy record's main does take one).+ if (upload || body.initImageGalleryFile || body.initImageSpriteId) {+ throw new ServerError('The main reference derives from the locked turnaround sheet — seed a new design through the sheet, not the main', { status: 400, code: 'SEED_NOT_APPLICABLE' });+ }initImagePath = await requireLockedTurnaroundPath(recordId, manifest);initImageStrength ??= ANCHOR_DEFAULT_STRENGTH;} else {diff --git a/server/services/sprites/reference.test.js b/server/services/sprites/reference.test.jsindex 068aea7e21..92b5d7a93e 100644--- a/server/services/sprites/reference.test.js+++ b/server/services/sprites/reference.test.js@@ -78,10 +78,10 @@ async function lockMain(recordId) {return lockReference(recordId, { target: 'main', candidate: rel });}-// A pre-#2979 record: main-first manifest (schemaVersion 1, no turnaround-// block), written straight to disk the way an install upgraded from phase 2-// would have it, then locked through the legacy main path.-async function legacyLockedMain(recordId) {+// A pre-#2979 manifest: main-first (schemaVersion 1, no turnaround block),+// nothing locked — written straight to disk the way an install upgraded from+// phase 2 would have it mid-workflow.+async function writeLegacyManifest(recordId) {const dir = join(TEST_ROOT, 'sprites', recordId, 'reference');await mkdir(dir, { recursive: true });await writeFile(join(dir, `${recordId}-reference-set-v1.json`), JSON.stringify({@@ -94,6 +94,11 @@ async function legacyLockedMain(recordId) {anchors: ['south', 'south-east', 'east', 'north-east', 'north', 'north-west', 'west', 'south-west'].map((direction) => ({ id: `walk-${direction}`, kind: 'walk-anchor', direction, status: 'pending' })),}));+}++// …and the same record with its main locked through the legacy main-first path.+async function legacyLockedMain(recordId) {+ await writeLegacyManifest(recordId);const rel = await placeCandidate(recordId, 'main', 'walk-south-candidate-01.png');return lockReference(recordId, { target: 'main', candidate: rel });}@@ -202,6 +207,30 @@ describe('startReferenceGeneration', () => {expect(call.params.prompt).toContain('a wiry ranger');});+ it('400s a seed image sent with the main target once the sheet is locked', async () => {+ // The sheet IS the seed there, so a supplied one would be silently dropped+ // (the route allows an upload for `main` because a legacy record takes one).+ const id = newId();+ await createCharacter(id);+ await lockTurnaround(id);+ const galleryName = 'fork-seed.png';+ await writeCandidatePng(join(TEST_ROOT, 'images', galleryName));+ await expect(startReferenceGeneration(id, { target: 'main', initImageGalleryFile: galleryName }))+ .rejects.toMatchObject({ code: 'SEED_NOT_APPLICABLE', status: 400 });+ const tmp = join(TEST_ROOT, 'main-seed-tmp.png');+ await writeCandidatePng(tmp);+ await expect(startReferenceGeneration(id, { target: 'main' }, { tempPath: tmp, originalname: 'concept.png' }))+ .rejects.toMatchObject({ code: 'SEED_NOT_APPLICABLE', status: 400 });+ // A legacy record's main still accepts one — the gate is sheet-conditional,+ // not a blanket ban on seeding the main.+ const legacy = newId();+ await createCharacter(legacy);+ await writeLegacyManifest(legacy);+ enqueueJob.mockClear();+ await startReferenceGeneration(legacy, { target: 'main', designPrompt: 'x', initImageGalleryFile: galleryName });+ expect(enqueueJob.mock.calls[0][0].params.initImagePath).toBe(join(TEST_ROOT, 'images', galleryName));+ });+it('derives anchors from the locked turnaround via i2i with the selected key in the prompt', async () => {const id = newId();await createCharacter(id);