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(segment): refuse FBX with a clear message instead of an opaque internal error
nirholas2763e0171073
diff --git a/api/_lib/mesh-input.js b/api/_lib/mesh-input.jsnew file mode 100644index 000000000..6d664e10b--- /dev/null+++ b/api/_lib/mesh-input.js@@ -0,0 +1,45 @@+/**+ * Input formats the trimesh-based mesh workers can read, and the refusal for+ * the one they cannot.+ *+ * workers/stylize and workers/segment load meshes with trimesh, which has no+ * FBX reader, and neither image carries a converter. Before this check an FBX+ * was accepted, queued, and then failed inside the worker as an opaque internal+ * error. Both workers refuse FBX themselves too (a 422 on the URL, and a byte+ * sniff for an FBX behind an extensionless URL); refusing here as well turns+ * that into a clean 400 for REST callers and an MCP tool error for agents,+ * instead of a 502 relayed from the worker or a job that can only fail.+ *+ * workers/remesh is the one mesh lane that reads FBX (through headless+ * Blender), so every refusal points there.+ *+ * Kept in lockstep with SUPPORTED_INPUT_LABEL in workers/stylize/main.py and+ * workers/segment/main.py.+ */++export const MESH_INPUT_FORMATS = 'GLB, GLTF, OBJ, STL, PLY, OFF or DAE';++/**+ * The caller-facing refusal for an FBX sent to a lane that cannot read it.+ * @param {string} lane worker name as callers know it ("stylize", "segment")+ * @param {string} goal what the caller was trying to do, e.g. "restyle an FBX"+ */+export function fbxUnsupportedMessage(lane, goal) {+ return (+ `FBX input is not supported by ${lane}: supply ${MESH_INPUT_FORMATS}. ` ++ `To ${goal}, convert it to GLB first with remesh (operation "convert", ` ++ 'output_format "glb" via /api/forge-remesh or the remesh_model MCP tool), which reads FBX.'+ );+}++export const STYLIZE_FBX_MESSAGE = fbxUnsupportedMessage('stylize', 'restyle an FBX');+export const SEGMENT_FBX_MESSAGE = fbxUnsupportedMessage('segment', 'split an FBX into parts');++/** True when the URL's path names an FBX file, whatever the query string carries. */+export function isFbxMeshUrl(url) {+ try {+ return /\.fbx$/i.test(new URL(url).pathname);+ } catch {+ return false;+ }+}diff --git a/api/_lib/stylize-input.js b/api/_lib/stylize-input.jsdeleted file mode 100644index a28479526..000000000--- a/api/_lib/stylize-input.js+++ /dev/null@@ -1,29 +0,0 @@-/**- * Input formats the stylize worker can read, and the refusal for the one it- * cannot.- *- * workers/stylize loads meshes with trimesh, which has no FBX reader, and its- * image carries no converter. Before this check an FBX was accepted, queued,- * and then failed inside the worker as an opaque internal error. The worker- * refuses FBX itself too (a 422 on the URL, and a byte sniff for an FBX behind- * an extensionless URL); refusing here as well turns that into a clean 400 for- * callers instead of a 502 relayed from the worker.- *- * Kept in lockstep with SUPPORTED_INPUT_LABEL in workers/stylize/main.py.- */--export const STYLIZE_INPUT_FORMATS = 'GLB, GLTF, OBJ, STL, PLY, OFF or DAE';--export const STYLIZE_FBX_MESSAGE =- `FBX input is not supported by stylize: supply ${STYLIZE_INPUT_FORMATS}. ` +- 'To restyle an FBX, convert it to GLB first with remesh (operation "convert", ' +- 'output_format "glb" via /api/forge-remesh or the remesh_model MCP tool), which reads FBX.';--/** True when the URL's path names an FBX file, whatever the query string carries. */-export function isFbxMeshUrl(url) {- try {- return /\.fbx$/i.test(new URL(url).pathname);- } catch {- return false;- }-}diff --git a/api/_mcp3d/tools/studio.js b/api/_mcp3d/tools/studio.jsindex 09e035a75..b0de575c4 100644--- a/api/_mcp3d/tools/studio.js+++ b/api/_mcp3d/tools/studio.js@@ -21,7 +21,7 @@ import { limits } from '../../_lib/rate-limit.js';import { assertSafePublicUrl, fetchSafePublicUrlPinned, MaxBytesExceededError } from '../../_lib/ssrf-guard.js';import { createRegenProvider as createReplicateProvider } from '../../_providers/replicate.js';import { createRegenProvider as createGcpProvider } from '../../_providers/gcp.js';-import { isFbxMeshUrl, STYLIZE_FBX_MESSAGE } from '../../_lib/stylize-input.js';+import { isFbxMeshUrl, SEGMENT_FBX_MESSAGE, STYLIZE_FBX_MESSAGE } from '../../_lib/mesh-input.js';import { BYOK_PROVIDER_FACTORIES, isByokGeometryBackend } from '../../_providers/byok-registry.js';import { textToImage } from '../text-to-image.js';import {@@ -1430,7 +1430,8 @@ export const toolDefs = [mesh_url: {type: 'string',format: 'uri',- description: 'Public https URL of the source mesh (GLB/OBJ/FBX/STL/PLY).',+ description:+ 'Public https URL of the source mesh (GLB/GLTF/OBJ/STL/PLY/OFF/DAE). FBX is refused: convert it with remesh_model first.',},method: {type: 'string',@@ -1483,6 +1484,9 @@ export const toolDefs = [isError: true,};}+ if (isFbxMeshUrl(args.mesh_url)) {+ return { content: [{ type: 'text', text: `Error: ${SEGMENT_FBX_MESSAGE}` }], isError: true };+ }const provider = regenProvider('segment');const job = await provider.submit({mode: 'segment',diff --git a/api/forge-segment.js b/api/forge-segment.jsindex a5ea8cf3b..4b0170c26 100644--- a/api/forge-segment.js+++ b/api/forge-segment.js@@ -2,7 +2,7 @@* /api/forge-segment — split a 3D model into named, addressable parts.** POST /api/forge-segment {- * mesh_url: string,+ * mesh_url: string, // GLB/GLTF/OBJ/STL/PLY/OFF/DAE; FBX is a 400* method?: "auto"|"connected"|"crease",* max_parts?: number, // 2–64* min_part_faces?: number, // 4–100000@@ -21,6 +21,7 @@ import { cors, json, method, readJson, wrap, rateLimited } from './_lib/http.js'import { limits, clientIp } from './_lib/rate-limit.js';import { assertPublicHttpsUrl, SsrfError } from './_lib/ssrf.js';import { createRegenProvider } from './_providers/gcp.js';+import { isFbxMeshUrl, SEGMENT_FBX_MESSAGE } from './_lib/mesh-input.js';// Provider job ids are base64url JSON envelopes (packJobId in _providers/gcp.js)// and run several hundred chars — a 64-char cap 400s every poll.@@ -57,6 +58,9 @@ async function startJob(req, res) {message: err instanceof SsrfError ? `mesh_url rejected: ${err.message}` : 'mesh_url must be a public https URL.',});}+ if (isFbxMeshUrl(meshUrl)) {+ return json(res, 400, { error: 'unsupported_mesh_format', message: SEGMENT_FBX_MESSAGE });+ }const segMethod = VALID_METHODS.has(body?.method) ? body.method : 'auto';const maxParts = Math.max(2, Math.min(64, Number(body?.max_parts) || 24));diff --git a/api/forge-stylize.js b/api/forge-stylize.jsindex 924dcb0d5..bf9fecc43 100644--- a/api/forge-stylize.js+++ b/api/forge-stylize.js@@ -20,7 +20,7 @@ import { cors, json, method, readJson, wrap, rateLimited } from './_lib/http.js'import { limits, clientIp } from './_lib/rate-limit.js';import { assertPublicHttpsUrl, SsrfError } from './_lib/ssrf.js';import { createRegenProvider } from './_providers/gcp.js';-import { isFbxMeshUrl, STYLIZE_FBX_MESSAGE } from './_lib/stylize-input.js';+import { isFbxMeshUrl, STYLIZE_FBX_MESSAGE } from './_lib/mesh-input.js';// Provider job ids are base64url JSON envelopes (packJobId in _providers/gcp.js)// and run several hundred chars — a 64-char cap 400s every poll.diff --git a/docs/forge.md b/docs/forge.mdindex bdedf1104..0e691064c 100644--- a/docs/forge.md+++ b/docs/forge.md@@ -232,12 +232,13 @@ drop it to remesh and convert in one pass (see[3d-asset-pipeline.md](3d-asset-pipeline.md)).`mesh_url` can point at a GLB, GLTF, OBJ, STL, PLY, OFF, DAE or binary FBX-(7.1 or later). That makes remesh the way in for an FBX: stylize does not read-FBX (`/api/forge-stylize` answers `400 unsupported_mesh_format`), so convert it-to GLB first and stylize the result.+(7.1 or later). That makes remesh the way in for an FBX: stylize and segment do+not read FBX (`/api/forge-stylize` and `/api/forge-segment` answer+`400 unsupported_mesh_format`), so convert it to GLB first and stylize or+segment the result.```bash-# FBX in, GLB out, ready for /api/forge-stylize.+# FBX in, GLB out, ready for /api/forge-stylize or /api/forge-segment.curl -sX POST https://three.ws/api/forge-remesh \-H 'content-type: application/json' \-d '{"mesh_url":"https://.../character.fbx","operation":"convert","output_format":"glb"}'diff --git a/docs/mcp-3d-studio.md b/docs/mcp-3d-studio.mdindex a029cef4e..92ac56d08 100644--- a/docs/mcp-3d-studio.md+++ b/docs/mcp-3d-studio.md@@ -35,6 +35,8 @@ analyze: inspect_model · optimize_model preview: preview_3d| `text_to_3d(prompt, aspect_ratio?, tier?, path?, backend?)` | Text → reference image → reconstructed GLB. Returns a `job_id` + the intermediate preview image. || `image_to_3d(image_url \| image_urls[], prompt?, tier?, path?, backend?)` | Reconstruct a GLB from 1–4 reference views (multi-view removes back-of-object hallucination). Returns a `job_id`. || `generation_status(job_id)` | Poll any job. When done, returns the GLB URL **and** an inline `<model-viewer>` artifact. Provider-aware: routes geometry/self-host jobs to the right upstream. |+| `cad_generate(prompt, parent_id?, values?)` | Description → **parametric CAD**: a build123d program the OpenCascade kernel has accepted, saved with STEP, STL, GLB (true scale) and an SVG drawing, plus a `/cad/:id` page with dimension sliders. Synchronous, usually 20-90 s. For brackets, enclosures, gears and other functional parts. See [CAD Forge](./cad-forge.md). |+| `cad_rebuild(id, values)` | Rebuild a CAD Forge design at new parameter values (e.g. `{"WIDTH": 120}`) on the kernel, no model involved. Exact and cached per value set. |### Rig, animate & pose@@ -54,7 +56,7 @@ analyze: inspect_model · optimize_model preview: preview_3d| ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- || `remesh_model(mesh_url, operation?, target_faces?, output_format?)` | Repair, simplify (quadric decimation), or convert format (incl. FBX with skeleton for Unity/Unreal). Reads GLB/GLTF/OBJ/STL/PLY/OFF/DAE and binary FBX 7.1+. || `stylize_model(mesh_url, style?, resolution?, output_format?)` | One-pass geometric restyle: `voxel`, `brick` (LEGO-like), `voronoi` lattice, `lowpoly`. Reads GLB/GLTF/OBJ/STL/PLY/OFF/DAE; convert an FBX with `remesh_model` first. |-| `segment_model(mesh_url, method?, max_parts?, …)` | Split into named, separable parts (each a node) + a parts manifest. |+| `segment_model(mesh_url, method?, max_parts?, …)` | Split into named, separable parts (each a node) + a parts manifest. Reads GLB/GLTF/OBJ/STL/PLY/OFF/DAE; convert an FBX with `remesh_model` first. || `retexture_model(mesh_url, prompt, num_views?, texture_size?)` | Paint a fresh texture from a prompt (SDXL + ControlNet depth, multi-view back-projection). || `retexture_region(mesh_url, mask_url, prompt?, color?, …)` | Magic-brush: repaint only a masked UV region, feathering the seam. || `generate_material(description, name?)` | IBM Granite → a glTF 2.0 PBR material (base color, metallic, roughness, emissive). |@@ -217,6 +219,8 @@ For tool calls there are two lanes:| `auto_rig_model`, `retexture_model`, `retexture_region` | $0.05 || `stylize_model`, `remesh_model`, `segment_model` | $0.02 || `capture_scene`, `anchor_provenance` | $0.05 |+| `cad_generate` | $0.05 |+| `cad_rebuild` | $0.01 || `remove_background`, `pose_model`, `apply_animation`, `direct_prompt`, `generate_material` | $0.01 || `generation_status`, `preview_3d`, `list_animations`, `animation_signature`, `find_similar_animations`, `text_to_animation`, `inspect_model`, `optimize_model`, `save_avatar`, `export_ar`, `verify_provenance`, `grade_sim_readiness`, `x402_preflight`, the persona tools (including `persona_payment_preview`), `read_resource`, `validate_spatial_response`, `getting_started` | free |diff --git a/docs/media-api.md b/docs/media-api.mdindex 51fe5ff59..bf225ee14 100644--- a/docs/media-api.md+++ b/docs/media-api.md@@ -899,7 +899,7 @@ auth; rate-limited per IP.| Field | Type | Default | Notes ||-------|------|---------|-------|-| `mesh_url` | string | required | Public https URL of the GLB. SSRF-validated server-side. |+| `mesh_url` | string | required | Public https URL of the mesh: GLB, GLTF, OBJ, STL, PLY, OFF or DAE. SSRF-validated server-side. FBX is refused (see Errors). || `method` | enum | `auto` | `auto`, `connected` (connected components), or `crease` (split at hard edges). || `max_parts` | integer | `24` | 2 to 64. || `min_part_faces` | integer | `64` | 4 to 100000. Parts smaller than this are merged. |@@ -935,6 +935,7 @@ Fields are `null` until the stage that produces them completes; on failure| Situation | Response ||-----------|----------|| Missing/non-public `mesh_url` | `400 invalid_mesh_url` |+| `mesh_url` names an `.fbx` file | `400 unsupported_mesh_format`; convert it to GLB with [`/api/forge-remesh`](forge.md#download-formats) (`"operation":"convert","output_format":"glb"`) first || Malformed `?job=` | `400 invalid_job` (missing entirely: `400 missing_job`) || Worker not deployed on this environment | `503 unconfigured` || Worker rejected the job | `502 segment_failed` |diff --git a/public/mcp-catalog.json b/public/mcp-catalog.jsonindex bf2deca64..bb595daa9 100644--- a/public/mcp-catalog.json+++ b/public/mcp-catalog.json@@ -16690,7 +16690,7 @@"mesh_url": {"type": "string","format": "uri",- "description": "Public https URL of the source mesh (GLB/OBJ/FBX/STL/PLY)."+ "description": "Public https URL of the source mesh (GLB/GLTF/OBJ/STL/PLY/OFF/DAE). FBX is refused: convert it with remesh_model first."},"method": {"type": "string",diff --git a/tests/api/mesh-fbx-input.test.js b/tests/api/mesh-fbx-input.test.jsnew file mode 100644index 000000000..f78b9b4a8--- /dev/null+++ b/tests/api/mesh-fbx-input.test.js@@ -0,0 +1,209 @@+/**+ * FBX input on the trimesh-based mesh lanes (stylize and segment).+ *+ * workers/stylize and workers/segment read meshes with trimesh, which has no+ * FBX reader, and neither image carries a converter. An FBX used to be+ * accepted, queued, and then fail inside the worker as an opaque internal+ * error. The REST routes and the MCP tools now refuse it up front with the+ * formats that work and the way to convert, and never reach the worker.+ *+ * The SSRF guards (DNS), the rate limiter, the DB, and the GCP provider+ * (network) are the mocked boundaries; the real handlers, tool handlers, and+ * input check run.+ */++import { describe, it, expect, vi, beforeEach } from 'vitest';++vi.mock('../../api/_lib/rate-limit.js', () => ({+ limits: {+ mcp3dGenerate: async () => ({ success: true, limit: 60, remaining: 59, reset: Date.now() + 60_000 }),+ mcp3dStatus: async () => ({ success: true, limit: 60, remaining: 59, reset: Date.now() + 60_000 }),+ },+ clientIp: () => '203.0.113.9',+}));++vi.mock('../../api/_lib/db.js', () => ({+ sql: async () => [],+ isDbUnavailableError: () => false,+ isDbCapacityError: () => false,+ isStoragePressured: async () => ({ pressured: false }),+}));++// The MCP tools check URLs through ssrf-guard, the REST routes through ssrf.+vi.mock('../../api/_lib/ssrf-guard.js', async (importOriginal) => ({+ ...(await importOriginal()),+ assertSafePublicUrl: async (raw) => new URL(raw),+}));++class FakeSsrfError extends Error {}+vi.mock('../../api/_lib/ssrf.js', () => ({+ SsrfError: FakeSsrfError,+ assertPublicHttpsUrl: async (raw) => {+ if (typeof raw !== 'string' || !raw.startsWith('https://')) throw new FakeSsrfError('must be https');+ return new URL(raw).href;+ },+}));++const submitted = [];+vi.mock('../../api/_providers/gcp.js', () => ({+ createRegenProvider: () => ({+ supportsMode: () => true,+ submit: async (request) => {+ submitted.push(request);+ return { extJobId: 'job-mesh-input-test-000000000000', eta: 20 };+ },+ }),+}));++const { isFbxMeshUrl, fbxUnsupportedMessage, MESH_INPUT_FORMATS, STYLIZE_FBX_MESSAGE, SEGMENT_FBX_MESSAGE } =+ await import('../../api/_lib/mesh-input.js');++const AUTH = { userId: null, rateKey: 'test-caller' };++async function studioTool(name) {+ const { toolDefs } = await import('../../api/_mcp3d/tools/studio.js');+ return toolDefs.find((t) => t.name === name);+}++function mkReq(body) {+ return {+ method: 'POST',+ url: '/',+ headers: { 'content-type': 'application/json' },+ rawBody: Buffer.from(JSON.stringify(body)),+ on() {},+ destroy() {},+ };+}++function mkRes() {+ return {+ statusCode: 200,+ headers: {},+ body: undefined,+ writableEnded: false,+ headersSent: false,+ setHeader(k, v) {+ this.headers[k.toLowerCase()] = v;+ },+ getHeader(k) {+ return this.headers[k.toLowerCase()];+ },+ end(b) {+ this.body = b === undefined ? '' : String(b);+ this.writableEnded = true;+ },+ };+}++async function post(route, body) {+ const { default: handler } = await import(`../../api/${route}.js`);+ const res = mkRes();+ await handler(mkReq(body), res);+ return { status: res.statusCode, body: res.body ? JSON.parse(res.body) : undefined };+}++beforeEach(() => {+ submitted.length = 0;+ process.env.GCP_RECONSTRUCTION_KEY = 'test-shared-worker-key';+});++describe('isFbxMeshUrl', () => {+ it('matches an FBX path in any case, ignoring the query string', () => {+ expect(isFbxMeshUrl('https://cdn.example/rig.fbx')).toBe(true);+ expect(isFbxMeshUrl('https://cdn.example/rig.FBX?sig=abc&exp=1')).toBe(true);+ });++ it('does not match other formats, an fbx query value, or a malformed URL', () => {+ expect(isFbxMeshUrl('https://cdn.example/scene.dae')).toBe(false);+ expect(isFbxMeshUrl('https://cdn.example/model.glb?name=rig.fbx')).toBe(false);+ expect(isFbxMeshUrl('not a url')).toBe(false);+ });+});++describe('the FBX refusal copy', () => {+ it('names every format the trimesh workers read', () => {+ expect(MESH_INPUT_FORMATS).toBe('GLB, GLTF, OBJ, STL, PLY, OFF or DAE');+ });++ it('names the lane, the formats, and the remesh convert path', () => {+ for (const [lane, message] of [+ ['stylize', STYLIZE_FBX_MESSAGE],+ ['segment', SEGMENT_FBX_MESSAGE],+ ]) {+ expect(message).toContain(`not supported by ${lane}`);+ expect(message).toContain(MESH_INPUT_FORMATS);+ expect(message).toContain('remesh_model');+ expect(message).toContain('/api/forge-remesh');+ }+ expect(SEGMENT_FBX_MESSAGE).toBe(fbxUnsupportedMessage('segment', 'split an FBX into parts'));+ });+});++describe('stylize_model MCP tool', () => {+ it('refuses an FBX mesh_url with the supported formats and queues nothing', async () => {+ const def = await studioTool('stylize_model');+ const out = await def.handler({ mesh_url: 'https://cdn.example/rig.fbx', style: 'voxel' }, AUTH);+ expect(out.isError).toBe(true);+ expect(out.content[0].text).toContain(MESH_INPUT_FORMATS);+ expect(submitted).toHaveLength(0);+ });++ it('still queues a DAE mesh', async () => {+ const def = await studioTool('stylize_model');+ const out = await def.handler({ mesh_url: 'https://cdn.example/scene.dae', style: 'voxel' }, AUTH);+ expect(out.isError).toBeFalsy();+ expect(submitted).toHaveLength(1);+ expect(submitted[0]).toMatchObject({ mode: 'stylize', sourceUrl: 'https://cdn.example/scene.dae' });+ });+});++describe('segment_model MCP tool', () => {+ it('refuses an FBX mesh_url with the supported formats and queues nothing', async () => {+ const def = await studioTool('segment_model');+ const out = await def.handler({ mesh_url: 'https://cdn.example/Character.FBX?sig=1' }, AUTH);+ expect(out.isError).toBe(true);+ expect(out.content[0].text).toBe(`Error: ${SEGMENT_FBX_MESSAGE}`);+ expect(submitted).toHaveLength(0);+ });++ it('still queues a DAE mesh', async () => {+ const def = await studioTool('segment_model');+ const out = await def.handler({ mesh_url: 'https://cdn.example/scene.dae' }, AUTH);+ expect(out.isError).toBeFalsy();+ expect(submitted).toHaveLength(1);+ expect(submitted[0]).toMatchObject({ mode: 'segment', sourceUrl: 'https://cdn.example/scene.dae' });+ });++ it('no longer advertises FBX in its mesh_url schema', async () => {+ const def = await studioTool('segment_model');+ const desc = def.inputSchema.properties.mesh_url.description;+ expect(desc).toContain('GLB/GLTF/OBJ/STL/PLY/OFF/DAE');+ expect(desc).toMatch(/FBX is refused/);+ });+});++describe('POST /api/forge-segment', () => {+ it('answers 400 unsupported_mesh_format for an FBX and queues nothing', async () => {+ const res = await post('forge-segment', { mesh_url: 'https://cdn.example/rig.fbx' });+ expect(res.status).toBe(400);+ expect(res.body).toEqual({ error: 'unsupported_mesh_format', message: SEGMENT_FBX_MESSAGE });+ expect(submitted).toHaveLength(0);+ });++ it('still queues a GLB', async () => {+ const res = await post('forge-segment', { mesh_url: 'https://cdn.example/mesh.glb', max_parts: 8 });+ expect(res.status).toBe(202);+ expect(submitted).toHaveLength(1);+ expect(submitted[0]).toMatchObject({ mode: 'segment', sourceUrl: 'https://cdn.example/mesh.glb' });+ });+});++describe('POST /api/forge-stylize', () => {+ it('answers 400 unsupported_mesh_format for an FBX and queues nothing', async () => {+ const res = await post('forge-stylize', { mesh_url: 'https://cdn.example/rig.fbx', style: 'voxel' });+ expect(res.status).toBe(400);+ expect(res.body).toEqual({ error: 'unsupported_mesh_format', message: STYLIZE_FBX_MESSAGE });+ expect(submitted).toHaveLength(0);+ });+});diff --git a/tests/api/stylize-fbx-input.test.js b/tests/api/stylize-fbx-input.test.jsdeleted file mode 100644index 2e8036ed1..000000000--- a/tests/api/stylize-fbx-input.test.js+++ /dev/null@@ -1,86 +0,0 @@-/**- * FBX input on the stylize lane.- *- * workers/stylize reads meshes with trimesh, which has no FBX reader, and its- * image carries no converter. An FBX used to be accepted, queued, and then fail- * inside the worker as an opaque internal error. The REST route and the- * stylize_model MCP tool now refuse it up front with the formats that work and- * the way to convert, and never reach the worker.- *- * The SSRF guard (DNS) and the GCP provider (network) are the mocked- * boundaries; the real tool handler and input check run.- */--import { describe, it, expect, vi, beforeEach } from 'vitest';--vi.mock('../../api/_lib/rate-limit.js', () => ({- limits: { mcp3dGenerate: async () => ({ success: true, limit: 60, remaining: 59, reset: Date.now() + 60_000 }) },- clientIp: () => '203.0.113.9',-}));--vi.mock('../../api/_lib/ssrf-guard.js', async (importOriginal) => ({- ...(await importOriginal()),- assertSafePublicUrl: async (raw) => new URL(raw),-}));--const submitted = [];-vi.mock('../../api/_providers/gcp.js', () => ({- createRegenProvider: () => ({- supportsMode: () => true,- submit: async (request) => {- submitted.push(request);- return { extJobId: 'job-stylize-test-000000000000', eta: 20 };- },- }),-}));--const { isFbxMeshUrl, STYLIZE_FBX_MESSAGE, STYLIZE_INPUT_FORMATS } = await import('../../api/_lib/stylize-input.js');--const AUTH = { userId: null, rateKey: 'test-caller' };--async function stylizeTool() {- const { toolDefs } = await import('../../api/_mcp3d/tools/studio.js');- return toolDefs.find((t) => t.name === 'stylize_model');-}--beforeEach(() => {- submitted.length = 0;- process.env.GCP_RECONSTRUCTION_KEY = 'test-shared-worker-key';-});--describe('isFbxMeshUrl', () => {- it('matches an FBX path in any case, ignoring the query string', () => {- expect(isFbxMeshUrl('https://cdn.example/rig.fbx')).toBe(true);- expect(isFbxMeshUrl('https://cdn.example/rig.FBX?sig=abc&exp=1')).toBe(true);- });-- it('does not match other formats, an fbx query value, or a malformed URL', () => {- expect(isFbxMeshUrl('https://cdn.example/scene.dae')).toBe(false);- expect(isFbxMeshUrl('https://cdn.example/model.glb?name=rig.fbx')).toBe(false);- expect(isFbxMeshUrl('not a url')).toBe(false);- });-- it('names every format the worker reads and how to convert an FBX', () => {- expect(STYLIZE_INPUT_FORMATS).toBe('GLB, GLTF, OBJ, STL, PLY, OFF or DAE');- expect(STYLIZE_FBX_MESSAGE).toContain(STYLIZE_INPUT_FORMATS);- expect(STYLIZE_FBX_MESSAGE).toContain('remesh_model');- });-});--describe('stylize_model MCP tool', () => {- it('refuses an FBX mesh_url with the supported formats and queues nothing', async () => {- const def = await stylizeTool();- const out = await def.handler({ mesh_url: 'https://cdn.example/rig.fbx', style: 'voxel' }, AUTH);- expect(out.isError).toBe(true);- expect(out.content[0].text).toContain(STYLIZE_INPUT_FORMATS);- expect(submitted).toHaveLength(0);- });-- it('still queues a DAE mesh', async () => {- const def = await stylizeTool();- const out = await def.handler({ mesh_url: 'https://cdn.example/scene.dae', style: 'voxel' }, AUTH);- expect(out.isError).toBeFalsy();- expect(submitted).toHaveLength(1);- expect(submitted[0]).toMatchObject({ mode: 'stylize', sourceUrl: 'https://cdn.example/scene.dae' });- });-});diff --git a/tests/fixtures/mcp-golden-tools.json b/tests/fixtures/mcp-golden-tools.jsonindex ba5a28d8b..ebf335b6e 100644--- a/tests/fixtures/mcp-golden-tools.json+++ b/tests/fixtures/mcp-golden-tools.json@@ -1281,7 +1281,7 @@"descHead": "Segment a GLB/OBJ/STL/PLY mesh into meaningful parts with clean boundari","descHash": "be034074eec2","annotations": "ref:GENERATIVE_ANNOTATIONS",- "schemaHash": "0bf100913339"+ "schemaHash": "50169015a661"},{"name": "stylize_model",diff --git a/workers/segment/Dockerfile b/workers/segment/Dockerfileindex 1d948dd75..ff15e6061 100644--- a/workers/segment/Dockerfile+++ b/workers/segment/Dockerfile@@ -19,9 +19,11 @@ ENV PYTHONDONTWRITEBYTECODE=1 \PYTHONUNBUFFERED=1 \PIP_NO_CACHE_DIR=1+# GL/OpenMP/BLAS runtime for trimesh and scipy. No libassimp: nothing in this+# image loads it (trimesh 4.x has no assimp loader, DAE input goes through+# pycollada, and FBX input is refused).RUN apt-get update && apt-get install -y --no-install-recommends \libgl1 libglib2.0-0 libgomp1 \- libassimp-dev libassimp5 \libopenblas-dev \&& rm -rf /var/lib/apt/lists/*@@ -35,12 +37,13 @@ COPY segment_core.py /app/segment_core.pyCOPY main.py /app/main.py# Build gate: the geometry engine is pure CPU and needs no credentials, so its-# tests run here. A merge pass that regresses to the pre-2026-08-11 cost, or a-# segmentation that stops being reproducible, fails the image instead of-# reaching production.+# tests run here. A merge pass that regresses to the pre-2026-08-11 cost, a+# segmentation that stops being reproducible, or an input format the worker+# advertises but cannot read fails the image instead of reaching production.COPY test_segment_core.py /app/test_segment_core.pyCOPY test_gltf_meshopt.py /app/test_gltf_meshopt.py-RUN python3 test_segment_core.py && python3 test_gltf_meshopt.py+COPY test_segment_input.py /app/test_segment_input.py+RUN python3 test_segment_core.py && python3 test_gltf_meshopt.py && python3 test_segment_input.pyEXPOSE 8080CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080", "--workers", "1"]diff --git a/workers/segment/README.md b/workers/segment/README.mdindex 6362af627..152c9b9ce 100644--- a/workers/segment/README.md+++ b/workers/segment/README.md@@ -31,11 +31,28 @@ tinted a distinct golden-ratio-stepped hue so segmentation is visible even on anuntextured mesh, and emitted as a separate named GLB node (`part_01`, `part_02`,…). `only_part` exports a single part on its own.-Supported input formats: `.glb`, `.gltf`, `.obj`, `.stl`, `.ply`, `.fbx`,-`.off`, `.dae`. Input is capped at 128 MiB and fetched through the SSRF-hardened+Supported input formats: `.glb`, `.gltf`, `.obj`, `.stl`, `.ply`, `.off`,+`.dae` (DAE through `pycollada`, which `trimesh[easy]` installs). Input is+capped at 128 MiB and fetched through the SSRF-hardened`worker_security.fetch_remote_bytes` (https-only, private/loopback/metadata IPsrejected, redirects re-validated per hop).+**FBX is not accepted.** trimesh has no FBX reader and this image carries no+converter, so an FBX is refused up front instead of failing inside the parser:++- an `.fbx` mesh URL is a `422` whose message names the formats above;+- an FBX behind an extensionless or signed URL is caught by its bytes (the+ binary `Kaydara FBX Binary` magic or an ASCII `; FBX` header) and the task+ fails with `error_kind: "input"` and that same caller-facing message, not an+ opaque `internal error (ref …)`;+- `/api/forge-segment` answers `400 unsupported_mesh_format` and the+ `segment_model` MCP tool returns an error before any job is queued.++To split an FBX into parts, convert it to GLB first with the remesh worker+(`operation: "convert"`, `output_format: "glb"`, via `/api/forge-remesh` or the+`remesh_model` MCP tool), which reads binary FBX through headless Blender, then+segment the GLB it returns.+A glTF asset that declares `EXT_meshopt_compression` (what `gltfpack` emits, andwhat most three.ws avatars ship as) is transcoded to plain glTF by[`gltf_meshopt.py`](./gltf_meshopt.py) before loading. trimesh has no decoder for@@ -86,7 +103,8 @@ implementation.| `worker_security.py` | Shared bearer-auth + SSRF-hardened fetch + opaque error helper. Byte-identical copy across all workers, so keep it in sync when editing. || `gltf_meshopt.py` | Shared `EXT_meshopt_compression` decode (via the pinned `gltfpack` binary) applied to every fetched mesh. Byte-identical copy across the workers that load caller meshes; `npm run check:vendored` enforces that. || `test_gltf_meshopt.py` | Tests for the decode, run as a Docker build gate alongside the core suite. |-| `Dockerfile` | `python:3.11-slim` + native libs (`libgl1`, `libassimp5`, `libopenblas`); runs the test gate, then serves via `uvicorn` on port 8080. |+| `test_segment_input.py` | Service-level input tests: the accepted formats, the FBX refusal (URL 422 and byte sniff), and the `error_kind` on failed tasks. No GCS, no network. A Docker build gate. |+| `Dockerfile` | `python:3.11-slim` + native libs (`libgl1`, `libgomp1`, `libopenblas`) and the pinned `gltfpack`; runs the test gate, then serves via `uvicorn` on port 8080. No assimp: nothing in the worker loads it. || `cloudbuild.yaml` | Cloud Build to Artifact Registry to Cloud Run deploy. |## How it ships@@ -111,8 +129,10 @@ gcloud builds submit --config workers/segment/cloudbuild.yaml \````SHORT_SHA` is required on a manual submit: the config tags the image with it,-and an unsubstituted tag fails the build. The build runs `test_segment_core.py`-as a gate, so a regressed merge pass never reaches a deployed image.+and an unsubstituted tag fails the build. The build runs `test_segment_core.py`,+`test_gltf_meshopt.py`, and `test_segment_input.py` as a gate, so a regressed+merge pass, or a format the worker advertises but cannot read, never reaches a+deployed image.The platform wires it in through `api/_providers/gcp.js` (`segment` mode): set**`GCP_SEGMENT_URL`** to this service's Cloud Run URL and **`GCP_RECONSTRUCTION_KEY`**@@ -153,6 +173,8 @@ All routes except `/health` require `Authorization: Bearer <API_KEY>`.}```+An `.fbx` `mesh` is a `422` that names the supported input formats.+`method`:- `connected` — split only at physically disconnected shells.- `crease` — minima-rule crease segmentation over the whole mesh.@@ -188,7 +210,8 @@ Response: `{ "task_id": "<uuid>", "status": "queued" }`."warnings": ["capped to 24 parts; 3 smaller fragments were combined"],"bytes": 184320,"elapsed_ms": 2140,- "error": null+ "error": null,+ "error_kind": null}```@@ -205,11 +228,12 @@ freshly started instance: it answers `done` with the full manifest, while an idthat never existed still `404`s.**Failures say what went wrong when they safely can.** A caller's mistake-(unknown `only_part`, a mesh with no triangles, an SSRF-refused URL) returns-the real reason, e.g. `part 'part_99' not found. Available: part_01 (upper-back),+(unknown `only_part`, a mesh with no triangles, an FBX, an SSRF-refused URL)+returns the real reason with `error_kind: "input"`, e.g. `part 'part_99' not found. Available: part_01 (upper-back),...` or `refused to fetch mesh: host resolves to a disallowed address:169.254.169.254`. Anything unexpected still returns an opaque,-correlation-id-tagged message with the traceback logged server-side only. The+correlation-id-tagged message with `error_kind: "internal"` and the traceback+logged server-side only. Thesplit is by exception type (`SegmentInputError` / `SegmentTimeout` are echoed,everything else is not), so a library-internal message can never leak.@@ -269,9 +293,17 @@ is named after a fresh uuid, so replaying the write is safe.```bashpython3 workers/segment/test_segment_core.py+python3 workers/segment/test_gltf_meshopt.py+python3 workers/segment/test_segment_input.py```-80 checks over the geometry engine: loading and scene concatenation, connected+`test_segment_input.py` imports the FastAPI app (with throwaway `API_KEY` and+`GCS_BUCKET` values it sets itself) and checks that every advertised input+suffix has a trimesh loader, that FBX is refused by URL with a `422` and by its+bytes with `error_kind: "input"`, that a DAE still segments end to end, and that+an unexpected parser failure stays opaque with `error_kind: "internal"`.++`test_segment_core.py` runs 80 checks over the geometry engine: loading and scene concatenation, connectedand crease segmentation, the `max_parts` cap, the face-partition property, runto run determinism, the time budget, GLB node naming, and the manifest shape.No GCS, no network, no GPU. The Docker build runs it, so a regression fails thediff --git a/workers/segment/main.py b/workers/segment/main.pyindex 8b4ac1819..269165977 100644--- a/workers/segment/main.py+++ b/workers/segment/main.py@@ -15,7 +15,7 @@ Optionally exports a single part on its own (`only_part`).API contract:POST /segment {- mesh: url, # https GLB/OBJ/STL/PLY/FBX URL (required)+ mesh: url, # https GLB/GLTF/OBJ/STL/PLY/OFF/DAE URL (required; FBX is refused)method?: "auto"|"connected"|"crease", # default: "auto"max_parts?: int, # default: 24, range 2–64min_part_faces?: int, # default: 64, range 4–100000@@ -27,7 +27,7 @@ API contract:task_id, status,result_url?, manifest_url?,parts?, part_count?, source_faces?, method?,- error?+ error?, error_kind? # error_kind: "input" | "internal"}GET /health → { ok }@@ -85,7 +85,20 @@ _bucket: Optional[storage.Bucket] = None_sem: Optional[asyncio.Semaphore] = None_tasks: dict[str, dict] = {}-SUPPORTED_INPUT_FORMATS = {".glb", ".gltf", ".obj", ".stl", ".ply", ".fbx", ".off", ".dae"}+# Every input trimesh 4.x reads in this image (DAE through pycollada, which+# trimesh[easy] installs). FBX is deliberately absent: trimesh has no FBX reader+# and this image carries no converter, so an FBX is refused up front with the+# list below instead of failing inside the parser as an opaque internal error.+SUPPORTED_INPUT_FORMATS = {".glb", ".gltf", ".obj", ".stl", ".ply", ".off", ".dae"}+SUPPORTED_INPUT_LABEL = "GLB, GLTF, OBJ, STL, PLY, OFF or DAE"+FBX_UNSUPPORTED_MESSAGE = (+ f"FBX input is not supported by segment: supply {SUPPORTED_INPUT_LABEL}. "+ "To split an FBX into parts, convert it to GLB first (the remesh worker's "+ "convert operation reads FBX)."+)+# Binary FBX opens with this fixed magic; ASCII FBX with a `; FBX` comment line.+FBX_BINARY_MAGIC = b"Kaydara FBX Binary \x00"+FBX_ASCII_HEADER = b"; FBX"VALID_METHODS = {"auto", "connected", "crease"}MAX_MESH_BYTES = 128 * 1024 * 1024TERMINAL_STATUSES = ("done", "failed")@@ -169,6 +182,16 @@ def _evict_stale_tasks(now: float) -> None:_tasks.pop(task_id, None)+def _url_suffix(url: str) -> str:+ return Path(url.split("?")[0].split("#")[0]).suffix.lower()+++def _is_fbx(data: bytes) -> bool:+ if data.startswith(FBX_BINARY_MAGIC):+ return True+ return data[:64].lstrip(b"\xef\xbb\xbf").lstrip().startswith(FBX_ASCII_HEADER)++def _fetch_mesh(url: str) -> tuple[bytes, str]:import segment_core as seg@@ -176,7 +199,12 @@ def _fetch_mesh(url: str) -> tuple[bytes, str]:data = fetch_remote_bytes(url, timeout=60, max_bytes=MAX_MESH_BYTES)except UnsafeUrlError as exc:raise seg.SegmentInputError(f"refused to fetch mesh: {exc}") from exc- suffix = Path(url.split("?")[0]).suffix.lower()+ # The bytes decide, not just the URL: a signed or extensionless URL would+ # otherwise fall back to the glTF parser and fail there with an error that+ # says nothing about FBX.+ if _url_suffix(url) == ".fbx" or _is_fbx(data):+ raise seg.SegmentInputError(FBX_UNSUPPORTED_MESSAGE)+ suffix = _url_suffix(url)if suffix not in SUPPORTED_INPUT_FORMATS:suffix = ".glb"# A meshopt-compressed asset is transcoded here, before segment_core loads@@ -319,16 +347,22 @@ async def _process(import segment_core as segif isinstance(exc, (seg.SegmentInputError, seg.SegmentTimeout)):- # Ours, and written for the caller: a bad part id or a blown- # time budget is fixable from the client side, so say what+ # Ours, and written for the caller: a bad part id, an FBX, or a+ # blown time budget is fixable from the client side, so say what# happened instead of burying it behind a correlation id.message = str(exc)+ error_kind = "input"log.warning("[%s] segment rejected: %s", task_id, message)else:message = safe_error(exc, context=f"[{task_id}] segment")+ error_kind = "internal"_tasks[task_id].update({"status": "failed","error": message,+ # Same taxonomy the stylize and avatar workers report and+ # api/_providers/gcp.js relays: `input` means `error` is+ # caller-facing copy, `internal` means it is an opaque ref.+ "error_kind": error_kind,"elapsed_ms": int((time.time() - t0) * 1000),"finished_at": time.time(),})@@ -338,13 +372,23 @@ async def _process(class SegmentRequest(BaseModel):- mesh: str = Field(..., description="https URL to input mesh (GLB/OBJ/FBX/STL/PLY)")+ mesh: str = Field(..., description="https URL to input mesh (GLB/GLTF/OBJ/STL/PLY/OFF/DAE)")method: str = Field(default="auto", description="auto|connected|crease")max_parts: int = Field(default=24, ge=2, le=64)min_part_faces: int = Field(default=64, ge=4, le=100_000)crease_angle: float = Field(default=40.0, ge=5.0, le=170.0)only_part: Optional[str] = Field(default=None, max_length=64)+ @field_validator("mesh")+ @classmethod+ def validate_mesh(cls, v: str) -> str:+ # Refuse an FBX at the door with a 422 that names the supported formats,+ # rather than accepting a job that can only fail. An FBX behind an+ # extensionless URL is caught by the byte sniff in _fetch_mesh.+ if _url_suffix(v) == ".fbx":+ raise ValueError(FBX_UNSUPPORTED_MESSAGE)+ return v+@field_validator("method")@classmethoddef validate_method(cls, v: str) -> str:diff --git a/workers/segment/test_segment_input.py b/workers/segment/test_segment_input.pynew file mode 100644index 000000000..1dab4b17a--- /dev/null+++ b/workers/segment/test_segment_input.py@@ -0,0 +1,164 @@+"""Input-format tests for the segment service (main.py): which mesh formats the+worker accepts, how it refuses FBX, and how a failed task reports its cause.+No GCS, no network, no running server:++ python3 workers/segment/test_segment_input.py++Also runs as a Docker build gate (see Dockerfile). It pins the 2026-10-09 fix:+the worker used to list `.fbx` as accepted, but trimesh 4.x has no FBX reader+and this image carries no converter, so every FBX was queued and then died+inside the parser as an opaque `internal error (ref ...)`.+"""++from __future__ import annotations++import asyncio+import logging+import os+import sys++os.environ.setdefault("API_KEY", "test-key")+os.environ.setdefault("GCS_BUCKET", "test-bucket")++sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))++import trimesh # noqa: E402+from fastapi.testclient import TestClient # noqa: E402++import main # noqa: E402+import segment_core as seg # noqa: E402++PASS = 0+SUPPORTED_LABEL = "GLB, GLTF, OBJ, STL, PLY, OFF or DAE"+++def check(name: str, condition: bool, detail: str = "") -> None:+ global PASS+ if not condition:+ print(f"FAIL {name} {detail}")+ sys.exit(1)+ PASS += 1+ print(f"ok {name}")+++def with_fetched_bytes(data: bytes, fn, *args):+ """Run fn with the SSRF-hardened fetch replaced by a fixed payload."""+ real = main.fetch_remote_bytes+ main.fetch_remote_bytes = lambda *_a, **_k: data+ try:+ return fn(*args)+ finally:+ main.fetch_remote_bytes = real+++# ── the advertised formats are the ones trimesh can read ─────────────────────────++_readable = set(trimesh.exchange.load.mesh_formats())+check(+ "every accepted suffix has a trimesh loader",+ all(s.lstrip(".") in _readable for s in main.SUPPORTED_INPUT_FORMATS),+ f"{sorted(main.SUPPORTED_INPUT_FORMATS)} vs {sorted(_readable)}",+)+check("fbx is not an accepted input suffix", ".fbx" not in main.SUPPORTED_INPUT_FORMATS)+check("trimesh in this image really cannot read fbx", "fbx" not in _readable)+check("the label names the accepted formats", main.SUPPORTED_INPUT_LABEL == SUPPORTED_LABEL)++# ── an .fbx URL is a 422 at the door ─────────────────────────────────────────────++client = TestClient(main.app)+_auth = {"authorization": f"Bearer {main.API_KEY}"}++_fbx_job = client.post("/segment", json={"mesh": "https://example.com/rig.FBX?sig=1"}, headers=_auth)+check(+ "an FBX mesh URL is a 422 that names the supported formats",+ _fbx_job.status_code == 422 and SUPPORTED_LABEL in _fbx_job.text,+ f"{_fbx_job.status_code} {_fbx_job.text[:300]}",+)+check(+ "the 422 points at the remesh convert path",+ "remesh" in _fbx_job.text and "convert" in _fbx_job.text,+ _fbx_job.text[:300],+)+check(+ "a bad method is still a 422 (the mesh validator did not swallow others)",+ client.post(+ "/segment", json={"mesh": "https://example.com/m.glb", "method": "nope"}, headers=_auth+ ).status_code == 422,+)++# ── an FBX is caught by its bytes, whatever the URL says ─────────────────────────++for label, data, url in (+ ("binary FBX behind an extensionless URL", main.FBX_BINARY_MAGIC + b"\x00" * 32, "https://example.com/dl?sig=1"),+ ("ASCII FBX behind a .bin URL", b"; FBX 7.4.0 project file\n", "https://example.com/model.bin"),+ ("ASCII FBX with a BOM and leading blank line", b"\xef\xbb\xbf\n; FBX 6.1.0\n", "https://example.com/m"),+ ("an .fbx URL whatever the bytes", b"glTF\x02\x00\x00\x00", "https://example.com/model.fbx#frag"),+):+ try:+ with_fetched_bytes(data, main._fetch_mesh, url)+ check(f"{label} is refused as an input error", False, "accepted")+ except seg.SegmentInputError as exc:+ check(f"{label} is refused as an input error", "FBX input is not supported" in str(exc), str(exc))++check(+ "a DAE URL keeps its loader",+ with_fetched_bytes(b"<?xml", main._fetch_mesh, "https://example.com/m.dae")[1] == ".dae",+)+check(+ "an extensionless GLB still loads as glb",+ with_fetched_bytes(b"glTF", main._fetch_mesh, "https://example.com/dl")[1] == ".glb",+)++# ── DAE, the format the old FBX claim sat beside, segments end to end ────────────++_a = trimesh.creation.box(extents=(1, 1, 1))+_b = trimesh.creation.box(extents=(1, 1, 1))+_b.apply_translation([5.0, 0, 0])+_dae = trimesh.exchange.dae.export_collada(trimesh.util.concatenate([_a, _b]))+_glb, _manifest = with_fetched_bytes(+ _dae, main._run_segmentation, "https://example.com/two.dae", "connected", 24, 4, 40.0, None+)+check(+ "a DAE segments end to end through pycollada",+ _glb[:4] == b"glTF" and _manifest["part_count"] == 2 and _manifest["source_faces"] == 24,+ f"parts={_manifest.get('part_count')} faces={_manifest.get('source_faces')}",+)++# ── a failed task says whose fault it was ────────────────────────────────────────+++async def _run_task_on(data: bytes, url: str) -> dict:+ main._sem = asyncio.Semaphore(1)+ main._tasks["seg-in"] = {"task_id": "seg-in", "status": "queued", "method": "auto"}+ real = main.fetch_remote_bytes+ main.fetch_remote_bytes = lambda *_a, **_k: data+ try:+ await main._process("seg-in", url, "auto", 24, 64, 40.0, None)+ finally:+ main.fetch_remote_bytes = real+ return main._tasks.pop("seg-in")+++_task = asyncio.run(_run_task_on(main.FBX_BINARY_MAGIC + b"\x00" * 32, "https://example.com/dl"))+check(+ "an FBX job fails with caller-facing copy, not an opaque ref",+ _task["status"] == "failed"+ and _task.get("error_kind") == "input"+ and "FBX input is not supported" in _task["error"]+ and SUPPORTED_LABEL in _task["error"],+ str(_task),+)++# safe_error logs the full traceback for operators; that expected trace is not+# a test failure, so keep it out of the build log.+logging.getLogger("worker_security").setLevel(logging.CRITICAL)+_task = asyncio.run(_run_task_on(b"definitely not a mesh", "https://example.com/broken.glb"))+check(+ "an unexpected parser failure stays opaque and is marked internal",+ _task["status"] == "failed"+ and _task.get("error_kind") == "internal"+ and _task["error"].startswith("internal error (ref "),+ str(_task),+)++print(f"\nOK {PASS} checks passed")