Skip to content

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

fix(cos): keep GLB avatars' shared useGLTF buffers alive with dispose={null}

Adam Eivy2c70fe347db9
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index a4cab57b16..16c4b419a1 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -32,6 +32,7 @@
## Fixed
+- **The Chief of Staff 3D avatar no longer sometimes renders as an empty glowing ring.** The Cyber Muse and Mini-Character avatars share one loaded 3D model with the CyberCity player avatar, and letting the 3D engine free that model's data when one avatar left the screen left the next one pointing at freed data — so it drew nothing, leaving just the halo ring behind it (which looked like a lone SVG circle). This happened intermittently after switching avatar styles, changing tabs, or visiting CyberCity. Each avatar now keeps the shared model intact when it unmounts, so it reloads cleanly every time.
- **Music Video analysis now finds the beat in guitar-led songs and shows its evidence.** The offline detector uses spectral change instead of whole-track loudness changes, with later-window consensus for quiet or rubato intros. The director timeline now includes a full-song energy waveform, beat/downbeat markers, section energy, time rulers, a clickable overview, and an explicit 4/4-grid assumption instead of presenting an empty “beat-quantized” strip when the cached analysis contains no visible musical information.
- **Music Video final renders now honor the authored song timeline.** Scene clips loop when their generated source is shorter than the beat-aligned cut, so an arrangement can cover the full track instead of being silently truncated to each model's native clip length.
- **The task form's Screenshot and Attach buttons work again — a stuck notification was eating the clicks.** A notice that never goes away (the "Install out of sync" warning, "Update available", "New build available") parks in the bottom-right corner, and on a desktop window it landed on top of the Chief of Staff task form and silently absorbed every click meant for the buttons underneath. They did nothing at all — no file picker, no error, nothing in the browser console — which is why it read as a broken button rather than something covering one, and why the same page still worked on a phone, where the layout puts those buttons elsewhere. On a 1280×720 window the notice covered a 520×86px block starting at the exact pixel the Attach button begins. Notices that never dismiss themselves now fold into a small badge in the corner after 8 seconds (1600px², clear of the page); clicking the badge brings the message back, and it stays open while you hover it or use its buttons. Toasts with a set lifetime — including the manuscript Undo prompt — are untouched.
diff --git a/client/src/components/cos/MiniCharacterCoSAvatar.jsx b/client/src/components/cos/MiniCharacterCoSAvatar.jsx
index 6e64d213e6..295c4e579e 100644
--- a/client/src/components/cos/MiniCharacterCoSAvatar.jsx
+++ b/client/src/components/cos/MiniCharacterCoSAvatar.jsx
@@ -101,7 +101,11 @@ function MiniCharacter({ state, speaking, variant }) {
return (
<group ref={group}>
- <primitive object={scene} />
+ {/* dispose={null}: SkeletonUtils.clone shares geometry/material refs with
+ drei's useGLTF cache (the clone is shallow for those), so letting R3F
+ dispose them on unmount corrupts the cache and the next mount renders
+ disposed buffers as an invisible mesh (see the CoS Muse avatar). */}
+ <primitive object={scene} dispose={null} />
</group>
);
}
diff --git a/client/src/components/cos/MuseCoSAvatar.jsx b/client/src/components/cos/MuseCoSAvatar.jsx
index 66f2743dc3..3777eca189 100644
--- a/client/src/components/cos/MuseCoSAvatar.jsx
+++ b/client/src/components/cos/MuseCoSAvatar.jsx
@@ -235,7 +235,11 @@ function GLBAvatar({ state, speaking }) {
return (
<group ref={ref}>
- <primitive object={scene} />
+ {/* dispose={null}: SkeletonUtils.clone shares geometry/material refs with
+ drei's useGLTF cache (shallow clone), so letting R3F dispose them on
+ unmount corrupts the cache — the next mount then renders disposed
+ buffers as an invisible mesh, leaving only the halo ring ("SVG circle"). */}
+ <primitive object={scene} dispose={null} />
</group>
);
}
diff --git a/client/src/components/media/GlbViewer.jsx b/client/src/components/media/GlbViewer.jsx
index 415b25783d..bd476dffcf 100644
--- a/client/src/components/media/GlbViewer.jsx
+++ b/client/src/components/media/GlbViewer.jsx
@@ -71,7 +71,13 @@ function GlbModel({ src, forceOpaque }) {
});
};
}, [forceOpaque, renderedScene]);
- return <primitive object={renderedScene} />;
+ // dispose={null}: when !forceOpaque this primitive renders drei's cached scene
+ // directly, and even the forceOpaque clone shares geometry refs with the cache
+ // (scene.clone(true) is shallow for geometry). Letting R3F auto-dispose those
+ // GPU buffers on unmount would empty the cache the comment above deliberately
+ // keeps, so revisiting the same `src` would render a blank mesh. The cloned
+ // opaque *materials* (not shared) are still freed by the cleanup effect above.
+ return <primitive object={renderedScene} dispose={null} />;
}
// Own `scene.environmentIntensity` directly rather than passing drei's