3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
Quote only real tool messages in the error tables (#2125)
Nguyen Xuan An18c748b076e1
diff --git a/changes/2125.md b/changes/2125.mdnew file mode 100644index 00000000..8a412eec--- /dev/null+++ b/changes/2125.md@@ -0,0 +1 @@+- The error tables in the build and render skill references now quote only text the tools return, and a test fails when a quoted message is reworded (#2125)diff --git a/skills/build-crucible-scene/references/errors-and-recovery.md b/skills/build-crucible-scene/references/errors-and-recovery.mdindex 0a96b7ff..e366b1e6 100644--- a/skills/build-crucible-scene/references/errors-and-recovery.md+++ b/skills/build-crucible-scene/references/errors-and-recovery.md@@ -7,11 +7,11 @@ Every tool error names what failed and what to do next, so read the message befo| Message or sign | Cause | Do ||---|---|---|-| `expectedRevision must match the current revision.` | Another call changed the scene, or you used an old number. | `scene_inspect`, take its `revision`, resend the same batch. |-| `Camera fStop drives depth of field; set effects.depthOfField.blur to 0 or remove fStop.` | Both depth of field controls are on. | Keep one: `fStop` on the camera, or `effects.depthOfField.blur`. See `camera.md`. |-| `Give a camera fov or a focalLength, not both.` | Both lens fields in one command. | Send only one; `focalLength` replaces `fov`. |-| `bake.gridFog needs bake.irradianceGrid.` | `gridFog` alone. | Add `irradianceGrid: true`. See `light.md`. |-| `Shot <name> reads motion up to N s but the motion lasts M s.` | A timeline longer than a non-looping motion. | Lengthen the motion, set `loop: true` or a shot `motionStart`. |+| `expectedRevision` rejected with `the current revision` and `scene_inspect returns it` | Another call changed the scene, or you used an old number. | `scene_inspect`, take its `revision`, resend the same batch. |+| `camera.fStop` rejected with `a camera without effects.depthOfField.blur above 0; set blur to 0 or remove fStop` | Both depth of field controls are on. | Keep one: `fStop` on the camera, or `effects.depthOfField.blur`. See `camera.md`. |+| `camera.focalLength` rejected with `only one of fov (degrees) or focalLength (millimetres with sensorWidth), such as fov 45; remove the other` | Both lens fields in one command. | Send only one; `focalLength` replaces `fov`. |+| `bake.gridFog` rejected with `true only together with bake.irradianceGrid, such as irradianceGrid: true` | `gridFog` alone. | Add `irradianceGrid: true`. See `light.md`. |+| A shot error with `reads motion up to` ... `but the motion lasts` | A timeline longer than a non-looping motion. | Lengthen the motion, set `loop: true` or a shot `motionStart`. || A light list error naming a cap | More than 16 point, 8 spot or 7 area lights. | Merge or remove lights; each list replaces the old one. || `environment.hdri must be one of ... or the 64-character ID ...` | A made-up name, path or URL. | `scene_asset_catalog`, copy a listed name or ID. || `No scene is active` | Nothing created yet, or disposed. | `scene_create`. |diff --git a/skills/render-crucible-media/references/errors-and-recovery.md b/skills/render-crucible-media/references/errors-and-recovery.mdindex 7455c482..a47f3419 100644--- a/skills/render-crucible-media/references/errors-and-recovery.md+++ b/skills/render-crucible-media/references/errors-and-recovery.md@@ -6,7 +6,7 @@ message first: each one names the cause and the next step.| Sign | Cause | Do ||---|---|---|| Submit says render jobs need a job store | The server started without `--jobs`. | Ask the user to restart with `--jobs <abs private dir>`; an agent cannot add it. |-| `expectedRevision must match the current revision.` | The scene changed since you read it. | `scene_inspect`, resubmit with the new revision. |+| `expectedRevision` rejected with `the current revision` and `scene_inspect returns it` | The scene changed since you read it. | `scene_inspect`, resubmit with the new revision. || Settings rejected as unknown field | A typo, or a field of another tool (for example `time`). | Use the names in `jobs.md`; `scene_render_submit` lists the schema. || Video is a still frame | No `motion: { "start": 0 }`. | Add it and resubmit. || Sampled time past the motion | A nonlooping motion is shorter than `start + duration`. | Lengthen the motion, set `loop: true` or shorten the job. |@@ -19,7 +19,7 @@ message first: each one names the cause and the next step.| Smaller output than asked | The memory budget reduced it. | Report the actual size; ask for a larger `--memory` if size matters. || State `failed` with a time limit | The job passed 60 s plus 2 s per frame of render time. | Lower the size, fps or samples, or split the film into parts. Under a shared GPU the message says to submit again. || `Motion settings require a recipe with authored motion, physics...` | Nothing in the recipe moves. | Add motion, physics, a placed clip, a map sequence or a grid volume sequence, or drop `motion`. |-| `duration is (stillCount - 1) / fps` | `stillCount` came with another `duration`. | Leave `duration` out. |+| `(stillCount - 1) / fps` | `stillCount` came with another `duration`. | Leave `duration` out. || `transparent`, `format` or `region` refused | Combined with `renderer` (traced PNG is opaque 8-bit) or, for `transparent` and `format`, with `kind: "video"`. | Drop `renderer` (or use a raster `quality`), or use `stills`. || `quality final` ran as another tier | `final` cannot draw `passes`, `transparent`, `region`, `multilayer` or a non-png `format`, or one frame would pass `maxSeconds`. | Read `quality.steps`; ask for the raster tier you want, or a smaller traced frame. || A path traced job is refused with a triangle count | The `cpu` tracer takes about 400,000 triangles; `native` is bounded by the adapter. | Use `backend: "native"` or `gpu`, or lower the scene. |diff --git a/tests/skill-error-tables.test.js b/tests/skill-error-tables.test.jsnew file mode 100644index 00000000..32e7ca2b--- /dev/null+++ b/tests/skill-error-tables.test.js@@ -0,0 +1,68 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { readdir, readFile } from 'node:fs/promises';+import { join } from 'node:path';++const repository = new URL('..', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1');+const tablePaths = [+ join(repository, 'skills', 'build-crucible-scene', 'references', 'errors-and-recovery.md'),+ join(repository, 'skills', 'render-crucible-media', 'references', 'errors-and-recovery.md'),+];+const SOURCE_FOLDERS = ['src', 'scripts'];+const MINIMUM_WORDS_IN_A_MESSAGE = 3;++async function readSourceText() {+ const pieces = [];+ for (const folder of SOURCE_FOLDERS) {+ const names = await readdir(join(repository, folder));+ for (const name of names.filter(candidate => /\.(js|mjs)$/.test(candidate))) {+ pieces.push(await readFile(join(repository, folder, name), 'utf8'));+ }+ }+ return pieces.join('\n');+}++// The first column of every table row; the header is the line above the `|---|` separator.+function firstColumnCells(markdown) {+ const separator = /^\|[-| ]+\|$/;+ const lines = markdown.split('\n');+ const cells = [];+ lines.forEach((line, index) => {+ const isRow = line.startsWith('|') && !separator.test(line);+ const isHeader = separator.test(lines[index + 1] ?? '');+ if (isRow && !isHeader) cells.push(line.split('|')[1].trim());+ });+ assert.ok(cells.length > 0, 'errors-and-recovery.md needs a table of messages');+ return cells;+}++// Backticked spans of three or more words are quoted messages; `...` inside one stands for text the tool fills in.+export function quotedMessageFragments(cell) {+ const spans = [...cell.matchAll(/`([^`]+)`/g)].map(match => match[1]);+ return spans+ .filter(span => span.trim().split(/\s+/).length >= MINIMUM_WORDS_IN_A_MESSAGE)+ .flatMap(span => span.split('...').map(fragment => fragment.trim()).filter(Boolean));+}++test('every quoted message in the errors-and-recovery tables occurs in src/ or scripts/', async () => {+ const sourceText = await readSourceText();+ let checked = 0;+ for (const tablePath of tablePaths) {+ const cells = firstColumnCells(await readFile(tablePath, 'utf8'));+ for (const cell of cells) {+ for (const fragment of quotedMessageFragments(cell)) {+ checked += 1;+ assert.ok(+ sourceText.includes(fragment),+ `${tablePath.slice(repository.length)} quotes "${fragment}" but no file in src/ or scripts/ contains it. Quote text the tool really returns, or describe the cause without backticks.`,+ );+ }+ }+ }+ assert.ok(checked >= 8, `expected to check at least 8 quoted messages, found ${checked}`);+});++test('quotedMessageFragments skips short code names and splits on ellipses', () => {+ assert.deepEqual(quotedMessageFragments('`nvenc` fails'), []);+ assert.deepEqual(quotedMessageFragments('`alpha beta gamma ... delta epsilon zeta`'), ['alpha beta gamma', 'delta epsilon zeta']);+});