Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request consolidates the session affinity header constants (HeaderSessionID and HeaderSessionKey) into a central pkg/types package, updating their references across the gateway plugins, routing algorithms, and tests to prevent duplicate definitions and potential routing mismatches. There are no review comments, and I have no additional feedback to provide.
Move HeaderSessionID and HeaderSessionKey into pkg/types so both the gateway plugin and the session-affinity routing algorithm share a single source of truth. Previously the strings were defined twice — once in pkg/plugins/gateway/types.go and again as local constants in pkg/plugins/gateway/algorithms/simple_session_affinity.go — with a manual NOTE comment warning that the two copies must stay in sync. If one side changed without updating the other, header parsing in the session-affinity router would silently disagree with the rest of the gateway, breaking sticky routing. Changes: - Add HeaderSessionID and HeaderSessionKey to pkg/types/router_context.go - gateway/types.go re-exports them via typed aliases (no value duplication) - simple_session_affinity.go and its test file now reference types.HeaderSessionID / types.HeaderSessionKey directly Fixes vllm-project#2597 Signed-off-by: RinZ27 <222222878+RinZ27@users.noreply.github.com>
cc17462 to
8c39a02
Compare
|
pkg/plugins/gateway/algorithms/simple_session_affinity.go:35 Minor Running |
Pull Request Description
The session affinity header names were defined in two separate places:
pkg/plugins/gateway/types.go:HeaderSessionIDandHeaderSessionKeypkg/plugins/gateway/algorithms/simple_session_affinity.go: localsessionIDHeader/sessionKeyHeader(copies of the same strings)There was already a
NOTEcomment warning that the two copies had to stay in sync manually. If one side ever changed without updating the other, the session-affinity router would silently parse the wrong header — breaking sticky or session-key routing.Moved the canonical values into
pkg/types(which the algorithm package already imports), so both places reference a single definition.gateway/types.gore-exports them as typed aliases for backward compatibility with existing callers.Related Issues
Resolves: #2597
Contribution Guidelines (Expand for Details)
We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:
Submission Checklist