Skip to content

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

address audit findings for the anchor correction prompt

[._.]/ Adam Eivyf65ec16dbf54
diff --git a/client/src/components/sprites/ReferenceWorkflow.jsx b/client/src/components/sprites/ReferenceWorkflow.jsx
index 86da97a1be..f40dbe5236 100644
--- a/client/src/components/sprites/ReferenceWorkflow.jsx
+++ b/client/src/components/sprites/ReferenceWorkflow.jsx
@@ -88,8 +88,10 @@ export default function ReferenceWorkflow({ record, reference, renders, backends
const allAnchorsLocked = anchorList.length > 0 && anchorList.every((a) => a.status === 'locked');
const [anchorsOpen, setAnchorsOpen] = useState(!allAnchorsLocked);
// Reset the default on record switch only (deps: recordId), so it never
- // fights a user toggle within one character.
- useEffect(() => { setAnchorsOpen(!allAnchorsLocked); }, [recordId]);
+ // fights a user toggle within one character. Also drop any per-direction
+ // correction text — the 8 anchor direction keys are identical across
+ // characters, so a leftover note would otherwise bleed into the next sprite.
+ useEffect(() => { setAnchorsOpen(!allAnchorsLocked); setCorrections({}); }, [recordId]);
// Image-backend availability + the selected `mode` are page-owned (#2938) so
// that the Sprites page's asset-card Regenerate re-rolls through the SAME
diff --git a/server/routes/sprites.test.js b/server/routes/sprites.test.js
index 388dd721c7..daa0982379 100644
--- a/server/routes/sprites.test.js
+++ b/server/routes/sprites.test.js
@@ -205,6 +205,19 @@ describe('sprites routes', () => {
);
});
+ it('POST /:id/reference/generate forwards an anchor correction prompt through the schema', async () => {
+ const r = await request(app).post('/api/sprites/pioneer/reference/generate')
+ .send({ target: 'north-east', correctionPrompt: 'no pocket on the right sleeve', mode: 'codex' });
+ expect(r.status).toBe(200);
+ // The field must survive validation — Zod strips unknown keys, so a dropped
+ // schema field would silently break the feature at the wire.
+ expect(reference.startReferenceGeneration).toHaveBeenCalledWith(
+ 'pioneer',
+ expect.objectContaining({ target: 'north-east', correctionPrompt: 'no pocket on the right sleeve' }),
+ null,
+ );
+ });
+
it('POST /:id/reference/generate rejects south and unknown targets', async () => {
for (const target of ['south', 'up', '']) {
const r = await request(app).post('/api/sprites/pioneer/reference/generate').send({ target });
diff --git a/server/services/sprites/reference.test.js b/server/services/sprites/reference.test.js
index c71fc1c424..03d0d571d4 100644
--- a/server/services/sprites/reference.test.js
+++ b/server/services/sprites/reference.test.js
@@ -242,6 +242,37 @@ describe('attachReferenceCandidate', () => {
expect(sidecar.model).toBe('retried-model');
});
+ it('records an anchor correction prompt in the sidecar as provenance', async () => {
+ const id = newId();
+ await createCharacter(id);
+ await mkdir(join(TEST_ROOT, 'images'), { recursive: true });
+ await writeCandidatePng(join(TEST_ROOT, 'images', 'render-3.png'));
+ await attachReferenceCandidate({
+ recordId: id, target: 'north-east', direction: 'north-east', anchorId: 'walk-north-east',
+ chromaKey: '#FF00FF', mode: 'codex', model: 'm', jobId: 'j3',
+ correctionPrompt: 'no pocket on the right sleeve', filename: 'render-3.png',
+ });
+ const sidecar = JSON.parse(await readFile(
+ join(TEST_ROOT, 'sprites', id, 'reference', 'candidates', 'walk-north-east-candidate-01.generation.json'), 'utf8',
+ ));
+ expect(sidecar.correctionPrompt).toBe('no pocket on the right sleeve');
+ });
+
+ it('omits correctionPrompt from the sidecar when absent', async () => {
+ const id = newId();
+ await createCharacter(id);
+ await mkdir(join(TEST_ROOT, 'images'), { recursive: true });
+ await writeCandidatePng(join(TEST_ROOT, 'images', 'render-4.png'));
+ await attachReferenceCandidate({
+ recordId: id, target: 'east', direction: 'east', anchorId: 'walk-east',
+ chromaKey: '#FF00FF', mode: 'codex', model: 'm', jobId: 'j4', filename: 'render-4.png',
+ });
+ const sidecar = JSON.parse(await readFile(
+ join(TEST_ROOT, 'sprites', id, 'reference', 'candidates', 'walk-east-candidate-01.generation.json'), 'utf8',
+ ));
+ expect(sidecar).not.toHaveProperty('correctionPrompt');
+ });
+
it('returns null when the gallery file is gone', async () => {
const id = newId();
await createCharacter(id);