From b123dc31176bafec3dcdea557f98dfa1ceb8ef81 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 17 Mar 2026 22:38:11 -0400 Subject: [PATCH] Fix scheduler timezone: use ZoneInfo(settings.scheduler_timezone) not 'local' --- cortex/config.py | 1 + cortex/scheduler.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cortex/config.py b/cortex/config.py index ab7e31c..ecab22d 100644 --- a/cortex/config.py +++ b/cortex/config.py @@ -28,6 +28,7 @@ class Settings(BaseSettings): # Auto-distillation schedule — override in .env # AUTO_DISTILL=false disables entirely + scheduler_timezone: str = "America/Chicago" # IANA tz — set in .env if different auto_distill: bool = True auto_distill_short: bool = True # daily at 03:00 — rolls session logs → MEMORY_SHORT auto_distill_mid: bool = True # weekly Sunday at 03:30 — LLM summarizes short → mid diff --git a/cortex/scheduler.py b/cortex/scheduler.py index a59e53b..f53a55f 100644 --- a/cortex/scheduler.py +++ b/cortex/scheduler.py @@ -10,6 +10,7 @@ Set AUTO_DISTILL=false to disable entirely. Set AUTO_DISTILL_LONG=true to enable monthly long-term integration. """ import logging +from zoneinfo import ZoneInfo from apscheduler.schedulers.asyncio import AsyncIOScheduler from config import settings @@ -57,7 +58,7 @@ def start() -> None: logger.info("auto distillation disabled (AUTO_DISTILL=false)") return - _scheduler = AsyncIOScheduler(timezone="local") + _scheduler = AsyncIOScheduler(timezone=ZoneInfo(settings.scheduler_timezone)) if settings.auto_distill_short: _scheduler.add_job(_run_short, "cron", hour=3, minute=0, id="distill_short")