feat(consolidation): trigger from log_work and status terminal transitions
log_work tool now invokes maybe_consolidate(reason='log_added') after a successful create_log. The gate inside the consolidation service handles threshold + setting checks. update_note service snapshots old_status before mutation and fires maybe_consolidate(reason='task_closed') when the status transitions into 'done' or 'cancelled'. Re-saving an already-terminal status doesn't retrigger — only transitions count.
This commit is contained in:
@@ -113,4 +113,8 @@ async def log_work_tool(*, user_id, arguments, **_ctx):
|
||||
log = await _create_log(user_id, note.id, content, duration_minutes)
|
||||
except ValueError as e:
|
||||
return {"success": False, "error": str(e)}
|
||||
|
||||
from fabledassistant.services.consolidation import maybe_consolidate
|
||||
await maybe_consolidate(user_id, note.id, reason="log_added")
|
||||
|
||||
return {"success": True, "log": log.to_dict(), "task": note.title}
|
||||
|
||||
Reference in New Issue
Block a user