From 0bdaa4c3738e840e1c292b2227501f405d38f3cd Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 3 May 2026 23:22:39 -0500 Subject: [PATCH] Fix auto_filing: check env var before ERPNext to avoid hanging on dev When AUTO_FILING_ENABLED is explicitly set as an env var, skip the ERPNext API call entirely. The ERPNext client hangs indefinitely when the host is unreachable (dev workers can't reach prod ERPNext), blocking all compliance handlers. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/workers/services/telecom/auto_filing.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/workers/services/telecom/auto_filing.py b/scripts/workers/services/telecom/auto_filing.py index 2e53fa4..f6145de 100644 --- a/scripts/workers/services/telecom/auto_filing.py +++ b/scripts/workers/services/telecom/auto_filing.py @@ -74,6 +74,10 @@ def _env_truthy(value: str | None) -> bool: def _settings_from_erpnext() -> tuple[bool, str]: """Read ``Compliance Settings`` from ERPNext — returns (enabled, admin_email).""" + # Fast path: if AUTO_FILING_ENABLED env var is explicitly set, skip ERPNext + env_val = os.environ.get("AUTO_FILING_ENABLED") + if env_val is not None: + return _env_truthy(env_val), (os.environ.get("ADMIN_EMAIL") or DEFAULT_ADMIN_EMAIL) try: from scripts.workers.erpnext_client import ERPNextClient