fix: guard float() env var casts in Discord adapter __init__ - #45514
Closed
annguyenNous wants to merge 1 commit into
Closed
fix: guard float() env var casts in Discord adapter __init__#45514annguyenNous wants to merge 1 commit into
annguyenNous wants to merge 1 commit into
Conversation
Two env var casts in Discord adapter __init__ use raw float() without try/except. If HERMES_DISCORD_TEXT_BATCH_DELAY_SECONDS or HERMES_DISCORD_TEXT_BATCH_SPLIT_DELAY_SECONDS is set to a non-numeric value, the entire Discord adapter fails to initialize. Other platform adapters (google_chat) already guard these with try/except (ValueError, TypeError). This applies the same pattern.
Collaborator
tonydwb
approved these changes
Jun 13, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Same float() env var guard pattern applied to the Discord adapter OAuth refresh timeout. Trivial fix.
Reviewed by Hermes Agent (cron batch)
Contributor
|
Thanks for the focused defensive fix. This is already implemented on current
|
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
Two env var casts in
plugins/platforms/discord/adapter.py__init__use rawfloat(os.getenv(...))without try/except:HERMES_DISCORD_TEXT_BATCH_DELAY_SECONDS(line 631)HERMES_DISCORD_TEXT_BATCH_SPLIT_DELAY_SECONDS(line 632)If either env var is set to a non-numeric value, the entire Discord adapter fails to initialize — preventing Discord from working at all.
Other platform adapters (e.g.
google_chat) already guard these withtry/except (ValueError, TypeError).Fix
Wrap both casts in
try/except (ValueError, TypeError)with appropriate defaults (0.6 and 2.0).Test Plan
py_compilepassesHERMES_DISCORD_TEXT_BATCH_DELAY_SECONDS=abcfalls back to 0.6