Skip to content

fix(timeouts): guard load_config() call against runtime exceptions - #16318

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-0fb41dd7
Apr 27, 2026
Merged

fix(timeouts): guard load_config() call against runtime exceptions#16318
teknium1 merged 2 commits into
mainfrom
hermes/hermes-0fb41dd7

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #16232 by @sprmn24.

Summary

get_provider_request_timeout() and get_provider_stale_timeout() wrapped only the load_config import in try/except. The actual load_config() call sat outside. load_config() calls ensure_hermes_home() before its own internal YAML-parse guard — so PermissionError on mkdir, RuntimeError in managed mode, or any other bootstrap failure would propagate up into ~14 call sites in run_agent.py and crash the agent loop on every API call.

Changes

  • hermes_cli/timeouts.py: move load_config() inside the try block in both helpers, broaden to except Exception (follow-up commit dropped redundant (ImportError, Exception)).

Validation

Before After
load_config() raises PermissionError propagates returns None
Existing tests 12 passed 12 passed

E2E verified by monkey-patching load_config to raise PermissionError — both helpers return None cleanly.

Closes #16232. Contributor authorship preserved via rebase merge.

sprmn24 and others added 2 commits April 26, 2026 19:46
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.
Exception already covers ImportError; (ImportError, Exception) was a
cosmetic wart from the bugfix. Pure no-op.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 27, 2026
@teknium1
teknium1 merged commit 366351b into main Apr 27, 2026
11 of 12 checks passed
@teknium1
teknium1 deleted the hermes/hermes-0fb41dd7 branch April 27, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants