Repository navigation
config: pin two orderings resolution relies on - #35909
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5e39c5fe1
ℹ️ 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".
| if not ( | ||
| isinstance(base, ast.Attribute) | ||
| and base.attr == "server_args" | ||
| and not (isinstance(base.value, ast.Name) and base.value.id == "self") | ||
| ): |
There was a problem hiding this comment.
Handle borrowed records parked on
self
When a class parks a borrowed record as self.server_args (for example, GrammarManager assigns self.server_args = scheduler.server_args), this condition excludes every later self.server_args.<field> read. The companion supplied-instance census does not cover that case because it only marks attributes assigned directly from a parameter named server_args; therefore, adding a resolution-written read to such a class would pass both ratchets even though it is precisely a borrowed-record chain read. Only exclude self.server_args after confirming that the companion census recognizes its assignment source.
Useful? React with 👍 / 👎.
4ec6b36 to
f39d2af
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8791e5bee6
ℹ️ 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".
| It forwards `**fields` to `declare_late_resolution`, so the keywords sit at | ||
| its call sites and a scan for the declarer's own name finds none of them. | ||
| """ | ||
| tree = ast.parse((_SRT / "server_args.py").read_text(encoding="utf-8-sig")) |
There was a problem hiding this comment.
Track dynamic late-resolution fields
This scans only server_args.py, but parser/template_detection.py calls declare_late_resolution(..., **detected) for the known reasoning_parser and tool_call_parser fields (the companion supplied-instance test explicitly records that set). _declared_by_keyword() cannot recover keys from this expansion, so neither field enters _resolution_written(); a borrowed read such as manager.server_args.reasoning_parser would therefore pass this ratchet even though it reads a late-resolved value.
Useful? React with 👍 / 👎.
| stale = sorted( | ||
| field | ||
| for field in _READ_BEFORE_RESOLUTION | ||
| if field not in wanted or field not in declared | ||
| ) |
There was a problem hiding this comment.
Verify the exception remains after the first build
This companion check only verifies that is_embedding is both read and declared somewhere, not that its declaration still occurs after the first ModelConfig build. If that declaration is moved before the build, the check remains green while _READ_BEFORE_RESOLUTION continues excluding the field unconditionally from the main ordering assertion, allowing a later timing regression for this field to bypass the ratchet; compare its declaration position with the first build just as the stale-field pin does.
Useful? React with 👍 / 👎.
902f0f8 to
d9d3103
Compare
8791e5b to
e4398b9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4398b9c34
ℹ️ 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".
| declared_at[keyword.arg] = max( | ||
| declared_at.get(keyword.arg, index), index | ||
| ) |
There was a problem hiding this comment.
Track declaration order within each pipeline handler
If a newly constructor-read field is declared earlier in the same handler that performs the first get_model_config() call—for example, _declare(model_path=...) immediately before that call—both events receive the same pipeline index here. The later >= check therefore reports the field as late even though declare_resolution applies it immediately and the build observes it, blocking valid ordering fixes; retain statement-level ordering within each reached handler rather than collapsing all its calls to index.
Useful? React with 👍 / 👎.
e4398b9 to
3c56ce7
Compare
d9d3103 to
8ab79d3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c56ce790d
ℹ️ 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 _resolution_written(): | ||
| """Every field resolution can write, by any of its four mechanisms.""" | ||
| return ( | ||
| _declared_by_keyword() | ||
| | _declared_by_registry_and_passes() | ||
| | _declared_by_late_resolution() | ||
| ) |
There was a problem hiding this comment.
Include post-publish overrides in the chain-read set
When a field is written only after publication through get_context().override(...)—for example cuda_graph_bs_decode, max_mamba_cache_size, or pp_max_micro_batch_size—it never enters this union, although test_supplied_instance_exposure_ratchet.py::_override_written_fields already enumerates this write channel. A new runner.server_args.cuda_graph_bs_decode read therefore passes this ratchet because the field is absent from written, and passes the companion census because that census ignores arbitrary chains; once the record remains raw, the read observes the startup value rather than the runtime override. Union the post-publish override targets into this written set as well.
Useful? React with 👍 / 👎.
3c56ce7 to
b21e489
Compare
8ab79d3 to
0170ec4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b21e489761
ℹ️ 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".
|
|
||
| register_cpu_ci(est_time=5, suite="base-a-test-cpu") | ||
|
|
||
| _SRT = pathlib.Path(sglang.__file__).resolve().parent / "srt" |
There was a problem hiding this comment.
Expand the chain-read census beyond the srt subtree
When the raw-record change this ratchet is intended to guard lands, borrowed reads in shipped modules outside sglang/srt remain unchecked because both the written-field derivation and _chain_reads start at _SRT. For example, python/sglang/benchmark/one_batch.py currently reads model_runner.server_args.page_size, disable_cuda_graph, and disable_overlap_schedule at lines 490 and 545-552; these are resolution-written fields and can therefore expose startup defaults in the benchmark without failing this test. Scan the full sglang package, excluding only explicitly justified owner subtrees.
Useful? React with 👍 / 👎.
| if ( | ||
| isinstance(inner, ast.Call) | ||
| and isinstance(inner.func, ast.Name) | ||
| and inner.func.id == "declare_resolution" | ||
| ): |
There was a problem hiding this comment.
Pin opaque direct writes reached through imported hooks
When a custom speculative algorithm callback rewrites a constructor input such as dtype or model_path, this scan sees no declaration because it only collects literal declare_resolution calls from the imported module. Fresh evidence beyond the platform hook is that arg_groups/speculative_hook.py already invokes declare_direct_writes with algo.validate_server_args and algo.handle_server_args after the first model-config build (lines 155-159 and 175-179), while the new platform-specific position check covers only the callback passed directly by the dispatcher. Pin every opaque callback's position or constrain/model its possible writes so such a stale cached configuration cannot leave the ratchet green.
Useful? React with 👍 / 👎.
b21e489 to
f17bd05
Compare
0170ec4 to
ed1bccc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f17bd05d73
ℹ️ 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".
| imported[alias.asname or alias.name] = node.module | ||
|
|
||
| out = {} | ||
| for node in ast.walk(dispatch): |
There was a problem hiding this comment.
Follow hooks called from pipeline handlers
When a ModelConfig input is declared by an imported hook called inside a self handler after the first build, this scan never records it because it only searches bare imported calls in dispatch. For example, _handle_model_specific_adjustments builds the config and then calls the Kimi and DeepSeek hooks, which declare fields such as enable_symm_mem and enable_dp_attention; adding one of those fields to ModelConfig.from_server_args would therefore leave the ordering test green despite the cached config reading its pre-resolution value. Traverse imported hooks reached from handler bodies as well, preserving their position within the handler.
Useful? React with 👍 / 👎.
| if not ( | ||
| isinstance(target, ast.Attribute) | ||
| and target.attr == "server_args" | ||
| and isinstance(target.value, ast.Name) | ||
| and target.value.id == "self" | ||
| ): |
There was a problem hiding this comment.
Track borrowed records parked under arbitrary attributes
When a class parks a borrowed record under another attribute, such as self.args = scheduler.server_args, and later reads self.args.dtype, neither census sees it: this helper only recognizes a target literally named self.server_args, while the supplied-instance census only recognizes parking directly from a server_args parameter. That spelling has the same stale-default behavior this ratchet is intended to prevent, so record the assigned target attribute and match reads through any borrowed parked alias.
Useful? React with 👍 / 👎.
f17bd05 to
7547c7a
Compare
ed1bccc to
cf351f7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7547c7aeeb
ℹ️ 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".
| if not isinstance(node, ast.Assign): | ||
| continue |
There was a problem hiding this comment.
Include annotated borrowed-record assignments
When a class parks the record with the common typed spelling self.args: ServerArgs = scheduler.server_args, this loop ignores the ast.AnnAssign, so parked_alias never recognizes subsequent self.args.<resolved_field> reads. The companion census also only handles ast.Assign, leaving this borrowed-record path outside both ratchets; handle annotated assignments alongside ordinary assignments.
Useful? React with 👍 / 👎.
| names = {alias.asname or alias.name for alias in node.names} | ||
| if names & {"ServerArgs", "server_args", "prepare_server_args"}: |
There was a problem hiding this comment.
Recognize aliased imports of the startup record
Inside a subtree that defines another ServerArgs, importing the startup record with an alias causes this predicate to return false because it records alias.asname and then compares it only with the original spellings. The current multimodal_gen/runtime/managers/gpu_worker.py already uses ServerArgs as SrtServerArgs, so any borrowed startup-record chain read added to that mixed-record module would be skipped wholesale by _chain_reads; inspect alias.name as well as the local alias.
Useful? React with 👍 / 👎.
| for node in ast.walk(function): | ||
| if isinstance(node, ast.Dict): | ||
| for key in node.keys: | ||
| if isinstance(key, ast.Constant) and isinstance(key.value, str): | ||
| names.add(key.value) |
There was a problem hiding this comment.
Restrict provider keys to the returned override mapping
When a registered provider returns a dict-valued field, this unrestricted walk also adds every literal key from the field's nested value as though it were a ServerArgs field. It likewise collects unrelated local mapping literals in the provider body, so _resolution_written() can acquire arbitrary names and reject valid borrowed reads of fields resolution never writes; track the mapping used as the provider's declaration result rather than every ast.Dict descendant.
Useful? React with 👍 / 👎.
cf351f7 to
339d28f
Compare
7547c7a to
6b9de1d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b9de1d0b4
ℹ️ 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".
| self.assertGreater( | ||
| len(registry), 20, "the registry-declared set collapsed; nothing to compare" | ||
| ) | ||
| late = frozenset(reads & registry) if collect_line > build_line else frozenset() |
There was a problem hiding this comment.
Compare registry collection with the actual first build
When registry collection is moved above the local get_model_config() call in _handle_model_specific_adjustments, this classifies every registry field as early, even though _handle_gpu_memory_settings already calls get_model_config() earlier in the pipeline when the default mem_fraction_static is None (server_args.py:5328, dispatched at line 3857). Retiring the stale-set pin after that apparent ordering fix would therefore leave the tests green while the registry still runs after a commonly cached configuration; compare collection against the first pipeline-wide build returned by _declaration_positions() instead of only the build in the collection handler.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f334c11d9
ℹ️ 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".
| for arg in node.args: | ||
| if not isinstance(arg, ast.Dict): | ||
| raise AssertionError( | ||
| f"opaque overrides.update() argument in {function.name}" | ||
| ) |
There was a problem hiding this comment.
Collect keys from positional update dictionaries
When a registered provider builds its returned mapping with overrides.update({"field": value}), this branch accepts the literal dictionary but never passes it to top_level_keys, despite the comment claiming those keys are collected. The field is therefore absent from _resolution_written(), so a borrowed read of that resolution-written field can be introduced without failing the chain-read ratchet; collect the keys from each accepted positional dictionary.
Useful? React with 👍 / 👎.
| for node in ast.walk(ast.parse(path.read_text(encoding="utf-8-sig"))): | ||
| if ( | ||
| isinstance(node, ast.Call) | ||
| and isinstance(node.func, ast.Name) | ||
| and node.func.id == "declare_resolution" | ||
| ): | ||
| fields |= {kw.arg for kw in node.keywords if kw.arg} |
There was a problem hiding this comment.
Restrict hook declarations to the called function
When an imported module exposes multiple resolver hooks, _hook_declared_fields(name) ignores the requested callable and attributes every declare_resolution in the module to every call from that module. The current kimi_k3_hook.py already has an early disable_kimi_k3_symm_mem hook and later apply_kimi_k3_* hooks, so if ModelConfig.from_server_args begins reading enable_symm_mem, the later calls are falsely treated as redeclarations and the max at the caller marks an actually early value as late, blocking a valid change. Limit the traversal to the named function and helpers it reaches.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 909e4834c0
ℹ️ 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".
| if isinstance(node, ast.Attribute) | ||
| and isinstance(node.value, ast.Name) | ||
| and node.value.id in names | ||
| and isinstance(node.ctx, ast.Load) |
There was a problem hiding this comment.
Follow aliases of the constructor input
When from_server_args assigns the record to a local alias (for example, args = server_args) and then reads args.dtype, this direct-Name matcher omits the read. That field consequently never enters wanted or the registry intersection, so a resolution declaration after the first ModelConfig build can remain undetected; propagate simple aliases of server_args through the constructor census.
Useful? React with 👍 / 👎.
| if ( | ||
| not in_srt | ||
| and rel.split("/")[0] in other_records | ||
| and not _reads_the_startup_record(tree) | ||
| ): | ||
| continue |
There was a problem hiding this comment.
Scope alternate ServerArgs exclusions to defining modules
When any module in a top-level subtree defines another class named ServerArgs, this condition skips every other module in that subtree unless it directly imports one of three SRT symbols. A borrowed startup record can arrive transitively without such an import, so adding an unrelated ServerArgs under a subtree such as benchmark would silently remove existing borrowed-record reads in sibling modules from the ratchet; distinguish records per module or trace the relevant value instead of excluding the entire top-level root.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bca1b4e42
ℹ️ 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".
| reads = { | ||
| node.attr | ||
| for node in ast.walk(constructor) | ||
| if isinstance(node, ast.Attribute) | ||
| and isinstance(node.value, ast.Name) | ||
| and node.value.id in names | ||
| and isinstance(node.ctx, ast.Load) |
There was a problem hiding this comment.
Follow constructor reads delegated to helpers
When from_server_args passes server_args to a helper that reads a field—for example, after extracting construction of a kwargs dictionary—this census sees only the call and never traverses the helper body. A newly delegated read of a late-resolved field would therefore be absent from wanted, allowing every ordering assertion in this file to remain green even though the cached ModelConfig observes the pre-resolution value; follow local helpers that receive the record or explicitly reject that shape.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7520fdf950
ℹ️ 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".
| if through_self and not parked_alias(node.lineno, base.attr): | ||
| continue |
There was a problem hiding this comment.
Scan self-held startup records outside srt
When an SRT ServerArgs is stored directly as self.server_args outside the srt subtree, this branch skips all of its reads even though the companion supplied-instance census scans only python/sglang/srt. The existing lang/backend/runtime_endpoint.py flow already constructs the startup record at line 395 and later reads the resolution-written self.server_args.tokenizer_path at line 462, so both ratchets remain green while that read would observe raw input after the planned record change; only exclude self.server_args when the companion census actually covers the module/assignment.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e17c2320a
ℹ️ 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".
| and getattr(node.func, "id", None) == "declare_direct_writes" | ||
| ), | ||
| ) | ||
| for node in ast.walk(dispatch): |
There was a problem hiding this comment.
Traverse self handlers for opaque callbacks
When declare_direct_writes is placed inside a named self._handle_* method, this scan never discovers it: it searches the dispatcher itself and modules behind bare imported calls, but does not traverse the self-handler graph returned by _pipeline(). This is especially likely because _run_resolution_pipeline explicitly requires integrations to be hidden behind named self handlers (server_args.py:3751-3765); moving the existing platform wrapper into such a handler, or adding a new opaque resolver there, would leave positions unchanged and let the ordering ratchet pass without checking whether that resolver runs before or after the first ModelConfig build. Fresh evidence in the updated code is that the newly added callback census still iterates only over ast.walk(dispatch) at this point.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2352da9063
ℹ️ 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".
| collection_is_late = min(collecting_steps) > first_build[0] or ( | ||
| build_line is not None and collect_line > build_line | ||
| ) | ||
| late = frozenset(reads & registry) if collection_is_late else frozenset() |
There was a problem hiding this comment.
Track post-process passes at their invocation sites
registry includes every POST_PROCESS_PASSES return field, but this line classifies that entire union solely from the position of collect_model_override_declarations(). If registry collection is moved before the first build and the stale pin is retired as the test requests, quantization will be considered early even though _gguf_quantization is still invoked much later in _handle_load_format (server_args.py:8072); the main declaration scan cannot see that pass's dict-returned write, so a cached ModelConfig can remain stale while both checks pass. Determine post-process fields from each run_post_process_pass invocation position separately from provider collection.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e3f8b7cfc
ℹ️ 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".
| same_body = index == build_index and method == build_method | ||
| rank = 0 if same_body and node.lineno < build_line_in_body else 1 |
There was a problem hiding this comment.
Preserve helper call order before the first build
When a pipeline handler calls a self helper that declares a constructor-read field before the handler's get_model_config() call, this new same_body condition still assigns the helper's declaration rank 1 because its method name differs from build_method. The test consequently reports the field as late and blocks a valid ordering fix or helper extraction; preserve call-site ordering through reached self helpers rather than treating every declaration outside the build method as post-build.
Useful? React with 👍 / 👎.
Resolution builds a `ModelConfig` partway through and keys later decisions off it, so the pipeline reads its own output through that object. That loop is benign exactly while every field the constructor reads has been decided before the build -- and today it is, because the path and quantization handlers run early in the pipeline and nothing builds a model configuration until several steps after them. (The pin derives the positions; absolute step numbers are not quoted here because a handler inserted upstream shifts them all.) Nothing said so. The ordering held by luck, and a handler moved a few steps later would have produced a model configuration describing a half-resolved input, silently, for every decision downstream of it. So both sides are derived from the source: the fields `ModelConfig.from_server_args` reads, and the step each is last declared at. Last, not first -- a second declaration after the build is precisely the staleness at issue, and a first-declaration check would have missed it. One field is pinned as the exception with its reason. `is_embedding` is read for what the caller asked for -- passed as `is_embedding_requested`, never stored -- and resolution later overwrites the field with what the architecture implies. Two quantities sharing a name; the constructor wanting the earlier one is the design, not an ordering bug. Two spellings the census had to learn. `getattr(server_args, "field", default)` is a `Call`, not an `Attribute`, and is the normal shape for an optional input, so a field read that way was invisible. And late resolution is a channel of its own: it writes at the launcher's validation stage, after every build, but its fields never entered the per-step map, so the check could not even consider them. Verified by making the constructor read a late-resolved field through `getattr`: it is reported now. Co-Authored-By: Claude Opus 5 <[email protected]>
The supplied-instance census counts three spellings, all starting from a `server_args` parameter -- the caller chose the object, which is the contract that makes those reads defensible. The fourth spelling has no contract: `model_runner.server_args.field` lifts the record off whatever object happened to be holding it, and no census saw it, which is how it reached 105 reads across 36 files. They are converted. This is what keeps them converted, and it is derived rather than listed: the fields resolution writes come from the declaration sites, so a field that stops being resolution-written drops out on its own -- and one that stops being *declared* cannot leave that way, because bare assignment during resolution is already refused. Raw fields are deliberately not pinned. Reading `server_args.host` off a borrowed record answers with what the caller asked for, which is what the record is for. The ModelConfig pin also derives from the registries now. It read `self._declare(...)` keywords only, so it could not see that the model-specific handler builds the configuration and *then* collects the model-override declarations: four fields it reads -- `dtype`, `quantization`, `enable_multi_layer_eagle`, `disable_hybrid_swa_memory` -- are decided by providers after the object that read them was built. Both positions come from inside that one handler body, the only scope where comparing them means anything. Those four are named rather than fixed, and the assertion is equality: a fifth field arriving in that position fails, and so does moving the build or the collection. The registry-declared set comes from the chain ratchet's derivation by path rather than a second copy of it, because the copy that drifts narrower is the one that makes this pass quietly. The chain census counts the `getattr` spelling too. `getattr(runner.server_args, "field", default)` reaches the same borrowed record with the same stale default, but the outer node is a `Call`, so an `Attribute`-only matcher walked past it. There are 42 literal `getattr` reads of record fields in the tree today and none of them is a resolution-written field reached through another object, so this closes a hole rather than reporting one. 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: 2817d1b897
ℹ️ 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".
| for cls in (n for n in ast.walk(tree) if isinstance(n, ast.ClassDef)): | ||
| parked_names = set() | ||
| for node in ast.walk(cls): |
There was a problem hiding this comment.
Propagate parked aliases into subclasses
When a base class parks the record (for example, self.args = scheduler.server_args) and a subclass later reads self.args.<resolved_field>, this class-local span model misses the read because the assignment belongs to the base class while the read's line belongs to a separate subclass span. The supplied-instance census also computes parked attributes independently per class, so neither ratchet covers inherited parked records; carry parked aliases through the inheritance graph or conservatively associate base-class aliases with subclasses.
Useful? React with 👍 / 👎.
Stack
Part of a series that moves
ServerArgsfrom "mutate the record at construction" to "resolve once, publish into config bags". Each PR stands alone (builds, passes its own tests); review bottom-up.mainWhole-series CI vehicle (not for merge): #35917
Motivation
Two orderings inside resolution hold today by accident, and nothing would notice them breaking. Tests only — no production change.
Modifications
ModelConfigis built from resolved input: the pin derives both sides from source — the fieldsModelConfig.from_server_argsreads, and the pipeline step each is declared at — and fails if a field it reads is declared after the first build. Two documented exceptions are named and asserted with equality, not membership:is_embeddingis read for what the caller asked for (passed through, never stored) — resolution later overwrites the field with a different quantity sharing the name;dtype,quantization,enable_multi_layer_eagle,disable_hybrid_swa_memory). The build/collect positions are read from the one handler body that contains both, and the registry-declared set is imported from the chain ratchet's derivation rather than re-derived — a copy that drifts narrower would make the check quietly vacuous. A fifth field arriving in that position fails; so does fixing the ordering — either way someone has to look.Verification
Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): 🚫 Run #32627965669
Latest PR Test (Extra): 🚫 Run #32627965537
Latest PR Test (AMD ROCm 7.2): ⏳ Run #32627965670