Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: refuse a write-mode retarget on its over-cap proposal, not just on changed weights (#5893)
Adam Eivyb178c52b4c72
diff --git a/server/services/rigging/retarget.test.js b/server/services/rigging/retarget.test.jsindex 467d6e5292..171b93c313 100644--- a/server/services/rigging/retarget.test.js+++ b/server/services/rigging/retarget.test.js@@ -181,13 +181,19 @@ describe('retarget orchestration contract', () => {expect(existsSync(paths.stageDir)).toBe(false);});- it('refuses a write-mode run whose cleanup exceeded the cap, leaving nothing published', async () => {+ it('surfaces the cap sentence when a write-mode run refused its own over-cap cleanup', async () => {+ // The shape a CORRECT worker produces: it measured an over-cap proposal, changed+ // nothing, and exited non-zero. The user must get the numbers, not a generic+ // "worker exited 2" — and nothing may be published.const overCap = cleanReport();- overCap.head_cleanup = { ...overCap.head_cleanup, mode: 'write', proposed_vertices: 900, changed_vertices: 900 };+ overCap.head_cleanup = { ...overCap.head_cleanup, mode: 'write', proposed_vertices: 900, changed_vertices: 0 };await expect(run({mode: 'write',spawnImpl: fakeWorker({ probe: cleanProbe(), report: overCap, applyCode: 2 }),- })).rejects.toMatchObject({ code: 'RIGGING_RETARGET_GATE_FAILED' });+ })).rejects.toMatchObject({+ code: 'RIGGING_RETARGET_GATE_FAILED',+ message: expect.stringContaining('re-bind 900 of 10000 vertices, and the cap is 200'),+ });expect(existsSync(retargetRunPaths({ recordDir, retargetId: RETARGET_ID }).publishedGlb)).toBe(false);});diff --git a/server/services/rigging/retargetReport.js b/server/services/rigging/retargetReport.jsindex 0891e99df7..681689f278 100644--- a/server/services/rigging/retargetReport.js+++ b/server/services/rigging/retargetReport.js@@ -187,6 +187,12 @@ export function reduceRetargetGate(report, { thresholds = RETARGET_DEFAULTS, modif (mode === 'diagnostic' && metrics.changedCleanupVertices !== 0) {return { ok: false, reason: 'diagnostic-mode-wrote', metrics };}+ // Two shapes of the same refusal, and BOTH are needed. A correct worker refuses an+ // over-cap proposal before touching a weight and reports `changed: 0`, so gating only+ // on `changed` would let that run fall through to a generic "worker exited 2" and lose+ // the sentence naming the numbers. A worker that wrote past the cap anyway is the+ // defense-in-depth case.+ if (mode === 'write' && metrics.cleanupOverCap) return { ok: false, reason: 'head-cleanup-over-cap', metrics };if (metrics.changedCleanupVertices > capVertices) return { ok: false, reason: 'head-cleanup-over-cap', metrics };const { roundTrip } = measured;diff --git a/server/services/rigging/retargetReport.test.js b/server/services/rigging/retargetReport.test.jsindex 54e99ad9fd..6c7eaca830 100644--- a/server/services/rigging/retargetReport.test.js+++ b/server/services/rigging/retargetReport.test.js@@ -101,6 +101,16 @@ describe('retarget gate', () => {expect(describeRetargetFailure(result.reason, result.metrics)).toContain('re-bind 900 of 10000 vertices, and the cap is 200');+ // A CORRECT worker refuses an over-cap proposal before touching a weight, so it+ // reports `changed: 0`. Gating only on `changed` would pass this run and lose the+ // sentence naming the numbers behind a generic worker-exit message.+ const refusedByWorker = cleanReport();+ refusedByWorker.head_cleanup = {+ ...refusedByWorker.head_cleanup, mode: 'write', proposed_vertices: 900, changed_vertices: 0,+ };+ expect(gate(refusedByWorker, { mode: 'write' }))+ .toMatchObject({ ok: false, reason: 'head-cleanup-over-cap' });+// At the cap exactly, a write run is allowed — the cap is a ceiling, not a limit// that also forbids reaching it.const atCap = cleanReport();diff --git a/server/services/rigging/retargetWorker.py b/server/services/rigging/retargetWorker.pyindex 7edce9040e..fb7ef8f985 100644--- a/server/services/rigging/retargetWorker.py+++ b/server/services/rigging/retargetWorker.py@@ -131,7 +131,10 @@ def probe(job):# The clip file first, in its own scene: a clip GLB commonly carries a whole rig of# its own, and mixing it with the target here would make the bone lists ambiguous.+ # The fps is pinned after the reset for the same reason the apply pass pins it -- the+ # reported clip durations are frames divided by it.bpy.ops.wm.read_factory_settings(use_empty=True)+ bpy.context.scene.render.fps = int(SCENE_FPS)bpy.ops.import_scene.gltf(filepath=job["clip_glb"])animated = []for action in bpy.data.actions:@@ -334,9 +337,11 @@ def apply_clip(job): # noqa: PLR0911, PLR0915 -- one linear pipeline; each retu},}- # (1) The rigged character is the target.- bpy.context.scene.render.fps = int(SCENE_FPS)+ # (1) The rigged character is the target. The fps is pinned AFTER the factory reset+ # (which would restore the default) because every frame<->second conversion in+ # this file -- the durations in the report included -- reads through it.bpy.ops.wm.read_factory_settings(use_empty=True)+ bpy.context.scene.render.fps = int(SCENE_FPS)bpy.ops.import_scene.gltf(filepath=job["rig_glb"])armatures = _scene_objects(bpy, "ARMATURE")meshes = _scene_objects(bpy, "MESH")