Fix: import main in _actor_id() causes app.run() hang — use module-level var instead

This commit is contained in:
daniel
2026-05-08 11:32:21 -05:00
parent 54902cca8d
commit 9d21d5d2e5
2 changed files with 12 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ from tools.scheduler import schedule_reminder, list_reminders, cancel_reminder
import tools.scheduler as _scheduler_module
from tools.home_assistant import home_assistant, set_ha_config
from tools.google_workspace import list_calendars, get_calendar_events, list_gmail_messages, get_gmail_message
import tools.google_workspace as _gws
import httpx
import botocore.auth
import botocore.awsrequest
@@ -190,6 +191,10 @@ async def main(payload: dict, context):
adapter_config = payload.get('channel_adapter', {})
channel_type = adapter_config.get('type', 'telegram')
actor_id_early = payload.get('actor_id', adapter_config.get('target_id', 'default'))
_current_actor_id = actor_id_early
_gws._current_actor_id = actor_id_early # sync to google_workspace module
if channel_type == 'telegram':
adapter = TelegramAdapter(
chat_id=adapter_config.get('target_id', ''),