refactor(briefing)!: remove legacy one-shot synthesis, agentic-only

Deletes ~760 lines of legacy briefing code: format_task, compute_task_hash,
upsert_task_snapshots, _gather_internal, _gather_weekly_review,
_llm_synthesise, and the unified prompt helpers. run_compilation and
run_slot_injection are now agentic-tool-use-loop only.

briefing_scheduler and user_profile migrated from the deleted helper to
services.llm.generate_completion (retry + keep_alive baked in).

routes/briefing.manual_trigger now persists agentic tool-call receipts
via _persist_agentic_messages (previously silently dropped them) and
adds POST /api/briefing/reset-today to wipe today's briefing messages.

BREAKING: briefing_mode setting no longer honored; no legacy fallback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 20:42:42 -04:00
parent 66f906a629
commit 9eba6ac107
4 changed files with 87 additions and 785 deletions
+12 -2
View File
@@ -114,7 +114,7 @@ async def _consolidate_observations(user_id: int) -> str:
learned_summary paragraph. Prunes raw entries older than 30 days afterwards.
"""
from fabledassistant.config import Config
from fabledassistant.services.briefing_pipeline import _llm_synthesise
from fabledassistant.services.llm import generate_completion
from fabledassistant.services.settings import get_setting
async with async_session() as session:
@@ -145,7 +145,17 @@ async def _consolidate_observations(user_id: int) -> str:
user_prompt += f"New observations:\n{obs_text}"
model = await get_setting(user_id, "default_model", Config.OLLAMA_MODEL)
new_summary = await _llm_synthesise(system, user_prompt, model)
try:
new_summary = (await generate_completion(
[
{"role": "system", "content": system},
{"role": "user", "content": user_prompt},
],
model,
)).strip()
except Exception:
logger.warning("Observation consolidation failed for user %d", user_id, exc_info=True)
new_summary = ""
if new_summary:
cutoff = (date.today() - timedelta(days=30)).isoformat()