From 48d8e2ff1cf2ba843c4dc8099de1fae4ac6d58d9 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:48:05 +0100 Subject: [PATCH] fix: assistant's automation is refused when it leaves out the action type (#35384) When the assistant created or changed an automation from a chat, the tool told it an action's type was optional and defaulted to a prompt, but an action sent without it was refused with a raw validation error and nothing was saved. An action without a type is now read from what it holds, as a prompt or as code, so the automation is created or updated as the assistant was told it would be. Fixes #35379 --- backend/open_webui/tools/builtin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/tools/builtin.py b/backend/open_webui/tools/builtin.py index 5c2fb3425a..511444fb17 100644 --- a/backend/open_webui/tools/builtin.py +++ b/backend/open_webui/tools/builtin.py @@ -10,7 +10,7 @@ import asyncio import logging import ntpath import time -from typing import Annotated, Any, Literal, Optional, Union +from typing import Any, Literal, Optional, Union from urllib.parse import unquote from fastapi import HTTPException, Request @@ -4451,7 +4451,8 @@ class AutomationCodeForm(BaseModel): new_chat: bool = Field(False, description='True sends each prompt to a new chat; false sends them to this chat.') -AutomationActionForm = Annotated[Union[AutomationPromptForm, AutomationCodeForm], Field(discriminator='type')] +# Untagged, so an action without a type is read by its fields, as the schema's type defaults promise. +AutomationActionForm = Union[AutomationPromptForm, AutomationCodeForm] async def _automation_action(action, metadata: dict, user_id: str, saved_tools: list[dict]) -> dict: