From 72104eb06f267286ec207feed65dc00656ce4e9f Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 30 Mar 2026 13:24:48 -0700 Subject: [PATCH] fix(gateway): honor default for invalid bool-like config values (#4029) Co-authored-by: aydnOktay --- gateway/config.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gateway/config.py b/gateway/config.py index c8ce89a7d..8c7843780 100644 --- a/gateway/config.py +++ b/gateway/config.py @@ -27,9 +27,16 @@ def _coerce_bool(value: Any, default: bool = True) -> bool: return default if isinstance(value, bool): return value + if isinstance(value, int): + return value != 0 if isinstance(value, str): - return value.strip().lower() in ("true", "1", "yes", "on") - return bool(value) + lowered = value.strip().lower() + if lowered in ("true", "1", "yes", "on"): + return True + if lowered in ("false", "0", "no", "off"): + return False + return default + return default def _normalize_unauthorized_dm_behavior(value: Any, default: str = "pair") -> str: