Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a560afa82d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| tops: dict = {} | ||
| for field, path in namespace_of(type(server_args)).items(): | ||
| value = getattr(server_args, field, _MISSING) | ||
| value = resolution_result(server_args, field, _MISSING) |
There was a problem hiding this comment.
Declare the automatically selected speculative parameters
When EAGLE, EAGLE3, or STANDALONE is launched without explicit speculative sizing arguments, _handle_eagle_family still stores _auto_choose_speculative_params(...) through the tuple assignment at speculative_hook.py:731, which never appends those writes to _resolved_overrides. This projection therefore publishes the raw None values for speculative_num_steps, speculative_eagle_topk, and speculative_num_draft_tokens; downstream bag consumers then fail or use invalid sizing—for example, tp_worker.py passes get_spec().speculative_num_steps directly to range. Record all three automatically selected values as declarations before publishing.
Useful? React with 👍 / 👎.
e2947a3 to
c506410
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c50641076d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| nothing left to derive and projects what the parent decided. | ||
| """ | ||
| if getattr(self, "_declarations_materialized", False): | ||
| return | ||
| self._run_resolution_pipeline() |
There was a problem hiding this comment.
Roll back state when resolution fails
If a late handler raises after non-idempotent declarations have already been applied, this record remains marked unresolved but retains those partially resolved field values. Retrying resolve_once() on the same instance therefore snapshots the partial output as fresh input and repeats transformations such as DP-attention chunk-size halving and schedule-conservativeness scaling, silently changing the eventual configuration. This can occur when an Engine startup fails in a validation after the parallelism handlers and the caller corrects the offending field and retries with the same ServerArgs; restore the pre-resolution state on failure or permanently mark the failed instance instead of allowing a second pass over partial output.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea6bd4831b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| raise e | ||
|
|
||
| server_args = ServerArgs.from_cli_args(args) | ||
| server_args.resolve_once() |
There was a problem hiding this comment.
Pass the resolved record instead of reconstructing it
When the offline benchmark uses a non-idempotent option such as DP attention, this resolves the configuration once, but throughput_test() later calls Engine(**dataclasses.asdict(server_args)), which constructs a fresh ServerArgs without the resolution metadata and runs the pipeline again in Engine._launch_subprocesses(). As a result, values such as chunked_prefill_size are divided by dp_size twice and schedule_conservativeness is scaled twice, so the benchmark runs a different configuration than requested; pass the existing record through Engine(server_args=server_args) or leave it unresolved before reconstructing it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cfc4421bf9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95d024368d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| try: | ||
| self._run_resolution_pipeline() |
There was a problem hiding this comment.
Invalidate caches populated before resolution
When a caller inspects max_speculative_num_draft_tokens on the newly raw ServerArgs before passing that same record to Engine, the cached_property stores None because auto speculative sizing has not run yet. This pipeline later resolves speculative_num_draft_tokens, but it never clears the cached derived value, so consumers such as pool_configurator.py continue seeing zero draft tokens and can undersize the C128 MTP ring/workspace. Clear pre-resolution caches before running the pipeline, or avoid caching values derived from unresolved fields.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe1caf2afc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def __post_init__(self): | ||
| self._run_resolution_pipeline() | ||
| """Construction leaves the record at what the caller asked for. | ||
|
|
||
| Resolution is a separate act, entered through ``resolve_once``: the | ||
| launcher runs it once per engine, and every publishing process asks the |
There was a problem hiding this comment.
Invalidate model-config caches created before resolution
When a caller inspects get_model_config() on the newly raw record before handing it to Engine, that method stores self.model_config, and resolve_once() later reuses it without rebuilding after early resolution changes. For example, with ModelScope enabled, _handle_modelscope_paths() can replace model_path with the downloaded local path while the cached ModelConfig still describes the original Hugging Face path; subsequent architecture- and backend-resolution decisions can therefore describe different model contents than the weights that are loaded. Clear a pre-resolution model_config when resolution begins, or avoid memoizing it until the record is resolved.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1373a77ffa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -170,6 +183,7 @@ def main(): | |||
|
|
|||
| args = parser.parse_args() | |||
| server_args = ServerArgs.from_cli_args(args) | |||
| server_args.resolve_once() | |||
There was a problem hiding this comment.
Guard the call to resolve_once for released SGLang versions
When this independently packaged sglang-router is used with a released SGLang version predating this commit, ServerArgs has no resolve_once() method, so every sglang-router launch-server invocation now terminates here with AttributeError before starting any workers. The compatibility logic in launch_server_process() explicitly accounts for the binding being installed against an older released wheel; apply the same feature detection here and rely on those versions' constructor-time resolution when the method is absent.
Useful? React with 👍 / 👎.
The launcher published last, after validating, allocating ports and deciding whether to start the engine-info bootstrap server -- all of which read the effective configuration. So those reads had to come off the record, which is the thing the record is supposed to stop carrying. Publish moves up to just below validation, which is the earliest it can go. Two steps above it write to the record and a published record is read-only: the auto-parser detection is resolution that needs a tokenizer and a chat template, so it cannot live in the pipeline, and validation normalizes LoRA adapter paths and target modules through late resolution. Everything that was below publish is unchanged in order; it is now downstream of it, and the bootstrap decision reads its switch from the model bag. Validation stays above publish for that reason, and the invariant it carried is unchanged: it still throws before any subprocess spawns. The launcher creates them in three helpers -- the weight-cache daemons, the schedulers, the detokenizer and router -- and calls all three below both. The startup-failure test hands the launcher a real record instead of a namespace: the launcher publishes what it is given, and bags only project from a dataclass. Co-Authored-By: Claude Opus 5 <[email protected]>
The data-parallel controller publishes as the first thing its process does and
then lays out its schedulers, so everything it reads afterwards -- the load
balance method, the watchdog timeout, the disaggregation role for its thread
label, and the rank arithmetic over the stage, attention-CP and MoE-DP sizes --
comes from the bags. The rank arithmetic follows the configured sizes: it is
deciding what to spawn, so the groups it sizes for do not exist yet.
The HTTP lifespan's gRPC-mode branch runs after the launcher published, and
reads the same way.
The controller's publish role declares the namespaces it reads. Converting these
reads takes it past `{"exec"}`: the watchdog timeout is a `device` leaf and the
thread label reads the `disagg` mode, and `parallel` was already outside the
declared set before this series. Under `SGLANG_ROLE_NAMESPACES=enforce` a
too-narrow set fails the request rather than a test, so the set is widened to
what the module actually reads.
Co-Authored-By: Claude Opus 5 <[email protected]>
`_compute_parallelism_ranks` already read the DP topology out of the context; the attention-CP and MoE-DP factors it divided by still came off the record. It runs while the launcher is deciding what to spawn, so those are the configured sizes -- the process groups it is laying out do not exist yet -- and they come from the `configured_*` accessors like the rest of that arithmetic. The sizes are lifted into locals rather than read four times each, which is why the expressions get shorter rather than longer. Co-Authored-By: Claude Opus 5 <[email protected]>
The bags are projected from what resolution decides, so anything the pipeline calls has to read the resolving state instead. A bag read reached from resolution raises `config namespace ... not published` — and only on the branch that reaches it, which is why two of them were written, merged and stayed green for everything except the configuration that triggers them: the diffusion-LM page-size pass needed one model family, the Marlin LoRA validation needed one MoE runner backend. `test_publish_precedes_bag_reads.py` is the same worry from the other side, but it walks the process entries, so it cannot see a helper the pipeline calls; neither of those two appeared in it. This walks the other direction: from what resolution can reach -- the symbols `server_args.py` and the override module import, every pass and provider in the live resolution registries, and the passes named at a by-value call site -- to whether any of them reaches a bag accessor. Both known cases are caught by it, verified by putting each back. The registries rather than the decorators, because that is where the coverage was: most model-override providers register through a helper call, so keying on `@register_model_override` found 39 entries where the registries hold 65, and a bag read in any of the other 26 was invisible. Verified the same way -- a read put into one of them is reported now and was not before. What it cannot see is stated in the module: a read reached through a method rather than a module-level function, one behind an import the walk does not follow, and one in a callable no call site names. It is a ratchet, not a proof. Co-Authored-By: Claude Opus 5 <[email protected]>
The stack members #35904-#35910 share head SHAs with this branch's commits; GitHub dedupes check suites by SHA, so without a distinct tip this carrier PR would show the members' runs instead of running CI over the whole stack at once. Co-Authored-By: Claude Opus 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94a4eca771
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| except BaseException: | ||
| restore_context(context_before_publish) | ||
| raise |
There was a problem hiding this comment.
Restore context after downstream startup failures
When scheduler startup, readiness waiting, detokenizer creation, or tokenizer-manager initialization fails, execution occurs after this try block, so the newly published record remains installed instead of restoring context_before_publish. Retrying the same ServerArgs can then fail before republishing—for example, LoRA validation calls declare_late_resolution again and rejects the still-published instance—despite the comments promising a retryable record. Extend the rollback to cover every failure through successful launcher return, while separately cleaning up any processes already spawned.
Useful? React with 👍 / 👎.
Motivation
Review/CI vehicle — not for merge. This PR carries the whole series at once so CI runs over the combined diff and the full change can be read in one place. The mergeable units are the stacked members below; land them bottom-up and close this one when the last member merges.
mainThe series moves
ServerArgsfrom "mutate the record at construction" toward "resolve once, publish the result into the config bags": resolution writes become declarations (#35905), the bags project from raw input plus declarations (#35906), construction stops resolving (#35907, the only behavioral change), borrowed-record reads follow the bags (#35908), and publish moves above the launcher's effective-configuration reads (#35910). #35904 fixes a pre-existing silent-override-drop independently; #35909 pins two orderings resolution relies on.The tip commit is an empty placeholder: the members share head SHAs with this branch's commits, and GitHub dedupes check suites by SHA — without a distinct tip this PR would show the members' runs instead of its own.
Modifications
Union of #35904–#35910; no changes beyond them (plus the empty tip commit).
Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): 🚫 Run #32627985045
Latest PR Test (Extra): 🚫 Run #32627984821
Latest PR Test (AMD ROCm 7.2): 🚫 Run #32627985084