From 19fc1bbdf81ff1d6a1d2388b1efd0434c1686706 Mon Sep 17 00:00:00 2001 From: Cameron Cordes Date: Sat, 13 Jun 2026 23:12:54 -0400 Subject: [PATCH] Reels pre-gen: use DEFAULT_MAX_SEGMENTS so cache keys match on-demand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pregen_one hardcoded max_segments: 24 while create_reel_handler defaults to DEFAULT_MAX_SEGMENTS (40). Since the cache key encodes the raw max_segments, the pre-generated reel's key never matched the client's on-demand request, so POST /reels cache-hit an older max=40 reel and the agentic pre-gen file was left orphaned. Align to DEFAULT_MAX_SEGMENTS (as the plan specified) so the on-demand cache-hit path serves the pre-gen reel. Content is unchanged — the actual beat count is duration-budgeted either way; only the key descriptor differed. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/reels/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/reels/mod.rs b/src/reels/mod.rs index 059ce43..2a4e6e9 100644 --- a/src/reels/mod.rs +++ b/src/reels/mod.rs @@ -1053,7 +1053,11 @@ async fn pregen_one( } else { Some(library.to_string()) }, - max_segments: 24, + // Must match the on-demand default (create_reel_handler) so the cache + // key — which encodes the raw max_segments — lines up and the on-demand + // cache-hit path serves this pre-generated reel. The client sends no + // max_segments, so it defaults to DEFAULT_MAX_SEGMENTS there too. + max_segments: selector::DEFAULT_MAX_SEGMENTS, }; let exif_dao = app_state.insight_generator.exif_dao();