From 3cdc7a73ef2e0fd2cf0d2678d466ca4539548158 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 21 Dec 2025 18:23:53 +0000 Subject: [PATCH] This commit fixes a critical bug where the bot would get stuck in previous conversational flows and provide incorrect responses. The /start command handler in main.py now explicitly calls flow_engine.end_flow() to clear any existing conversation state for the user. This ensures that every /start command provides a clean slate, resolving the state management issue and making the bot's interactions predictable and correct. --- talia_bot/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/talia_bot/main.py b/talia_bot/main.py index 1495b98..4f267ff 100644 --- a/talia_bot/main.py +++ b/talia_bot/main.py @@ -90,6 +90,13 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: Muestra un mensaje de bienvenida y un menú según el rol del usuario. """ chat_id = update.effective_chat.id + + # Reset any existing conversation flow + flow_engine = context.bot_data.get("flow_engine") + if flow_engine: + flow_engine.end_flow(chat_id) + logger.info(f"User {chat_id} started a new conversation, clearing any previous state.") + user_role = get_user_role(chat_id) logger.info(f"Usuario {chat_id} inició conversación con el rol: {user_role}")