fix(timezone): add timezone-aware clock across agent, cron, and execute_code

This commit is contained in:
areu01or00 2026-03-03 11:57:18 +05:30
parent de0af4df66
commit a1c25046a9
9 changed files with 475 additions and 29 deletions

View file

@ -400,6 +400,11 @@ def execute_code(
child_env[k] = v
child_env["HERMES_RPC_SOCKET"] = sock_path
child_env["PYTHONDONTWRITEBYTECODE"] = "1"
# Inject user's configured timezone so datetime.now() in sandboxed
# code reflects the correct wall-clock time.
_tz_name = os.getenv("HERMES_TIMEZONE", "").strip()
if _tz_name:
child_env["TZ"] = _tz_name
proc = subprocess.Popen(
[sys.executable, "script.py"],