Repository navigation
[serve] Fix type regression in RAY_SERVE_HAPROXY_CLOSE_SPREAD_TIME_S - #64752
Merged
abrarsheikh merged 1 commit intoJul 14, 2026
Merged
abrarsheikh merged 1 commit into
abrarsheikh merged 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the retrieval of the RAY_SERVE_HAPROXY_CLOSE_SPREAD_TIME_S environment variable to avoid calling os.environ.get twice. The reviewer suggested using the existing get_env_int utility function instead of introducing a temporary module-level variable, which would make the code cleaner and more consistent.
johntaylor-cell
force-pushed
the
serve-haproxy-close-spread-typefix
branch
from
July 14, 2026 20:48
29c75d7 to
c24342f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit c24342f. Configure here.
johntaylor-cell
force-pushed
the
serve-haproxy-close-spread-typefix
branch
from
July 14, 2026 20:51
c24342f to
94ecf97
Compare
ray-project#63996 added int(os.environ.get("RAY_SERVE_HAPROXY_CLOSE_SPREAD_TIME_S")) guarded by a separate os.environ.get() truthiness check. The two independent lookups mean neither mypy nor pyrefly can narrow the value to non-None, so int(str | None) fails both checkers -- which currently turns the serve type-check lint shard red for every Serve PR (the mypy/pyrefly serve hooks run --all-files). Use the existing get_env_int helper, matching how the other int env vars in this file are read. A non-parsable or empty value now fails at import, which is the intended behavior. Restores the serve type-check allowlist to green. Related to ray-project#64643. Signed-off-by: john.taylor <[email protected]>
johntaylor-cell
force-pushed
the
serve-haproxy-close-spread-typefix
branch
from
July 14, 2026 21:16
94ecf97 to
0990eec
Compare
eicherseiji
added a commit
to eicherseiji/ray
that referenced
this pull request
Jul 14, 2026
…ect#64752 The int(os.environ.get(...)) narrowing for RAY_SERVE_HAPROXY_CLOSE_SPREAD_TIME_S is handled in ray-project#64752, so leave it out of this PR to avoid a duplicate fix and a re-merge conflict. The AutoscalingContext / autoscaling_state type fixes from the previous commit stay. mypy will flag constants.py until ray-project#64752 lands on master and this branch re-merges. Signed-off-by: Seiji Eicher <[email protected]>
eicherseiji
added a commit
to eicherseiji/ray
that referenced
this pull request
Jul 14, 2026
Restores the mypy narrowing so this PR's lint is green. This overlaps with the upstream fix in ray-project#64752; since this PR lands after it, the duplicate reconciles in the master re-merge. Signed-off-by: Seiji Eicher <[email protected]>
abrarsheikh
approved these changes
Jul 14, 2026
abrarsheikh
enabled auto-merge (squash)
July 14, 2026 21:52
400Ping
pushed a commit
to 400Ping/ray
that referenced
this pull request
Aug 18, 2026
…ay-project#64752) ray-project#63996 added int(os.environ.get("RAY_SERVE_HAPROXY_CLOSE_SPREAD_TIME_S")) guarded by a separate os.environ.get() truthiness check. The two independent lookups mean neither mypy nor pyrefly can narrow the value to non-None, so int(str | None) fails both checkers -- which currently turns the serve type-check lint shard red for every Serve PR (the mypy/pyrefly serve hooks run --all-files). Read the env var once into a local so the truthiness guard narrows it; runtime behavior is identical (single lookup, same empty-string -> None handling). Restores the serve allowlist to green. Related to ray-project#64643 Signed-off-by: john.taylor <[email protected]> Signed-off-by: 400Ping <[email protected]>
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.

#63996 added int(os.environ.get("RAY_SERVE_HAPROXY_CLOSE_SPREAD_TIME_S")) guarded by a separate os.environ.get() truthiness check. The two independent lookups mean neither mypy nor pyrefly can narrow the value to non-None, so int(str | None) fails both checkers -- which currently turns the serve type-check lint shard red for every Serve PR (the mypy/pyrefly serve hooks run --all-files).
Read the env var once into a local so the truthiness guard narrows it; runtime behavior is identical (single lookup, same empty-string -> None handling). Restores the serve allowlist to green.
Related to #64643