Skip to content

[router] set manual policy (sticky + min_load) as default agentic routing policy - #1690

Merged
Zhichenzzz merged 1 commit into
yueming/new-stack-consistent-hashingfrom
yueming/router-manual-policy
Jul 20, 2026
Merged

[router] set manual policy (sticky + min_load) as default agentic routing policy#1690
Zhichenzzz merged 1 commit into
yueming/new-stack-consistent-hashingfrom
yueming/router-manual-policy

Conversation

@yueming-yuan

@yueming-yuan yueming-yuan commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

before:
before
after:
after

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the routing logic in 'miles/rollout/sglang_rollout.py' to support the 'manual' router policy in addition to 'consistent_hashing' when using session IDs. The feedback suggests updating the outdated inline comments on lines 195 and 316 to accurately reflect this new behavior and avoid confusion.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread miles/rollout/sglang_rollout.py Outdated
# Use session_id for consistent hashing routing if router uses consistent_hashing policy
headers = None
if args.sglang_router_policy == "consistent_hashing" and sample.session_id:
if args.sglang_router_policy in ("consistent_hashing", "manual") and sample.session_id:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment on line 195 still specifically mentions the consistent_hashing policy. Since support for the manual policy has been added, please update the comment to reflect this change (e.g., by generalizing it to session-based routing).

Comment thread miles/rollout/sglang_rollout.py Outdated

# Generate a unique session_id for each sample in the group (consistent hashing only)
if args.sglang_router_policy == "consistent_hashing":
if args.sglang_router_policy in ("consistent_hashing", "manual"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment on line 316 still states (consistent hashing only). Since the manual policy is now also supported, please update this comment to prevent misleading future readers.

@yueming-yuan
yueming-yuan force-pushed the yueming/router-manual-policy branch from 8f45ecb to bb5e2b3 Compare July 15, 2026 23:21
@yueming-yuan yueming-yuan changed the title Support router 'manual' policy: fix load-accumulation instability of consistent_hashing under fully-async concurrency [router] support manual policy (sticky + min_load) and set as default agentic routing policy Jul 15, 2026
@yueming-yuan
yueming-yuan force-pushed the yueming/router-manual-policy branch from bb5e2b3 to ff40ec5 Compare July 16, 2026 23:36
yueming-yuan added a commit that referenced this pull request Jul 17, 2026
…ollout stack

- rename Sample.session_id to Sample.routing_key to disambiguate from the
  session server's and p2p transfer engine's session ids
- unify all routing-key sites behind policy_uses_routing_key, covering the
  manual policy (#1690) as well: both stacks' group assignment and eval,
  single_turn/multi_turn/legacy generate headers, prefill recompute
- drop the MILES_EXPERIMENTAL_ROLLOUT_REFACTOR=1 restriction on
  --sglang-router-policy

Keyless-request enforcement lives router-side
(radixark/sgl-router-for-miles#8), which covers every client including
proxy layers that bypass miles' http utils.
@yueming-yuan

Copy link
Copy Markdown
Collaborator Author

Heads up on two interactions with #1703 / radixark/sgl-router-for-miles#8:

  1. The and not enable_experimental_rollout_refactor() guard here exists to dodge the Add consistent hashing routing policy for rollout #891 assert (--sglang-router-policy blocked under MILES_EXPERIMENTAL_ROLLOUT_REFACTOR=1). rollout: consistent_hashing/manual routing for inference_rollout stack #1703 removes that assert and gives the inference_rollout stack full routing-key support, so after it lands this guard can be dropped — otherwise flag=0 and flag=1 session-server runs get silently different default policies.
  2. rollout: consistent_hashing/manual routing for inference_rollout stack #1703 unifies every key site behind policy_uses_routing_key(args) (consistent_hashing or manual) in generate_endpoint_utils — covering both stacks' group/eval assignment and prefill recompute, which this PR's two legacy-stack sites don't reach. After rebasing on rollout: consistent_hashing/manual routing for inference_rollout stack #1703, the in ("consistent_hashing", "manual") checks here collapse into that predicate (also note: session_id is renamed to routing_key). Router-side, sgl-router-for-miles#8 will reject keyless requests under manual by default, which this unification makes safe.

@yueming-yuan
yueming-yuan force-pushed the yueming/router-manual-policy branch from ff40ec5 to dd3dc25 Compare July 17, 2026 22:27
@yueming-yuan
yueming-yuan requested a review from jybsuper as a code owner July 17, 2026 22:27
@yueming-yuan
yueming-yuan changed the base branch from main to yueming/new-stack-consistent-hashing July 17, 2026 22:27
yueming-yuan added a commit that referenced this pull request Jul 17, 2026
…ollout stack

- rename Sample.session_id to Sample.routing_key to disambiguate from the
  session server's and p2p transfer engine's session ids
- unify all routing-key sites behind policy_uses_routing_key, covering the
  manual policy (#1690) as well: both stacks' group assignment and eval,
  single_turn/multi_turn/legacy generate headers, prefill recompute
- drop the MILES_EXPERIMENTAL_ROLLOUT_REFACTOR=1 restriction on
  --sglang-router-policy

Keyless-request enforcement lives router-side
(radixark/sgl-router-for-miles#8), which covers every client including
proxy layers that bypass miles' http utils.
@yueming-yuan
yueming-yuan force-pushed the yueming/new-stack-consistent-hashing branch from d1cf52b to 289ca4b Compare July 17, 2026 22:43
@yueming-yuan
yueming-yuan force-pushed the yueming/router-manual-policy branch from dd3dc25 to f85fcc6 Compare July 17, 2026 22:43
yueming-yuan added a commit that referenced this pull request Jul 17, 2026
…ollout stack

- rename Sample.session_id to Sample.routing_key to disambiguate from the
  session server's and p2p transfer engine's session ids
- unify all routing-key sites behind policy_uses_routing_key, covering the
  manual policy (#1690) as well: both stacks' group assignment and eval,
  single_turn/multi_turn/legacy generate headers, prefill recompute
- drop the MILES_EXPERIMENTAL_ROLLOUT_REFACTOR=1 restriction on
  --sglang-router-policy

Keyless-request enforcement lives router-side
(radixark/sgl-router-for-miles#8), which covers every client including
proxy layers that bypass miles' http utils.
@yueming-yuan
yueming-yuan force-pushed the yueming/new-stack-consistent-hashing branch from 289ca4b to dd2a6cc Compare July 17, 2026 22:44
@yueming-yuan
yueming-yuan force-pushed the yueming/router-manual-policy branch from f85fcc6 to 6a388e9 Compare July 17, 2026 22:44
@yueming-yuan yueming-yuan changed the title [router] support manual policy (sticky + min_load) and set as default agentic routing policy [router] set manual policy (sticky + min_load) as default agentic routing policy Jul 17, 2026

@guapisolo guapisolo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Zhichenzzz Zhichenzzz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Zhichenzzz
Zhichenzzz merged commit a171974 into yueming/new-stack-consistent-hashing Jul 20, 2026
34 checks passed
@Zhichenzzz
Zhichenzzz deleted the yueming/router-manual-policy branch July 20, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants