Skip to content

docs: TokenSpeed gRPC workers can serve from Rust: --servicer-impl rust on the launcher, env var as fallback - #143

Merged
slin1237 merged 2 commits into
mainfrom
codex/nightly-docs-5da65f39bd32f937
Oct 11, 2026
Merged

slin1237 merged 2 commits into
mainfrom
codex/nightly-docs-5da65f39bd32f937

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

What this PR does

How do I run the TokenSpeed gRPC worker's servicer from Rust (--servicer-impl rust on python -m smg_grpc_servicer.tokenspeed, or SMG_TOKENSPEED_SERVICER_IMPL=rust as the fallback), what does it need, and what does that path refuse or answer UNIMPLEMENTED?

Why we need it

Source change: smg-project/smg@91505cd

Re-verified pending concern, slugs preserved; no PR was ever opened from its earlier plans (branch codex/nightly-docs-5da65f39bd32f937 appears in no existing PR). Primary commit 262 (#2747, 91505cd6, 2026-10-03, diff read tonight) added the switch and the Rust TokenSpeed servicer: grpc_servicer/smg_grpc_servicer/tokenspeed/rust.py, crates/engine_servicer/src/tokenspeed/, and the smg.servicer.TokenSpeedGrpcServer binding (bindings/python/src/servicer.rs, bindings/python/src/smg/servicer.py:22). Selection surface on current main: rust.py:52 SERVICER_IMPL_ENV='SMG_TOKENSPEED_SERVICER_IMPL'; commit 86 (#2999, 2026-10-09, diff read) added the launcher flag --servicer-impl {python,rust} (rust.py:65, add_servicer_impl_argument :72-89) on the unchanged entrypoint python -m smg_grpc_servicer.tokenspeed (the process ts serve spawns; every other flag is TokenSpeed's ServerArgs, main.py split_args). Precedence is flag, then environment, then python (servicer_impl_source rust.py:99-120); a flag decision is written back to the env so the headless scheduler child agrees (:118-119); the launcher logs 'Servicer implementation: (source=flag|env|default)'; --help lists the package's flag ahead of TokenSpeed's own; values outside {python,rust} fail startup. Rust-path semantics (rust.py module doc :1-20 and grpc_servicer/README.md:317-356, the authoritative contract, re-read on current main): the same process serves tokenspeed.grpc.scheduler.TokenSpeedScheduler from Rust (smg.servicer.TokenSpeedGrpcServer, needs the smg wheel) on the worker's host/port; the scheduler(s) run headless in a spawned child through TokenSpeed's own launch_scheduler_headless (what ts serve --headless runs) dialing a same-host msgpack ZMQ handshake; Python keeps only the lifecycle; the Router cannot tell the implementations apart. That ZMQ hop is inside the worker - the gateway still connects over grpc://, the same distinction grpc-workers.md:127 and :162 already draw for vLLM and SGLang; this is NOT the ZMQ direct backend of zmq-workers.md. What the msgpack wire does not carry is reported, not emulated (README:339-344): FlushCache and profiling answer UNIMPLEMENTED; ranked top_logprobs and prompt logprobs are refused; PD/EPD disaggregation stays with the Python implementation, as do the RL control-plane extras (the rl.* advertisement, the live weight_version on generate responses, is_paused); credentials are redacted from server_args the same way. SubscribeKvEvents relays TokenSpeed's ZMQ KV-event publisher, which Rust mode turns on by itself when the launcher is given no --kv-events-config (explicit config kept as given; SMG_TOKENSPEED_SERVICER_KV_EVENTS=0 keeps it off; rust.py:56-63, README:344-347) - state this at the README's level; the cross-engine Rust-mode KV default corrections on kv-events-cache-aware.md and grpc-workers.md:170 are a separate deferred concern (#2934/#2939/#2940). Tuning: SMG_TOKENSPEED_SERVICER_HANDSHAKE_PORT (default: a free port), SMG_TOKENSPEED_SERVICER_DRAIN_SECS (default 5), SMG_TOKENSPEED_SERVICER_STARTUP_TIMEOUT_SECS (default 1800) (rust.py:53-55, README:347-351). smg serve's --servicer-impl stays vLLM-only on current main (bindings/python/src/smg/serve.py:847-851 help text; :957-960 reject any backend but vllm+grpc), so getting-started/index.md:172 and grpc-workers.md:129 stay true and must not be changed. Missing documentation: a repo-wide grep for SMG_TOKENSPEED_SERVICER_IMPL and TokenSpeedGrpcServer in src/lib/content returns nothing; getting-started/grpc-workers.md's TokenSpeed tab (:84-94) shows only the Python start while the vLLM (:53) and SGLang (:67) tabs each point to a Rust-servicer section, and no Rust TokenSpeed section exists beside Rust vLLM (:107-146) and Rust SGLang (:148-170); getting-started/index.md's TokenSpeed worker recipe (around :346) lacks the one-line Rust-servicer note its vLLM (:300) and SGLang (:323) recipes carry. Writer caution: grpc-workers.md:160 currently reads 'Unlike vLLM, there is no flag: --servicer-impl stays scoped to the vLLM gRPC servicer' - stale since #2998/#2999; the edit must not leave that sentence contradicting the new TokenSpeed section, so adjust it only enough to stop asserting the flag is vLLM-only (the smg serve statement stays true), while fully documenting SGLang's own launcher flag (#2998, commit 81) remains a separately deferred concern on this file. Version framing: #2747 postdates the v1.11.0 bump (commit 300, #2670, 2026-09-24) and precedes the v1.12.0 bump (commit 159, #2888, 2026-10-08) - frame the switch in the exact 'newer than v1.11.0' style the existing Rust sections use (:109, :150); the launcher flag (#2999) and the KV-events default postdate the v1.12.0 bump; without tag evidence name no release. One independent concern: one commit added one implementation switch for one engine's gRPC worker, documented on the page that owns gRPC worker startup plus the index recipe one-liner - the concern merged PRs #115 and #126 both explicitly deferred. The same commit's 'pixels once as bytes' half is an internal serialization refactor with no doc claim to correct and is excluded. Dedup: no open or closed PR mentions SMG_TOKENSPEED_SERVICER_IMPL or #2747; merged #105/#115 covered the vLLM switch, merged #126 the SGLang switch; no open PR touches grpc-workers.md or getting-started/index.md (open PRs hold authentication/control-plane-auth/extensions, monitoring/metrics, rl-control-plane, cache-aware/logging/openai, both tokenizer-caching pages, service-discovery+configuration, development, concepts service-discovery, both pd-disaggregation pages, grpc-pipeline+messages), and my other selected item touches only multimodal.md. Edit well under 1,000 lines.

Scope: grpc-workers / tokenspeed-rust-servicer-switch. Other concerns are deferred.

How to test

  • Passed the documentation path and size guard (under 1000 added plus deleted lines; no file-count limit).
  • Passed an independent accuracy and single-concern review.
  • Passed git diff --check and pnpm check and the production pnpm build.

Checklist

  • Tests added/updated (if applicable)
  • Docs updated (if applicable)
  • Commit includes a DCO sign-off

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d17aa156-825c-4e4e-b3d3-ca11d26dfb8e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Documentation maintenance: ready. Unsuccessful content rounds: 0/3. Operational attempts: 0/3.

Head: 7df7fe67941f22ec1ef8eaa6ec3192f9b83acc1e; reviewed main: e17c545940df0ab77f19d09285b49aa9e4773d7c.
Reviewed SMG source: 2fae47becb202cd6d36e28a9e4359a2fd53901d4.

Every claim in the new Rust TokenSpeed Servicer section and the two one-liner cross-references was verified against the checkout at code_sha: selection precedence, env write-back, startup log line, and value validation (grpc_servicer/smg_grpc_servicer/tokenspeed/rust.py:78-126, __main__.py:38-77); smg serve rejecting --servicer-impl rust outside vllm+grpc and TokenSpeed being zmq-only under smg serve (bindings/python/src/smg/serve.py:957-962, :439-443); UNIMPLEMENTED/refusal semantics and no rl.* extras (crates/engine_servicer/src/tokenspeed/service.rs:85-131, info.rs:131); KV-events auto-default and opt-out (rust.py:241-271); and all tuning defaults including the ceiling (14400, 0 lifts it) and the alive-on-every-poll timeout semantics (rust_lifecycle.py:26-37, supervise/note_engine_alive; servicer.rs:1171). The source_patch confirms commit 91505cd introduced the env-var switch, Rust servicer, and contract, and lacked the flag, KV default, and ceiling, supporting the standalone no-version "Unreleased" note; the "newer than v1.11.0" framing matches the adjacent merged sections with bump-commit evidence. All edits serve the one concern: the only out-of-section change rewrites the sentence that would otherwise assert --servicer-impl is vLLM-only, exactly as the proposal required, and the replacement is verified true. No PR/commit/code references in prose; new behavior is in its own paragraphs on the canonical page; the PR is ~45 changed lines on the two allowlisted pages. Limitations: the untouched SGLang intro sentence ("One environment variable selects it") is stale against current main (SGLang's own launcher flag) and kv-events-cache-aware.md omits the Rust-mode KV auto-default — both explicitly deferred as separate concerns and not contradicted by this PR's text. No feedback threads exist in the context, so none are reported addressed.

Workflow evidence

Human review threads and CODEOWNER approval remain under repository policy.

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@slin1237
slin1237 merged commit 65b3d12 into main Oct 11, 2026
9 checks passed
@slin1237
slin1237 deleted the codex/nightly-docs-5da65f39bd32f937 branch October 11, 2026 07:40
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.

1 participant