Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(x-content): stop adopt from deleting stories when one of them fails validation
nirholasdc760b337d5a
diff --git a/api/_lib/x-content/queue.js b/api/_lib/x-content/queue.jsindex 56b7a2edb..c66533575 100644--- a/api/_lib/x-content/queue.js+++ b/api/_lib/x-content/queue.js@@ -153,6 +153,10 @@ function postProblems(item, root, { headMinimum, headNeedsUrl, maximum }) {for (const problem of copyProblems(post.text, { minimum: index === 0 ? headMinimum : 1, maximum, requireUrl: false })) {problems.push(`${label}: ${problem}`);}+ if (post.media != null && !Array.isArray(post.media)) {+ problems.push(`${label}: media must be a list of { path, alt } entries, not ${JSON.stringify(post.media)}`);+ return;+ }for (const problem of attachmentProblems(post.media)) problems.push(`${label}: ${problem}`);for (const media of post.media || []) for (const problem of mediaProblems(media, root)) problems.push(`${label}: ${problem}`);});diff --git a/deploy/x-partners/README.md b/deploy/x-partners/README.mdindex 68ff2f9e7..63daeb974 100644--- a/deploy/x-partners/README.md+++ b/deploy/x-partners/README.md@@ -17,4 +17,4 @@ node scripts/create-x-partners-job.mjs --run-now # the same, then start one ruShipping a bundle publishes to @trythreews, so applying this is an owner decision. Nothing posts on its own until production has `X_CONTENT_AUTO_PUBLISH=true`, and every released spotlight still sits behind the queue's veto window.-The job runs as `three-ws@`, takes 2 CPU and 4 GiB, times out after an hour, and never retries: three days are kept in stock, so a failed run is refilled by the next one. Rebuild the image (`--apply` without `--skip-build`) after the registry or the engine changes, because the job films and drafts from the code baked into it.+The job runs as `three-ws@`, takes 2 CPU and 4 GiB, times out after three hours, and never retries: three days are kept in stock, so a failed run is refilled by the next one. Rebuild the image (`--apply` without `--skip-build`) after the registry or the engine changes, because the job films and drafts from the code baked into it.diff --git a/scripts/x-content.mjs b/scripts/x-content.mjsindex 4a7e89444..7d7a7b14b 100644--- a/scripts/x-content.mjs+++ b/scripts/x-content.mjs@@ -513,6 +513,7 @@ async function adopt() {if (!files.length) fail(`no stories to adopt in ${STORY_DIR}${wanted.length ? ` named ${wanted.join(', ')}` : ''}`);const queue = loadQueue(root);let refused = 0;+ const adopted = [];for (const name of files) {const path = resolve(dir, name);const story = JSON.parse(readFileSync(path, 'utf8'));@@ -528,10 +529,13 @@ async function adopt() {const problems = validateItem(item, root, { quality: queue.quality || {} });if (existing >= 0) queue.items[existing] = item;else queue.items.push(item);- rmSync(path);+ adopted.push(path);console.log(`ok ${story.id}: in the queue as a draft${problems.length ? `, with ${problems.length} problem(s) to fix: ${problems[0]}` : ''}`);}+ // The queue is written before any story is removed, so a failure part way+ // through leaves every story where it was.saveQueue(queue);+ for (const path of adopted) rmSync(path);if (refused) process.exit(1);}diff --git a/tests/x-content.test.js b/tests/x-content.test.jsindex ab003c186..d03407b90 100644--- a/tests/x-content.test.js+++ b/tests/x-content.test.js@@ -581,6 +581,16 @@ describe('queue', () => {expect(validateItem({ ...base, textOnly: true, posts: [{ text: HEAD }] }, dir)).toEqual([]);});+ // A story written with the shorthand "media": "reel" threw inside adopt,+ // after adopt had already deleted the stories before it.+ it('reports media that is not a list instead of throwing', () => {+ const dir = sandbox();+ const base = { id: 'demo', status: 'draft', kind: 'post', tier: 2, lane: 'l', pattern: 'p', notBefore: '2026-09-17T14:00:00Z' };+ const problems = () => validateItem({ ...base, posts: [{ text: HEAD, media: 'reel' }] }, dir);+ expect(problems).not.toThrow();+ expect(problems().join('\n')).toMatch(/head: media must be a list/);+ });+it('validates an Article end to end', () => {const dir = sandbox();writeFileSync(join(dir, 'data/x-content/articles/demo.md'), '## Why\n\nBecause.\n\n\n\nThe end.');