Reels pre-gen: fix runtime breakers from review (1-5)
1. Drop the unregistered prefs_dao/reel_dao web::Data extractors from create_reel_handler / precomputed_reel_handler and read the DAOs off AppState instead (consistent with the scheduler). Missing app_data would have 500'd every POST /reels and /reels/precomputed at runtime. 2. Restore the dropped 'return' in the cache-hit branch — without it a cache hit fell through, overwrote the Done job with Queued, and re-ran the whole TTS+render pipeline on every request. 3. Make secs_until_next_run_hour minute/second-accurate so a batch that finishes inside the run hour sleeps ~24h instead of busy-looping (wake, re-run, sleep 0) for the rest of the hour. Tests updated. 4. Prune photo/user-bound tools (get_file_tags, get_faces_in_photo, recall_facts_for_photo, recall_facts_for_entity) from the agentic reel scripter's allow-list — they no-op/error with the empty file/user context and only burn iterations. 5. Align AGENTIC_SYSTEM_PROMPT's advertised tool list with the actual (pruned) allow-list. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+12
-8
@@ -53,10 +53,12 @@ Be concrete and grounded in the details given; never invent names, places, or \
|
||||
events that aren't supported. Keep each line to one or two short sentences that \
|
||||
can be read aloud in a few seconds. Avoid generic filler like \"what a \
|
||||
wonderful day\" — if you have little to go on, simply describe the moment \
|
||||
plainly.\n\nYou may call read-only tools (search_messages, get_file_tags, \
|
||||
reverse_geocode, get_current_datetime, recall_entities, recall_facts_for_photo, \
|
||||
recall_facts_for_entity) to ground each line in real context. Never invent \
|
||||
details. Return ONLY the JSON object, no prose or code fences.";
|
||||
plainly.\n\nYou may call read-only tools (search_rag, search_messages, \
|
||||
get_sms_messages, get_calendar_events, get_location_history, reverse_geocode, \
|
||||
get_personal_place_at, recall_entities, get_current_datetime) to ground each \
|
||||
line in real context — e.g. reverse_geocode a moment's GPS to name the place, \
|
||||
or check the calendar/messages around its date. Never invent details. Return \
|
||||
ONLY the JSON object, no prose or code fences.";
|
||||
|
||||
/// Maximum agentic tool iterations for pre-generation. Tunable via
|
||||
/// `REEL_PREGEN_MAX_TOOL_ITERS` (default 8).
|
||||
@@ -317,19 +319,21 @@ pub async fn generate_script_agentic(
|
||||
// then filter out write tools.
|
||||
let gate = generator.current_gate_opts_for_persona(false, None);
|
||||
let all_tools = InsightGenerator::build_tool_definitions(gate);
|
||||
// Whole-reel calls have no single photo and no authenticated user, so the
|
||||
// loop runs execute_tool with empty file/image context and user_id=0. Only
|
||||
// tools that work without that context are useful here — photo/user-bound
|
||||
// tools (get_file_tags, get_faces_in_photo, recall_facts_for_photo,
|
||||
// recall_facts_for_entity) would just no-op or error, burning iterations,
|
||||
// so they're excluded.
|
||||
let read_only_names: std::collections::HashSet<&str> = [
|
||||
"search_rag",
|
||||
"search_messages",
|
||||
"get_sms_messages",
|
||||
"get_calendar_events",
|
||||
"get_location_history",
|
||||
"get_file_tags",
|
||||
"get_faces_in_photo",
|
||||
"reverse_geocode",
|
||||
"get_personal_place_at",
|
||||
"recall_entities",
|
||||
"recall_facts_for_photo",
|
||||
"recall_facts_for_entity",
|
||||
"get_current_datetime",
|
||||
]
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user