fix(gateway): tolerate malformed HERMES_HUMAN_DELAY_* env vars (salvage #16933)#20217
Merged
Conversation
…mode Widens @Krionex's PR #16933 fix to cover the second bug class at the sibling site. natural mode used to pass env values through int() before the PR caught mis-typed values crashing the gateway; custom mode had the exact same bug one branch away (HERMES_HUMAN_DELAY_MIN_MS=oops in custom mode still crashed). Same try/except/fallback pattern, scoped to the two int() calls that feed random.uniform().
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.
Salvages @Krionex's PR #16933 onto current main and widens it to sibling site per never-merge-incomplete-fixes.
What it does
_get_human_delay()calledint(os.getenv(...))on HERMES_HUMAN_DELAY_MIN_MS / MAX_MS before dispatching on mode. A typo crashed the gateway regardless of mode.Changes
gateway/platforms/base.py— natural mode no longer reads the custom env vars at all (PR fix(gateway): ignore malformed custom delay env vars in natural mode #16933's fix); custom mode wraps its int() calls in try/except/fallback to match (widening).tests/gateway/test_platform_base.py— regression tests for both modes.scripts/release.py— AUTHOR_MAP entry for Krionex.Validation
tests/gateway/test_platform_base.py -k 'human_delay or HumanDelay'— 6 passed locally.Closes #16933 via salvage.