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(render-clip): report the page's real fault instead of a bare 20s timeout
nirholas6a3aec061b4b
diff --git a/api/_lib/render-clip.js b/api/_lib/render-clip.jsindex fdda94a81..d0e1ea475 100644--- a/api/_lib/render-clip.js+++ b/api/_lib/render-clip.js@@ -283,6 +283,23 @@ export async function renderClip({}const browser = await getBrowser();const page = await browser.newPage();+ // The viewer sets window.__renderError from its own try/catch, but a failure+ // that stops the module from EXECUTING at all (a bad import specifier, a CDN+ // 404, a syntax error in an inlined pose module) never reaches that catch:+ // neither flag is ever written, so the wait below expired and the caller saw+ // only "Waiting failed: 20000ms exceeded" with the actual cause discarded.+ // Recording the page's own error channels here is what turns that opaque+ // timeout into the real reason.+ const pageFaults = [];+ const noteFault = (text) => {+ const line = String(text || '').replace(/\s+/g, ' ').trim().slice(0, 300);+ if (line && pageFaults.length < 5 && !pageFaults.includes(line)) pageFaults.push(line);+ };+ page.on('pageerror', (err) => noteFault(err?.message || err));+ page.on('console', (msg) => {+ if (msg.type() === 'error') noteFault(msg.text());+ });+ page.on('requestfailed', (req) => noteFault(`${req.url().slice(0, 120)} ${req.failure()?.errorText || 'request failed'}`));try {await page.setViewport({ width: W, height: H, deviceScaleFactor: 1 });// Pick a live three.js CDN first: an unpkg outage would otherwise hang@@ -291,10 +308,27 @@ export async function renderClip({const { base: threeBase } = await resolveThreeCdn(THREE_VERSION);const html = viewerHtml({ glbBase64, width: W, height: H, background, pose, cameraOrbit, expression, threeBase });await page.setContent(html, { waitUntil: 'domcontentloaded' });- await page.waitForFunction(- 'window.__renderDone === true || window.__renderError !== null',- { timeout: 20_000 },- );+ try {+ // polling:100 (a timer) rather than puppeteer's DEFAULT 'raf'. The viewer+ // sets __renderDone INSIDE a requestAnimationFrame callback and then goes+ // completely idle: nothing animates, so chromium stops scheduling frames+ // and an rAF-driven poller never runs again to observe the flag it was+ // waiting for. The render had already succeeded every time; the waiter+ // just never woke up, so the call burned its full budget and threw as if+ // the page had hung. A timer poller is not tied to frame production and+ // sees the flag on the next tick.+ await page.waitForFunction(+ 'window.__renderDone === true || window.__renderError !== null',+ { timeout: 20_000, polling: 100 },+ );+ } catch (err) {+ const why = pageFaults.length ? ` page reported: ${pageFaults.join(' | ')}` : ' page reported no error (the render loop never finished)';+ throw Object.assign(new Error(`render timed out after 20000ms.${why}`), {+ status: 504,+ code: 'render_timeout',+ pageFaults,+ });+ }const err = await page.evaluate(() => window.__renderError);if (err) {throw Object.assign(new Error(`render failed: ${err}`), { status: 502, code: 'render_failed' });diff --git a/docs/ops/gcp-model-workers.md b/docs/ops/gcp-model-workers.mdindex 3d668df00..199d80feb 100644--- a/docs/ops/gcp-model-workers.md+++ b/docs/ops/gcp-model-workers.md@@ -42,6 +42,17 @@ overrides the set without a deploy). A lane id in that override that matches noknown lane comes back in the tick's `unknown_lanes` and drops its `ok` to false,so a typo in the env var fails visibly instead of quietly warming nothing.+Every routed lane that scales to zero must appear in that registry even when it+is not warmed by default, because the registry is what the override can reach: a+lane missing from it is unwarmable at any quota, and its absence is invisible+(the tick's `skipped_for_quota` simply lists one fewer deferred lane and still+reads healthy). `model-hunyuan3d` sat outside it that way despite carrying the+fleet's longest spin-up. `tests/cron-forge-lane-guards.test.js` now pins the+registry against `BACKENDS`: every `provider: 'gcp'` lane with a+`coldStartSeconds` budget must be listed, under the same URL env var the router+itself resolves that worker from, so a typo'd `urlEnv` (which would report+`unconfigured` forever without ever throwing) fails the suite instead.+`us-east4` has its own grant of 3 L4s and the same arithmetic applies there. Itruns standbys of `model-trellis` (pinned at min 1), `model-hunyuan3d`,`model-triposr`, and `model-text2motion`, which is that region's production lanediff --git a/scripts/probe-generation-suite.mjs b/scripts/probe-generation-suite.mjsindex 5457ed3a0..a00ebd816 100644--- a/scripts/probe-generation-suite.mjs+++ b/scripts/probe-generation-suite.mjs@@ -449,7 +449,7 @@ async function probeX402() {});const accepts = r.json?.accepts || [];const ok = r.status === 402 && Array.isArray(accepts) && accepts.length > 0;- record('x402 challenge', 'POST /api/x402/forge', ok, ok ? `402 with ${accepts.length} accept(s): ${accepts.map((a) => `${a.network}/${a.maxAmountRequired}`).join(', ')}` : `HTTP ${r.status}: ${r.text.slice(0, 160)}`);+ record('x402 challenge', 'POST /api/x402/forge', ok, ok ? `402 with ${accepts.length} accept(s): ${accepts.map((a) => `${a.network}/${a.amount ?? a.maxAmountRequired ?? '?'}`).join(', ')}` : `HTTP ${r.status}: ${r.text.slice(0, 160)}`);const wk = await req('/.well-known/x402.json');const items = wk.json?.items || wk.json?.resources || [];const gen = items.filter((i) => String(i.resource || i.url || '').includes('forge') || String(i.resource || i.url || '').includes('mcp-3d'));@@ -469,17 +469,56 @@ async function probeMcp(path, label) {// Call a tool the server itself advertises as FREE, so a probe never bills a// generation just to prove the JSON-RPC surface answers. mcp-3d marks its// free tools in the description; fall back to a read-only-sounding name.- const readOnly =- tools.find((t) => /\bFREE\b/.test(t.description || '')) ||- tools.find((t) => /catalog|list|capabilit|health|search|browse/i.test(t.name));- if (!readOnly) return record(`${label} tools/call`, `POST ${path}`, 'skip', 'no read-only tool advertised');+ //+ // Prefer one that needs no arguments, and only then a free tool whose required+ // arguments we can honestly satisfy from our own reference assets. Calling a+ // required-argument tool with `{}` proves nothing: the server correctly answers+ // -32602 invalid params, which this leg then reported as a broken MCP surface.+ // That false red is what mcp-studio showed on 2026-09-08, where the first FREE+ // tool is look_at_model and it requires glb_url.+ const free = tools.filter((t) => /\bFREE\b/.test(t.description || ''));+ const named = tools.filter((t) => /catalog|list|capabilit|health|search|browse/i.test(t.name));+ const candidates = [...free, ...named];+ const argsFor = (tool) => {+ const schema = tool?.inputSchema || {};+ const required = Array.isArray(schema.required) ? schema.required : [];+ if (!required.length) return {};+ const args = {};+ for (const key of required) {+ if (/glb|mesh|model/i.test(key)) args[key] = REF_MESH;+ else if (/image|photo|view/i.test(key)) args[key] = REF_IMAGE;+ else return null; // cannot satisfy it honestly; try the next tool+ }+ return args;+ };+ let readOnly = null;+ let callArgs = null;+ for (const tool of candidates) {+ const a = argsFor(tool);+ if (a) {+ readOnly = tool;+ callArgs = a;+ break;+ }+ }+ if (!readOnly) return record(`${label} tools/call`, `POST ${path}`, 'skip', 'no free tool this probe can call honestly');const call = await req(path, {method: 'POST',- body: { jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name: readOnly.name, arguments: {} } },- timeoutMs: 60_000,+ body: { jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name: readOnly.name, arguments: callArgs } },+ timeoutMs: 120_000,});const content = call.json?.result?.content || [];- record(`${label} tools/call`, `${readOnly.name}`, call.status === 200 && content.length > 0 && !call.json?.result?.isError, call.status === 200 ? `${readOnly.name} → ${content.length} content block(s)` : `HTTP ${call.status}: ${call.text.slice(0, 140)}`);+ const rpcError = call.json?.error?.message;+ record(+ `${label} tools/call`,+ `${readOnly.name}`,+ call.status === 200 && !rpcError && content.length > 0 && !call.json?.result?.isError,+ rpcError+ ? `${readOnly.name} → JSON-RPC error: ${String(rpcError).slice(0, 120)}`+ : call.status === 200+ ? `${readOnly.name} → ${content.length} content block(s)`+ : `HTTP ${call.status}: ${call.text.slice(0, 140)}`,+ );}// The talking-avatar lane (workers/longcat). Its own README records the workerdiff --git a/tests/forge-inline-views.test.js b/tests/forge-inline-views.test.jsindex cdf5bf8b1..80f8d19d0 100644--- a/tests/forge-inline-views.test.js+++ b/tests/forge-inline-views.test.js@@ -1,4 +1,4 @@-// backendAcceptsInlineViews — api/_lib/forge-tiers.js.+// backendAcceptsInlineViews in api/_lib/forge-tiers.js.//// The predicate that makes the object-storage failover safe. When the bucket// refuses to park a synthesized reference view, _lib/image-persist.js hands back