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 review: 422 not 207, fix sidecar map for local renders, doc shape

[._.]/ Adam Eivy4d8362a2ad85
diff --git a/server/routes/importer.js b/server/routes/importer.js
index f4988628a6..044d59f046 100644
--- a/server/routes/importer.js
+++ b/server/routes/importer.js
@@ -23,16 +23,20 @@ const router = Router();
// universe / series codes bubble through `getUniverse` / `getSeries` with
// their service-native codes (`NOT_FOUND` / `PIPELINE_SERIES_NOT_FOUND`),
// not an importer-prefixed alias — map those to 404.
-// `ERR_PARTIAL_COMMIT_ISSUES` maps to 207 Multi-Status (not 500) because
-// the universe + series writes succeeded and only the issue loop was
-// rolled back — alerting / generic-retry middleware that pages on 5xx
-// would otherwise treat this user-action-recoverable state as an infra
-// failure. 207 is the canonical "completed with mixed outcomes" code
-// and the client UI can render a tailored retry affordance.
+// `ERR_PARTIAL_COMMIT_ISSUES` maps to 422 (not 500) because the universe +
+// series writes succeeded and only the issue loop was rolled back —
+// alerting / generic-retry middleware that pages on 5xx would otherwise
+// treat this user-action-recoverable state as an infra failure. We picked
+// 422 over the original 207 because the client `request()` helper treats
+// 207 as a 2xx success (response.ok === true) and would interpret the
+// error body as a normal commit result, mis-toasting "Imported 0 issues"
+// and crashing on the missing createdIssueIds. 422 makes the helper throw
+// so the existing error toast surfaces the orchestrator's message
+// ("universe + series saved, retry to create the remaining issues").
const SERVICE_ERROR_STATUS = {
[ERR_VALIDATION]: 400,
[ERR_LOCKED]: 409,
- [ERR_PARTIAL_COMMIT_ISSUES]: 207,
+ [ERR_PARTIAL_COMMIT_ISSUES]: 422,
[universeSvc.ERR_NOT_FOUND]: 404,
[seriesSvc.ERR_NOT_FOUND]: 404,
};
diff --git a/server/routes/mediaAnnotations.js b/server/routes/mediaAnnotations.js
index 1f55a82103..133288cb0b 100644
--- a/server/routes/mediaAnnotations.js
+++ b/server/routes/mediaAnnotations.js
@@ -1,7 +1,7 @@
/**
* GET /api/media/annotations
- * → { [key]: { own: { authorName, starred, note, updatedAt } | null,
- * others: [{ instanceId, authorName, starred, note, updatedAt }] } }
+ * → { annotations: { [key]: { own: { authorName, starred, note, updatedAt } | null,
+ * others: [{ instanceId, authorName, starred, note, updatedAt }] } } }
* PATCH /api/media/annotations/:key
* body: { starred?: boolean, note?: string } — writes the local-author entry
* → { key, entry: { own, others } }
diff --git a/server/services/sharing/exporter.js b/server/services/sharing/exporter.js
index b3a5d83d8f..b68c2b0dc5 100644
--- a/server/services/sharing/exporter.js
+++ b/server/services/sharing/exporter.js
@@ -103,6 +103,12 @@ async function jobFromSidecar(jobId) {
if (jobId.includes('/') || jobId.includes('\\') || jobId.includes('..')) return null;
const sc = await readJSONFile(join(PATHS.images, `${jobId}.metadata.json`));
if (!sc) return null;
+ // Sidecar schema differs between paths:
+ // codex.js writes { mode: 'codex', model }
+ // local.js writes { modelId } and omits `mode` (it's locally-rendered)
+ // Map both to a unified { mode, model } so re-render fidelity is preserved
+ // for local renders too (without this, local-render shares lost both fields
+ // once the in-memory job queue aged out and re-render fell back to defaults).
return {
id: sc.id || jobId,
kind: 'image',
@@ -114,8 +120,11 @@ async function jobFromSidecar(jobId) {
negativePrompt: sc.negativePrompt,
width: sc.width,
height: sc.height,
- mode: sc.mode,
- model: sc.model,
+ mode: sc.mode || (sc.modelId ? 'local' : null),
+ model: sc.model || sc.modelId || null,
+ seed: sc.seed,
+ steps: sc.steps,
+ guidance: sc.guidance,
},
result: { filename: sc.filename },
};