Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

Record the tier-2 run that exercised the workspace MCP server through a nested author (#122)

Matthew Kissingerf2e6accb7165
diff --git a/docs/dogfooding.md b/docs/dogfooding.md
index b02caa54..5c4436f6 100644
--- a/docs/dogfooding.md
+++ b/docs/dogfooding.md
@@ -243,6 +243,7 @@ images were reviewed by a human after the run; the driver status alone never est
| Claude Code 2.1.269 · Claude Opus 5 | Completed once; two later starts hit provider quota | Produced a weathered lighthouse after cloning, setup, a nested 86-turn author, nine revisions, and GPU review: 16,245 triangles, 38,461-byte source and 1,763,612-byte GLB. The result was detailed rather than placeholder geometry. |
| OpenCode 1.18.30 · Muse Spark 1.3 Contributor Free | Completed, pending review, 25m10s | Produced a deep-sea cartographer console after three render/edit cycles: 16,548 triangles, 10,962-byte source and 266,976-byte GLB. Its relief map, drawers, porthole and articulated plotting arms read coherently, but CPU views cannot establish its materials. |
| OpenCode 1.18.30 · Muse Spark 1.3 Contributor Free · after the neutral-backdrop and test-budget merges (2026-09-16) | Completed, pending review, 5m42s | Cloned, ran `bun install --frozen-lockfile` and `bun run build:runtime`, found `kiln-setup-workspace` unaided, created an OpenCode workspace and verified it with a CPU crate render. It dispatched the author as an in-session `task` subagent rather than a separate `opencode run --dir` process, so the workspace MCP server was never loaded and the child worked through the CLI (`render`, `source`, `save`) with PNG readback over three review cycles. The clean room held: the child read only the workspace skills and its own retained program. Saved a brass diving helmet with a hinged faceplate, side ports, hose elbow and verdigris band: 24,152 triangles, 10,469-byte source and 377,456-byte GLB, zero tool errors; the preview is a CPU view because the render service was not installed. The nested-author sentence in the setup skill comes from this run, and the receipt now records `toolUsage.workspaceMcp` so a CLI-only completion is visible without reading the trace. |
+| OpenCode 1.18.30 · Muse Spark 1.3 Contributor Free · after the render-service registry and nested-author docs merged (2026-09-17) | Completed, pending review, 3m56s | Cloned the merged main, ran `bun install --frozen-lockfile` and `bun run build:runtime`, read `docs/clean-room.md` and the setup skill, created an OpenCode workspace and verified it with a CPU crate render. This time it followed the nested-author sentence: it wrote a brief and started the author as a separate `opencode run --dir <workspace>` process, so the workspace MCP server loaded. The child made nine `kiln_workspace_kiln_*` calls with zero errors (`kiln_list_primitives` with `capabilities: true` first, then `kiln_render`, `kiln_source` twice, `kiln_edit`), revised once from the PNG on disk (spread the side ribs, opened the door wider, unique part names), and wrote the final source and GLB through the CLI `source` and `render` commands rather than `kiln_save`, so the workspace store holds programs but no saved asset. Produced a cast-iron wood stove with a hinged door, mica window, swept flue elbow, legs and rivets: 3,020 triangles, 10,383-byte source and 85,884-byte GLB; CPU views only because the render service was not installed, which the child reported as unresolved rather than as material evidence. The clean room held: the child read only the workspace files, its brief and the authoring skill. The outer receipt still says `toolUsage.workspaceMcp: not-exercised`, because that field is computed from the outer agent's own event stream and a nested author's calls live in the child's OpenCode session; read the field as a statement about the outer agent, and open the child session to see the MCP path. |
| Agy 1.2.2 · Gemini 3.8 Flash High | Completed, pending review, 27m28s | Produced a detailed polar chronometer/armillary: 72,244 triangles, 57,670-byte source and 2,365,024-byte GLB, with a material-faithful GPU view. The outer setup agent also read a cloned Kiln example and engine source before authoring; that is a clean-room protocol failure and useful contamination evidence, even though the asset succeeded. |
| Codex 0.154.0 · GPT-5.6 Luna, xhigh | Asset recovered; later provider quota | Cloned, configured a workspace, and launched a nested author that saved and exported a 16,604-triangle Ancient Tidal Observatory with a material-faithful GPU preview. The outer agent created the asset workspace beside `run-01`, exposing a driver discovery bug: the old receipt incorrectly reported no export. Whole-batch discovery and automatic local-gallery capture now cover this shape. |
| Hermes 0.21.2 · GPT-5.6 Luna, xhigh through Codex OAuth | Provider quota after 2m43s | Reached clone and workspace setup under an isolated `HERMES_HOME`; quota arrived before authoring. An earlier attempt proved that Hermes safe mode alone does not isolate its state database, so the driver now always supplies an isolated home. |
diff --git a/src/__tests__/helpers/fake-render-service.ts b/src/__tests__/helpers/fake-render-service.ts
index 3dc1f067..48628592 100644
--- a/src/__tests__/helpers/fake-render-service.ts
+++ b/src/__tests__/helpers/fake-render-service.ts
@@ -11,7 +11,7 @@
* make the process look current or stale without editing files.
*/
import { spawn, spawnSync, type ChildProcess } from 'node:child_process';
-import { mkdir, writeFile } from 'node:fs/promises';
+import { mkdir, rm, writeFile } from 'node:fs/promises';
import { createServer } from 'node:http';
import type { AddressInfo } from 'node:net';
import { join } from 'node:path';
@@ -136,3 +136,24 @@ export async function writeFakeRenderService(dir: string): Promise<string> {
await writeFile(join(dir, 'src/server.mjs'), FAKE_SERVER);
return dir;
}
+
+/**
+ * Remove a directory a fake service ran in. On Windows the directory stays
+ * locked (EBUSY) until the process that had it as its cwd has fully exited,
+ * which happens some milliseconds after `kill()` returns; so retry for a while
+ * instead of failing the teardown of a test that already passed.
+ */
+export async function removeDirectory(dir: string, timeoutMs = 10_000): Promise<void> {
+ const deadline = Date.now() + timeoutMs;
+ for (;;) {
+ try {
+ await rm(dir, { recursive: true, force: true });
+ return;
+ } catch (error) {
+ const code = (error as NodeJS.ErrnoException).code;
+ const retryable = code === 'EBUSY' || code === 'EPERM' || code === 'ENOTEMPTY';
+ if (!retryable || Date.now() >= deadline) throw error;
+ await new Promise((r) => setTimeout(r, 100));
+ }
+ }
+}
diff --git a/src/__tests__/render-service-lifecycle.test.ts b/src/__tests__/render-service-lifecycle.test.ts
index 4807dfb6..1d7705c9 100644
--- a/src/__tests__/render-service-lifecycle.test.ts
+++ b/src/__tests__/render-service-lifecycle.test.ts
@@ -23,7 +23,7 @@
import type { ChildProcess } from 'node:child_process';
import { createServer, type Server } from 'node:http';
import type { AddressInfo } from 'node:net';
-import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
+import { mkdir, mkdtemp, writeFile } from 'node:fs/promises';
import { join, resolve } from 'node:path';
import { afterEach, describe, expect, it } from 'bun:test';
@@ -41,6 +41,7 @@ import {
deadPid,
exited,
freePort,
+ removeDirectory,
spawnFakeRenderService,
writeFakeRenderService,
} from './helpers/fake-render-service';
@@ -52,15 +53,16 @@ const savedPort = process.env['KILN_RENDER_SERVICE_PORT'];
afterEach(async () => {
stopLocalRenderService();
- for (const child of children.splice(0)) if (child.exitCode === null) child.kill();
await Promise.all(
- servers.splice(0).map((s) => new Promise<void>((done) => s.close(() => done()))),
+ children.splice(0).map(async (child) => {
+ if (child.exitCode === null && child.signalCode === null) child.kill();
+ await exited(child);
+ }),
);
await Promise.all(
- directories
- .splice(0)
- .map((d) => rm(d, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 })),
+ servers.splice(0).map((s) => new Promise<void>((done) => s.close(() => done()))),
);
+ await Promise.all(directories.splice(0).map((d) => removeDirectory(d)));
if (savedPort === undefined) delete process.env['KILN_RENDER_SERVICE_PORT'];
else process.env['KILN_RENDER_SERVICE_PORT'] = savedPort;
});
diff --git a/src/__tests__/service-cli.test.ts b/src/__tests__/service-cli.test.ts
index b6da397e..7ec4b4d5 100644
--- a/src/__tests__/service-cli.test.ts
+++ b/src/__tests__/service-cli.test.ts
@@ -10,7 +10,7 @@
import { createServer, type Server } from 'node:http';
import type { AddressInfo } from 'node:net';
import type { ChildProcess } from 'node:child_process';
-import { mkdir, mkdtemp, rm } from 'node:fs/promises';
+import { mkdir, mkdtemp } from 'node:fs/promises';
import { join, resolve } from 'node:path';
import { afterEach, describe, expect, it } from 'bun:test';
@@ -19,7 +19,9 @@ import { serviceMain } from '../service-cli';
import { renderServiceSourceFingerprint } from '../render-service-host';
import {
deadPid,
+ exited,
freePort,
+ removeDirectory,
spawnFakeRenderService,
writeFakeRenderService,
} from './helpers/fake-render-service';
@@ -33,15 +35,16 @@ const saved = {
};
afterEach(async () => {
- for (const child of children.splice(0)) if (child.exitCode === null) child.kill();
await Promise.all(
- servers.splice(0).map((s) => new Promise<void>((done) => s.close(() => done()))),
+ children.splice(0).map(async (child) => {
+ if (child.exitCode === null && child.signalCode === null) child.kill();
+ await exited(child);
+ }),
);
await Promise.all(
- directories
- .splice(0)
- .map((d) => rm(d, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 })),
+ servers.splice(0).map((s) => new Promise<void>((done) => s.close(() => done()))),
);
+ await Promise.all(directories.splice(0).map((d) => removeDirectory(d)));
for (const [key, value] of [
['KILN_RENDER_SERVICE_PORT', saved.port],
['KILN_RENDER_SERVICE_DIR', saved.dir],