From e26da4307661e69f57336fee7cee4339e391e0e8 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 30 Sep 2026 17:01:42 +0200 Subject: [PATCH] fix: automation still shows "Last run Never" after "Run now" (#31583) * fix: automation still shows "Last run Never" after "Run now" Running an automation with "Run now" added the run to its history, but the automation page and the Automations list kept showing "Last run Never" (or the time of the last scheduled run). Only scheduled runs recorded a last run time. A manual run now records it too, so the automation page and the Automations list show the time of the run you just started. Fixes #31580 * fix: show the new last run time right after Run now The automation page now takes the automation the server returns after Run now, so the last run time updates on the spot and no reload is needed. --- backend/open_webui/models/automations.py | 9 +++++++++ backend/open_webui/routers/automations.py | 1 + src/lib/components/automations/AutomationEditor.svelte | 1 + 3 files changed, 11 insertions(+) diff --git a/backend/open_webui/models/automations.py b/backend/open_webui/models/automations.py index 954026cfc8..0aab02e5f6 100644 --- a/backend/open_webui/models/automations.py +++ b/backend/open_webui/models/automations.py @@ -244,6 +244,15 @@ class AutomationTable: await db.commit() return AutomationModel.model_validate(row) + async def update_last_run_at(self, id: str, db: Optional[AsyncSession] = None) -> Optional[AutomationModel]: + async with get_async_db_context(db) as db: + row = await db.get(Automation, id) + if not row: + return None + row.last_run_at = int(time.time_ns()) + await db.commit() + return AutomationModel.model_validate(row) + async def clear_folder_ids( self, user_id: str, diff --git a/backend/open_webui/routers/automations.py b/backend/open_webui/routers/automations.py index 4b44a8b8ed..f5ab9b9536 100644 --- a/backend/open_webui/routers/automations.py +++ b/backend/open_webui/routers/automations.py @@ -341,6 +341,7 @@ async def run_automation_by_id( await check_automations_permission(request, user) automation = await Automations.get_by_id(id, db=db) check_automation_access(automation, user) + automation = await Automations.update_last_run_at(automation.id, db=db) asyncio.create_task(execute_automation(request.app, automation)) await publish_event( request, diff --git a/src/lib/components/automations/AutomationEditor.svelte b/src/lib/components/automations/AutomationEditor.svelte index e71bb4e9cf..821efc1eec 100644 --- a/src/lib/components/automations/AutomationEditor.svelte +++ b/src/lib/components/automations/AutomationEditor.svelte @@ -167,6 +167,7 @@ return null; }); if (res) { + automation = res; toast.success($i18n.t('Automation triggered')); setTimeout(() => loadRuns(false), 2000); }