From 0169c518207ac7ab10d5545ad684984a9ce7f113 Mon Sep 17 00:00:00 2001 From: vominh1919 Date: Tue, 28 Apr 2026 13:18:04 +0700 Subject: [PATCH] fix(config): add request_timeout_seconds and stale_timeout_seconds to provider _KNOWN_KEYS Both keys are documented in cli-config.yaml.example and read at runtime by hermes_cli/timeouts.py (get_provider_request_timeout and get_provider_stale_timeout), but the provider-entry validator in config.py flagged them as unknown, producing noisy warnings on every CLI invocation for users who followed the documented config. Fixes #16779 --- hermes_cli/config.py | 1 + .../hermes_cli/test_provider_config_validation.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hermes_cli/config.py b/hermes_cli/config.py index 13337316e..772025845 100644 --- a/hermes_cli/config.py +++ b/hermes_cli/config.py @@ -2205,6 +2205,7 @@ def _normalize_custom_provider_entry( "name", "api", "url", "base_url", "api_key", "key_env", "api_mode", "transport", "model", "default_model", "models", "context_length", "rate_limit_delay", + "request_timeout_seconds", "stale_timeout_seconds", } for camel, snake in _CAMEL_ALIASES.items(): if camel in entry and snake not in entry: diff --git a/tests/hermes_cli/test_provider_config_validation.py b/tests/hermes_cli/test_provider_config_validation.py index ffc036b31..cbfffea78 100644 --- a/tests/hermes_cli/test_provider_config_validation.py +++ b/tests/hermes_cli/test_provider_config_validation.py @@ -82,7 +82,7 @@ class TestNormalizeCustomProviderEntry: """Unknown config keys should produce a warning.""" entry = { "base_url": "https://api.example.com/v1", - "api_key": "sk-test-key", + "api_key": "***", "unknownField": "value", "anotherBad": 42, } @@ -91,6 +91,19 @@ class TestNormalizeCustomProviderEntry: assert result is not None assert any("unknown config keys" in r.message.lower() for r in caplog.records) + def test_timeout_keys_not_flagged_unknown(self, caplog): + """request_timeout_seconds and stale_timeout_seconds should not produce warnings.""" + entry = { + "base_url": "https://api.example.com/v1", + "api_key": "***", + "request_timeout_seconds": 300, + "stale_timeout_seconds": 900, + } + with caplog.at_level(logging.WARNING): + result = _normalize_custom_provider_entry(entry, provider_key="test") + assert result is not None + assert not any("unknown config keys" in r.message.lower() for r in caplog.records) + def test_camel_case_warning_logged(self, caplog): """camelCase alias mapping should produce a warning.""" entry = {