From 86cb3b08f52a704f4cec641ef0dd03c78bb57e83 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:44:57 +0000 Subject: [PATCH] Changes Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com> --- supabase/functions/provision-agent/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/supabase/functions/provision-agent/index.ts b/supabase/functions/provision-agent/index.ts index 47261a1..ddc7e54 100644 --- a/supabase/functions/provision-agent/index.ts +++ b/supabase/functions/provision-agent/index.ts @@ -480,6 +480,15 @@ async function handleUpdateExistingService( HERMES_TTS_PROVIDER: ttsProvider, }; + // Re-aplica TELEGRAM_ALLOWED_USERS / HOME_CHANNEL se já capturamos chat_id do dono + // (importante para corrigir agentes que foram provisionados sem chat_id e tinham + // que pedir pairing manual). + if (agent.telegram_user_chat_id) { + const chatIdStr = String(agent.telegram_user_chat_id); + variables.TELEGRAM_ALLOWED_USERS = chatIdStr; + variables.TELEGRAM_HOME_CHANNEL = chatIdStr; + } + try { await upsertRailwayVariableCollection({ token: RAILWAY_API_TOKEN!,