Repository navigation
feat(protocol): forward return_outputs_via_store on generate and chat - #23
Merged
Merged
Conversation
SGLang's Mooncake output store (sgl-project/sglang#42352) is opted into per request with return_outputs_via_store. The router re-serializes typed requests, so the flag was dropped: a Miles R3 training run with --sglang-output-store-backend mooncake silently got inline replay outputs through this router, while MilesRouter forwarded the flag. Add the field to GenerateRequest and ChatCompletionRequest as an optional bool that is serialized only when the client sets it, so requests without it are forwarded unchanged. Non-streaming responses already pass through as raw bytes, so meta_info.output_store_ref reaches the client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # src/protocols/chat.rs # tests/spec/chat_completion.rs
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.
Summary
Forward SGLang's
return_outputs_via_storeon/generateand/v1/chat/completions.Motivation
SGLang's Mooncake output store (sgl-project/sglang#42647) is opted into per request with
return_outputs_via_store. The router re-serializes typed requests, so the flag was dropped: a Miles R3 training run with--sglang-output-store-backend mooncakesilently got inline replay outputs through this router, while MilesRouter forwarded the flag.Usage
Design Notes
GenerateRequestorChatCompletionRequest, then serializes that struct to the worker, so only declared fields reach SGLang; non-streaming responses come back as raw bytes. Declaring the field therefore carries the flag to SGLang, whilemeta_info.output_store_refalready reaches the client.Option<bool>serialized only when set, likesampling_logprobs_modein fix(protocol): allow 128 chat top_logprobs and forward sampling_logprobs_mode #21: requests without the flag are forwarded unchanged, so SGLang builds without the output store never see it.return_indexer_topk(generate has it); not changed here.Verification
test, at the pre-merge head36c4d14:spec_test98 passed (1 ignored);routing_tests91 passed with the same single failure as at374ff28,test_manual_routing_without_header.check_router_forwarding.pywith the wheel plus the standalone binary: on/generateand chat the flag reaches the worker only when set;output_store_refcomes back unchanged.Review Focus
GenerateRequest/ChatCompletionRequest: the new field must stay out of the serialized request when unset.