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(vision): report every rung the vision chain tried instead of only the last failure
nirholase4a50bcc16c6
diff --git a/api/_lib/vision.js b/api/_lib/vision.jsindex 2b4c1b659..cef48e976 100644--- a/api/_lib/vision.js+++ b/api/_lib/vision.js@@ -407,6 +407,14 @@ export async function describeImage({}let lastErr;+ // Every rung's verdict, in the order they were tried. Only the LAST failure+ // used to survive, which made a dead chain unreadable: the caller was told+ // "openai vision 429: billing_not_active" while the actual problem was that+ // the free NIM lanes and the Vertex anchor ahead of it had already failed for+ // two entirely different reasons. Whoever has to fix it needs all three, so+ // the whole walk is carried on the thrown error and rendered by the handler.+ /** @type {{ provider: string, model: string|null, status: number|null, detail: string }[]} */+ const attempts = [];// Hosts this request has already proven sick (a throttle, a dead key, an// unreachable socket). Skipping their remaining rungs inside THIS request is// the difference between paying one doomed attempt and paying one per model@@ -445,6 +453,7 @@ export async function describeImage({// and benching the sibling rung on that guess would discard the very// redundancy the second rung exists to provide.coolLane(order, p, { seconds: VISION_LANE_COOLDOWN_SECONDS, reason: 'health', hostWide: false });+ attempts.push({ provider: p.name, model: p.model || null, status: null, detail: `unreachable: ${String(e.message).slice(0, 160)}` });lastErr = Object.assign(new Error(`${p.name} vision unreachable: ${e.message}`), { status: 502, code: 'provider_unreachable' });continue;}@@ -470,6 +479,7 @@ export async function describeImage({hostWide: st === 429,});if (st === 429) sickHosts.add(laneHost(p));+ attempts.push({ provider: p.name, model: p.model || null, status: st, detail: body.slice(0, 160) });lastErr = Object.assign(new Error(`${p.name} vision ${upstream.status}: ${body.slice(0, 200)}`),{ status: 502, code: normalizeStatus(upstream.status) },@@ -491,7 +501,7 @@ export async function describeImage({raw: data,};}- throw lastErr || new VisionUnavailableError();+ throw Object.assign(lastErr || new VisionUnavailableError(), { lanes: attempts });}// Convenience: describeImage + tolerant JSON parse of the reply. VLMs reliablydiff --git a/api/vision.js b/api/vision.jsindex 0b15cad3c..ad5b698f5 100644--- a/api/vision.js+++ b/api/vision.js@@ -163,6 +163,21 @@ export default wrap(async function handler(req, res) {// invalid_image_url / no_image are caller errors (400); everything else is// an upstream failure surfaced as 502.const status = e?.code === 'invalid_image_url' || e?.code === 'no_image' ? 400 : (e?.status || 502);- return error(res, status, e?.code || 'upstream_error', `Image understanding failed: ${e?.message || 'unknown error'}`);+ // When the whole chain failed, the last rung's message alone is actively+ // misleading (it names the backstop's billing state, not the reason the+ // free lanes ahead of it did not answer). Every rung that was tried is+ // listed so an operator sees which one to fix. Provider error bodies only;+ // no request content and no credentials pass through here.+ const lanes = Array.isArray(e?.lanes) ? e.lanes : [];+ const summary = lanes.length+ ? ` Chain: ${lanes.map((l) => `${l.provider}=${l.status ?? 'unreachable'}`).join(', ')}.`+ : '';+ return error(+ res,+ status,+ e?.code || 'upstream_error',+ `Image understanding failed: ${e?.message || 'unknown error'}.${summary}`,+ lanes.length ? { lanes } : undefined,+ );}});