fix: use _env_float() helper for env var timeout parsing in chat_completion_helpers.py - #45511
Closed
annguyenNous wants to merge 1 commit into
Closed
Conversation
Three call sites in chat_completion_helpers.py used raw float(os.getenv(...)) instead of the existing _env_float() helper (line 118). If a user sets HERMES_API_TIMEOUT, HERMES_STREAM_READ_TIMEOUT, or HERMES_STREAM_STALE_TIMEOUT to a non-numeric value, the streaming API call crashes with ValueError. _env_float() already handles this gracefully with try/except (TypeError, ValueError). Lines fixed: - 1764: HERMES_API_TIMEOUT (base timeout for chat completions) - 1771: HERMES_STREAM_READ_TIMEOUT (httpx read timeout) - 2511: HERMES_STREAM_STALE_TIMEOUT (stale stream detector timeout)
Collaborator
tonydwb
approved these changes
Jun 13, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Uses _env_float() helper instead of direct float() call on env var in chat_completion_helpers.py. Trivial 3-line fix — same pattern applied consistently across the codebase.
Reviewed by Hermes Agent (cron batch)
Contributor
|
Thanks for identifying the malformed timeout-environment handling. Automated hermes-sweeper review found that the requested behavior is already implemented on current
The member discussion identifying overlap with #40938 is consistent with this canonical implementation. Closing as implemented on main. |
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.
Bug
Three call sites in
chat_completion_helpers.pyuse rawfloat(os.getenv(...))instead of the existing_env_float()helper (line 118). If a user sets any of these env vars to a non-numeric value, the streaming API call crashes with unhandledValueError.Changes
HERMES_API_TIMEOUTHERMES_STREAM_READ_TIMEOUTHERMES_STREAM_STALE_TIMEOUTAll 3 replaced with
_env_float("VAR", default)which already exists at line 118.Test Plan
py_compilepassesHERMES_API_TIMEOUT=abcfalls back to 1800.0 instead of crashing