Repository navigation
docs(routing): audit and fix PD disaggregation, routing policies, gRPC pipeline - #1154
Conversation
…C pipeline Systematic audit of PD disaggregation, routing policy, and gRPC pipeline documentation against model_gateway/src/policies, routers/http/pd_router, routers/grpc/common/stages, worker/hash_ring, config/types RoutingPolicy, and the --policy / --pd-disaggregation / --prefill / --decode CLI flags. Writer phase performed inventory, verify, discover, and fix; Tech Lead phase independently re-verified every change against cited source code before shipping. - Verified ~90 claims across 6 doc files; 6 fixes applied across 4 files. - cache-aware threshold: doc said "match ratio >= cache-threshold" and "most cache capacity" fallback; code at model_gateway/src/policies/cache_aware.rs:802,863 uses strict `>` and falls back to least-loaded healthy worker via `min_by_key(|&&idx| workers[idx].load())` at lines 811, 872. Corrected in docs/concepts/routing/cache-aware.md and docs/getting-started/load-balancing.md. - grpc-pipeline monitoring metrics table listed four metrics that are not registered anywhere (`smg_pipeline_stage_duration_seconds`, `smg_reasoning_extractions_total`, `smg_tool_calls_total`, `smg_tool_execution_duration_seconds`). The real pipeline-stage metric is `smg_router_stage_duration_seconds` (model_gateway/src/observability/metrics.rs:190, 622). Replaced the phantom rows with the real metric; kept `smg_mcp_tool_calls_total` which is registered at metrics.rs:306, 1100. - grpc-pipeline Reasoning/Tool Call parser "Configuration" tables claimed `SMG_REASONING_PARSER` / `SMG_TOOL_CALL_PARSER` environment variables. The `--reasoning-parser` and `--tool-call-parser` args in model_gateway/src/main.rs:455-461 carry no `env = ...` clap attribute and no other code path reads those env vars. Removed the "Environment" rows. - pd-disaggregation service-discovery examples used `--prefill-selector "app=sglang,role=prefill"`. The `parse_selector` function in model_gateway/src/main.rs:793-803 splits each selector value on its first `=` only, and the flag declares `num_args = 0..` (main.rs:262). With the comma-joined form, the second label is silently dropped. Rewrote both occurrences in docs/concepts/routing/pd-disaggregation.md to use the space-separated form (matching the already-correct usage in docs/concepts/architecture/high-availability.md:455). No source code was modified. The per-team audit worksheet is kept as worktree-local scratch and is not committed to avoid polluting the rendered mkdocs site. Refs: .claude/plans/2026-04-15-docs-audit-workflow.md (Team 3) Signed-off-by: Simo Lin <linsimo.mark@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughFour documentation files updated: gRPC pipeline configuration and monitoring metrics documentation revised; cache-aware routing threshold logic and fallback behavior clarified; Kubernetes label selector CLI examples reformatted from comma-separated to space-separated; and cache-aware policy parameter description updated to reflect new least-loaded fallback behavior. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the documentation to reflect changes in environment variables, metrics, and routing logic. Key changes include the removal of deprecated environment variables and metrics in the gRPC pipeline documentation, and an update to the cache-aware routing logic which now routes to the least-loaded healthy worker when the match ratio is at or below the threshold. Additionally, the CLI syntax for prefill and decode selectors has been updated to remove quotes and commas. I have no feedback to provide.
Description
Problem
Documentation for PD disaggregation, routing policies, and the gRPC
pipeline had drifted from the current
model_gatewaycodebase. Thecache-aware routing description used the wrong threshold operator and
the wrong fallback branch; the gRPC pipeline "monitoring metrics" table
listed four metrics that are not registered anywhere in the binary;
the reasoning/tool-call parser docs referenced
SMG_*environmentvariables that clap does not actually read; and the service-discovery
examples for PD mode used a
--prefill-selector "k1=v1,k2=v2"formthat is silently wrong because
parse_selectorsplits on the first=only.Solution
Systematic audit of 6 documentation files in this area against the
source code, verifying every CLI flag, default, metric name, env var,
and routing-behavior claim. 6 fixes applied across 4 files. Every
change cites a
file.rs:LINEreference in the commit body. A TechLead pass independently re-verified each change against cited source
code before this PR was opened.
Changes
manual, consistent_hashing, bucket, power_of_two, round_robin,
random policies; PD disaggregation flags; reasoning + tool-call
parser tables; pipeline metrics).
docs/concepts/routing/cache-aware.md(1 edit): match-rate thresholduses strict
>and fallback is least-loaded healthy worker(
model_gateway/src/policies/cache_aware.rs:802, 811, 863, 872).docs/getting-started/load-balancing.md(1 edit): same correctionin the
--cache-thresholdtable description.docs/concepts/architecture/grpc-pipeline.md(3 edits):(
smg_pipeline_stage_duration_seconds,smg_reasoning_extractions_total,smg_tool_calls_total,smg_tool_execution_duration_seconds) with the realsmg_router_stage_duration_seconds(
observability/metrics.rs:190, 622). Kept the verifiedsmg_mcp_tool_calls_totalrow.Environmentrows forSMG_REASONING_PARSERandSMG_TOOL_CALL_PARSERfrom the reasoning/tool-call parserconfiguration tables. The
--reasoning-parser/--tool-call-parserclap args (main.rs:455-461) carry noenv = ...attribute, and a repo-wide grep confirmed no codepath reads those env vars.
docs/concepts/routing/pd-disaggregation.md(2 edits): rewroteboth occurrences of
--prefill-selector "app=sglang,role=prefill"to the space-separated form
--prefill-selector app=sglang role=prefill.The
parse_selectorfunction (main.rs:793-803) splits eachselector value on its first
=only, and the flag declaresnum_args = 0..(main.rs:262, 266), so the comma-joined formsilently drops the second label. The corrected form matches the
already-correct usage in
docs/concepts/architecture/high-availability.md:455.docs/getting-started/pd-disaggregation.md,docs/concepts/routing/load-balancing.md) needed no edits afterfull verification. Their claims about policy enums, PD CLI flags,
headers, assignment modes, virtual nodes, and the
HashRingsignature (
worker/hash_ring.rs:44-48) all match the current code.Test Plan
file.rs:LINE) in thecommit body and in the Tech Lead review notes.
mkdocs build --strict --clean --quietexits 0 at HEAD on thisbranch (pre-existing unrelated anchor warnings in
getting-started/tokenization-and-parsing.mdremain, untouched bythis PR).
cited source code in
model_gateway/src/policies/cache_aware.rs,model_gateway/src/observability/metrics.rs,model_gateway/src/main.rs(parse_selector, parser args), andrepo-wide grep for the removed metric names and env vars.
Checklist
Summary by CodeRabbit
Documentation