fix(gateway): ignore malformed custom delay env vars in natural mode

This commit is contained in:
Krionex 2026-04-28 12:04:27 +03:00 committed by Teknium
parent 349d0da07e
commit 3b16c590e0
2 changed files with 13 additions and 2 deletions

View file

@ -492,6 +492,16 @@ class TestGetHumanDelay:
delay = BasePlatformAdapter._get_human_delay()
assert 0.8 <= delay <= 2.5
def test_natural_mode_ignores_malformed_custom_env_vars(self):
env = {
"HERMES_HUMAN_DELAY_MODE": "natural",
"HERMES_HUMAN_DELAY_MIN_MS": "oops",
"HERMES_HUMAN_DELAY_MAX_MS": "still-bad",
}
with patch.dict(os.environ, env):
delay = BasePlatformAdapter._get_human_delay()
assert 0.8 <= delay <= 2.5
def test_custom_mode_uses_env_vars(self):
env = {
"HERMES_HUMAN_DELAY_MODE": "custom",