Repository navigation
config: a defensive publish must not re-project over a live process - #35904
Conversation
c111238 to
d8764b8
Compare
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]>
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]>
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]>
aa84ade to
552e109
Compare
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]>
552e109 to
a876f2b
Compare
a876f2b to
054794f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 054794f002
ℹ️ 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(inner.func, ast.Name): | ||
| name = inner.func.id | ||
| elif isinstance(inner.func, ast.Attribute): | ||
| name = inner.func.attr |
There was a problem hiding this comment.
Resolve publisher symbols instead of matching method names
The census treats every attribute call whose final component is publish or ensure_published as a runtime-context publication, regardless of its receiver. Consequently, adding a constructor that calls an unrelated API such as client.publish() falsely changes the pinned census, while an actual aliased import such as from ...runtime_context import publish as install is missed entirely. Resolve imports and module-qualified calls, as the precedence guard already attempts to do, so this test reliably detects only runtime-context publishers.
Useful? React with 👍 / 👎.
`ModelRunner` and `TokenizerManager` publish the startup record in their constructors because either can be built standalone -- a benchmark harness, the manual runner tests -- with nothing published before it. Inside a real process the launcher published the same record already, and publishing again re-projects the config bags: every `get_context().override(...)` taken between the two calls is discarded, and the provenance log with it. No process opens that window today, and that is checked rather than assumed: every `get_context().override(...)` site in the tree runs below the publish that precedes it. The scheduler is the case worth naming because it looks like a counterexample -- the grammar backend's import fallback overrides `grammar_backend` from `init_grammar_manager()` -- and it is not one: `__init__` builds the model worker, and with it that constructor's publish, well above the grammar manager. So this is the semantics, not a live bug: the discard is silent, both constructors are reachable inside a process that is already live, and nothing at the call site says which case it is. Both constructors now ask for the end state -- this record, this role, published -- through `ensure_published`, which is a no-op when that already holds. `publish` keeps its last-publish-wins semantics, because an engine rebuild must not inherit the previous engine's runtime scaling; it now names the overrides a re-projection drops instead of dropping them quietly. The census of constructor publishes is pinned, keyed by the owning class: a constructor that owns the runtime it publishes (the engine, the Ray actor that stands in for `run_scheduler_process`) uses `publish`, and one that may run inside a live process uses `ensure_published`. The difference is not visible in the syntax, so a new one fails the pin until it is classified. One stray conversion rides along: the base grew a `get_global_server_args()` call site (granite's attention sinks) without bumping the pinned baseline, so the legacy-accessor ratchet is red on the base itself. The read moves to the bag accessor its converted siblings use, keeping the pinned count.
054794f to
526f7b6
Compare
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]>
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
ModelRunnerandTokenizerManagerpublish the startup record in their constructors because either can be built standalone (a benchmark harness, the manual runner tests) with nothing published before it. Inside a real process the launcher has already published the same record, and publishing again re-projects the config bags: everyget_context().override(...)taken between the two calls is discarded, and the provenance log with it.No process opens that window today — checked, not assumed: every
override(...)site in the tree runs below the publish that precedes it. But the discard is silent, both constructors are reachable inside a live process, and nothing at the call site says which case it is. Any override placed in such a window from now on would be undone without a trace.Modifications
ensure_published(server_args, *, role): a no-op when this record is already published under this role, a normal publish otherwise (empty slot, a different record, or a different role).publishkeeps last-publish-wins — an engine rebuild must not inherit the previous engine's runtime scaling — and now logs the overrides a re-projection drops instead of dropping them quietly.ModelRunner,TokenizerManager, and the in-process encoder ask for the end state throughensure_published.sglang.test.config_publishers) and keyed by owning class: a constructor that owns the runtime it publishes usespublish; one that may run inside a live process usesensure_published. The difference is invisible in the syntax, so a new publishing constructor fails the pin until it is classified.Independent of the rest of the stack: it fixes behavior that predates it.
Verification
Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): 🚫 Run #32627829089
Latest PR Test (Extra): 🚫 Run #32627828993
Latest PR Test (AMD ROCm 7.2): 🚫 Run #32627829108