fix(timeouts): guard load_config() call against runtime exceptions - #16232
Closed
sprmn24 wants to merge 1 commit into
Closed
fix(timeouts): guard load_config() call against runtime exceptions#16232sprmn24 wants to merge 1 commit into
sprmn24 wants to merge 1 commit into
Conversation
Both get_provider_request_timeout() and get_provider_stale_timeout() wrapped the load_config import in try/except ImportError but left the actual load_config() call unprotected. A corrupt config file, YAML parse error, or permission failure would raise instead of returning None safely. Move load_config() inside the try block so any exception returns None.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Both
get_provider_request_timeout()andget_provider_stale_timeout()inhermes_cli/timeouts.pywrapped theload_configimport intry/except ImportErrorbut left the actualload_config()call unprotected outside the block.Type of Change
Root Cause
If
load_config()raises at runtime (corrupt YAML, parse error, permission failure), the exception propagates up instead of returningNonesafely — breaking any provider timeout resolution silently.Changes Made
load_config()call inside thetryblock in both functions(ImportError, Exception)to catch all failure modesNonesafely on any config load failureHow to Test
~/.hermes/config.yamlget_provider_request_timeout("openai")NonesafelyChecklist
hermes_cli/timeouts.py