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([issue-737]): hold FFLF budget floor through 64 GB (review)

[._.]/ Adam Eivyb065f08bf8f8
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index a2c0cded6c..3639ad1ecc 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -28,7 +28,7 @@
## Fixed
-- **[issue-737] Keyframe-interpolation video is smoother on high-memory Macs** — When you interpolate a video between two keyframes, the result no longer stutters on machines with plenty of memory. The clip-length cap that governs motion quality used to be pinned to a conservative 48 GB-safe value, which on any machine clamped interpolated clips so short that motion advanced in juddery near-duplicate pairs. That cap now scales with your Mac's unified memory — a 128 GB machine renders the longer clips needed for smooth motion out of the box, while 48 GB and smaller machines behave exactly as before. You can still override it with the `FFLF_LTX2_PIXEL_BUDGET` setting.
+- **[issue-737] Keyframe-interpolation video is smoother on high-memory Macs** — When you interpolate a video between two keyframes, the result no longer stutters on machines with plenty of memory. The clip-length cap that governs motion quality used to be pinned to a conservative 48 GB-safe value, which on any machine clamped interpolated clips so short that motion advanced in juddery near-duplicate pairs. That cap now scales with your Mac's unified memory — a 128 GB machine renders the longer clips needed for smooth motion out of the box, while machines with 64 GB or less behave exactly as before. You can still override it with the `FFLF_LTX2_PIXEL_BUDGET` setting.
- **[issue-894] Numeric edge-case hardening** — Task-learning duration stats can no longer go negative when resetting a task type against an older or hand-edited store, goal velocity reports no trend (instead of a garbage value) when a progress entry has a malformed date, and a stray non-numeric music gain falls back to the default instead of breaking an audio render.
- **Autofixer dashboard now loads over Tailscale HTTPS** — On installs with a Tailscale TLS cert, the main app is served over HTTPS, so the sidebar's "Autofixer" link points at `https://<host>:5560`. The standalone Autofixer UI server was hard-coded to plain HTTP, so that HTTPS request hit an HTTP-only listener and failed to connect (e.g. `https://void.taile8179.ts.net:5560/` wouldn't load). The Autofixer UI now serves HTTPS with the same shared `data/certs/` cert when one is present (and hot-reloads it on renewal), falling back to plain HTTP when no cert exists — so its scheme always matches the link the sidebar generates.
diff --git a/server/services/videoGen/local.js b/server/services/videoGen/local.js
index e7cccba5e6..7f32fd4960 100644
--- a/server/services/videoGen/local.js
+++ b/server/services/videoGen/local.js
@@ -228,31 +228,36 @@ export const loadHistory = () => readJSONFile(HISTORY_FILE, []);
export const saveHistory = (h) => atomicWrite(HISTORY_FILE, h);
// FFLF/ltx2 stage-2 peak memory scales with the pixel-frame count
-// (width × height × numFrames), so the cap is on that product. Two anchors,
-// both measured on real renders:
+// (width × height × numFrames), so the cap is on that product. Anchors are
+// measured on real renders:
// • 48 GB unified RAM → 704×448×25 ≈ 7.9M pixel-frames is the largest that
-// fits stage 2 (704×448×97 OOMs there). This stays the floor.
+// fits stage 2 (704×448×97 OOMs there). This is the tested-safe value.
// • 128 GB unified RAM → 768×512×97 ≈ 38.1M pixel-frames renders comfortably
// (validated for issue #737). 97 frames is the threshold below which FFLF
// interpolation visibly strobes (frames advance in near-duplicate pairs),
// so a budget that can't reach 97 frames at a usable resolution forces the
// poor-motion regime — the whole reason this scales with RAM now.
-// Linearly interpolate per detected total RAM, floored at the 48 GB value so
-// machines at or below 48 GB are never given LESS than the previously-shipped
-// (tested-safe) cap — i.e. this only ever raises the budget, never lowers it.
-const FFLF_BUDGET_48GB = 704 * 448 * 25; // 7,884,800 — tested-safe floor (≤48 GB)
+// HOLD the tested-safe value through 64 GB, THEN ramp 64→128 GB up to the
+// validated value. The stage-2 path is documented to OOM on 64 GB Macs at full
+// resolution (see buildLtx2Args below), so the 48–64 GB band keeps EXACTLY the
+// previously-shipped cap — no machine that already ran is handed a larger,
+// untested budget. The bump is reserved for the headroom above 64 GB, and the
+// curve only ever raises the cap, never lowers it. FFLF_LTX2_PIXEL_BUDGET
+// overrides entirely (raise it on a roomy box, lower it if a render OOMs).
+const FFLF_BUDGET_FLOOR = 704 * 448 * 25; // 7,884,800 — tested-safe (held ≤64 GB)
const FFLF_BUDGET_128GB = 768 * 512 * 97; // 38,141,952 — validated on 128 GB (#737)
-const FFLF_BUDGET_SLOPE = (FFLF_BUDGET_128GB - FFLF_BUDGET_48GB) / (128 - 48); // px-frames per GB above 48
+const FFLF_RAMP_START_GB = 64; // below this, hold the floor (64 GB Macs OOM at full res)
+const FFLF_BUDGET_SLOPE = (FFLF_BUDGET_128GB - FFLF_BUDGET_FLOOR) / (128 - FFLF_RAMP_START_GB); // px-frames/GB above 64
const BYTES_PER_GB = 1024 ** 3;
// Pure: pixel-frame budget for a machine with `totalMemBytes` of unified RAM.
-// Anchored on the two measured points above, floored at the 48 GB value.
+// Held at the tested-safe floor through 64 GB, then linear to the 128 GB anchor.
// Exported for unit testing; resolveFflfLtx2PixelBudget wraps it with os.totalmem().
export const computeFflfLtx2PixelBudget = (totalMemBytes) => {
const gb = Number(totalMemBytes) / BYTES_PER_GB;
- if (!(gb > 0)) return FFLF_BUDGET_48GB;
- const scaled = FFLF_BUDGET_48GB + (gb - 48) * FFLF_BUDGET_SLOPE;
- return Math.round(Math.max(FFLF_BUDGET_48GB, scaled));
+ if (!(gb > 0)) return FFLF_BUDGET_FLOOR;
+ const overRamp = Math.max(0, gb - FFLF_RAMP_START_GB);
+ return Math.round(FFLF_BUDGET_FLOOR + overRamp * FFLF_BUDGET_SLOPE);
};
// Effective FFLF/ltx2 stage-2 pixel-frame budget. FFLF_LTX2_PIXEL_BUDGET wins
diff --git a/server/services/videoGen/local.test.js b/server/services/videoGen/local.test.js
index 1426e1038b..4169216734 100644
--- a/server/services/videoGen/local.test.js
+++ b/server/services/videoGen/local.test.js
@@ -454,23 +454,29 @@ describe('FFLF/ltx2 pixel-budget helpers', () => {
});
describe('computeFflfLtx2PixelBudget (RAM-scaled, pure)', () => {
- it('hits the measured anchors exactly: 48 GB floor and 128 GB validated', () => {
+ it('hits the measured anchors exactly: 128 GB validated, tested-safe value at 48 GB', () => {
expect(computeFflfLtx2PixelBudget(48 * GB)).toBe(DEFAULT_BUDGET);
expect(computeFflfLtx2PixelBudget(128 * GB)).toBe(BUDGET_128GB);
});
- it('never drops below the 48 GB floor on smaller machines', () => {
- expect(computeFflfLtx2PixelBudget(32 * GB)).toBe(DEFAULT_BUDGET);
- expect(computeFflfLtx2PixelBudget(16 * GB)).toBe(DEFAULT_BUDGET);
+ it('holds the tested-safe floor through 64 GB so no already-running machine gets a larger untested cap', () => {
+ // 64 GB Macs are documented to OOM at full resolution — keep their cap
+ // EXACTLY where it shipped, don't extrapolate them upward.
expect(computeFflfLtx2PixelBudget(8 * GB)).toBe(DEFAULT_BUDGET);
+ expect(computeFflfLtx2PixelBudget(16 * GB)).toBe(DEFAULT_BUDGET);
+ expect(computeFflfLtx2PixelBudget(32 * GB)).toBe(DEFAULT_BUDGET);
+ expect(computeFflfLtx2PixelBudget(48 * GB)).toBe(DEFAULT_BUDGET);
+ expect(computeFflfLtx2PixelBudget(64 * GB)).toBe(DEFAULT_BUDGET);
+ // Just past the ramp start it begins to rise.
+ expect(computeFflfLtx2PixelBudget(65 * GB)).toBeGreaterThan(DEFAULT_BUDGET);
});
- it('scales monotonically with RAM between and above the anchors', () => {
- const b64 = computeFflfLtx2PixelBudget(64 * GB);
+ it('scales monotonically with RAM above the 64 GB ramp start', () => {
+ const b80 = computeFflfLtx2PixelBudget(80 * GB);
const b96 = computeFflfLtx2PixelBudget(96 * GB);
const b256 = computeFflfLtx2PixelBudget(256 * GB);
- expect(b64).toBeGreaterThan(DEFAULT_BUDGET);
- expect(b96).toBeGreaterThan(b64);
+ expect(b80).toBeGreaterThan(DEFAULT_BUDGET);
+ expect(b96).toBeGreaterThan(b80);
expect(BUDGET_128GB).toBeGreaterThan(b96);
expect(b256).toBeGreaterThan(BUDGET_128GB);
});