Repository navigation
feat(grpc): expose follower metadata and node-local KV sources #39659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ishandhanani
merged 21 commits into
sgl-project:main
from
jain-ria:codex/sglang-local-kv-sidecars
Oct 6, 2026
Merged
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8b35d31
feat(sidecar): launch headless sidecars for local KV publishers
jain-ria 51907f8
fix(sidecar): remove provider readiness handshake
jain-ria ca0971e
fix(sidecar): tighten coverage and report logical KV block sizes
jain-ria 9969f50
test(sidecar): remove expanded controller test and trim setup
jain-ria c6c49ac
feat(grpc): scope follower discovery to node-local metadata
jain-ria c50b251
fix(kv-events): support explicit loopback publisher binds
jain-ria 8eaffcf
test(grpc): trim redundant metadata coverage
jain-ria e676e58
fix(kv-events): advertise absolute filesystem IPC endpoints
jain-ria 1d3c0d3
refactor: share server metadata across HTTP and native gRPC
jain-ria e1155ad
test: remove dedicated follower metadata test module
jain-ria 39859ba
Merge main into codex/sglang-local-kv-sidecars
jain-ria 13bbd63
docs: simplify shared server metadata docstring
jain-ria 9001399
test(grpc): avoid Python wrapper in metadata service test
jain-ria a07f3cd
Merge branch 'main' into codex/sglang-local-kv-sidecars
jain-ria 0b18034
Merge main and adapt follower metadata to shared protobuf bindings
jain-ria 4a8efff
Merge branch 'main' into codex/sglang-local-kv-sidecars
ishandhanani 6049848
fix(grpc): align Rust frontend streams with shared default stubs
jain-ria cbd9ea1
Merge main to satisfy CI minimum base requirement
jain-ria d9e2a4a
Merge branch 'main' into codex/sglang-local-kv-sidecars
ishandhanani 6c6e1cc
Merge branch 'main' into codex/sglang-local-kv-sidecars
jain-ria 047eb45
Merge branch 'main' into codex/sglang-local-kv-sidecars
jain-ria File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| """Server metadata shared by the full and follower-only native gRPC servers.""" | ||
|
jain-ria marked this conversation as resolved.
Resolved
|
||
|
|
||
| import json | ||
| from typing import Any, Dict | ||
|
|
||
| from sglang.srt.runtime_context import describe_kv_events_publisher, get_serving | ||
| from sglang.srt.utils.msgspec_utils import msgspec_to_builtins | ||
|
|
||
|
|
||
| def get_server_info_json(server_args, scheduler_info: Dict[str, Any]) -> str: | ||
|
jain-ria marked this conversation as resolved.
Resolved
|
||
| """Preserve the leader's server-info schema on both node roles. | ||
|
|
||
| ``kv_event_sources`` comes from scheduler readiness and lists only actual | ||
| node-local publishers (an empty list means none). Each entry carries the | ||
| global DP rank, local subscription endpoint, topic and logical block size. | ||
| The existing ``kv_events`` descriptor remains unchanged for older clients; | ||
| its global DP count must not be used to infer node-local ownership. | ||
| ``node_rank``, ``nnodes``, ``dp_size`` and ``dist_init_addr`` are already in | ||
| the resolved server args, including the shared engine rendezvous address. | ||
| """ | ||
| result = server_args.resolved_dict() | ||
| result["launch_command"] = server_args.launch_command | ||
| result.update(scheduler_info) | ||
| result["kv_events"] = describe_kv_events_publisher(server_args) | ||
| return json.dumps(msgspec_to_builtins(result), default=str) | ||
|
|
||
|
|
||
| def start_follower_grpc_server(server_args, scheduler_info: Dict[str, Any]): | ||
| """Expose GetServerInfo only, without constructing a TokenizerManager. | ||
|
|
||
| The snapshot is taken after scheduler readiness. This does not launch a | ||
| sidecar or enable inference/control RPCs. | ||
| """ | ||
| serving = get_serving() | ||
| if serving.grpc_port is None or serving.smg_grpc_mode or serving.grpc_mode: | ||
| return None | ||
|
|
||
| from sglang.srt.rust_extensions import load_rust_extension | ||
|
|
||
| grpc_native = load_rust_extension("sglang.srt.rust_extensions._grpc") | ||
| return grpc_native.start_metadata_server( | ||
| host=serving.host, | ||
| port=serving.grpc_port, | ||
| server_info_json=get_server_info_json(server_args, scheduler_info), | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.