Repository navigation
Studio: add Server default for vLLM Min P - #10623
danielhanchen merged 8 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
The Server default mode itself is small and reads fine, but this branch also brings in the whole speculative-decoding recovery path in studio/frontend/src/features/chat/lib/min-p-recovery.ts with its own guard and store subscriptions. Could you split that out and keep this PR to the mode plus persistence? |
|
Studio’s default |
per-model-params.ts gained its first runtime import in this branch (min-p-policy.ts). That flips the chat barrel guard's safe-leaf rule, which is per-file rather than transitive, so the long-standing module-scope read of PERSISTED_INFERENCE_PARAM_KEYS in chat-runtime-store.ts is now reported. The read is one value import away from being a real temporal-dead-zone crash at startup, so defer it behind a memoized accessor rather than widen the guard. The record is mutated in place and spread, so the accessor memoizes to keep a single identity. Also widen the setParams invariant regex: the first three arguments to getChangedInferenceParams are the invariant being pinned, and the Min P choice flag is a legitimate fourth.
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Collapse the four multi-line comments this branch added to one line each, keeping every load-bearing fact: the TDZ reason and why the counters record must stay memoized, that mode and number are one choice, that a written number carries its mode, and that a recommendation carries none.
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Confirmed this covers #10573: vLLM requests no longer carry min_p unless Custom is chosen, so speculative-decoding servers stop rejecting every chat turn. The direction is right, though the toast recovery guard with its store subscriptions in chat-adapter.ts is a second change riding along; could you split that out so the mode plus payload change lands on its own? |
Backend CI's formatter fixed point check was failing on this branch. One of the two files is mine: ruff 0.15 formats the new parser differently from the 0.6.9 the hook pins, so what I committed was not what the hook produces. The other, tests/python/test_docker_nvidia_toolkit_install.py, is pre-existing drift that reached main in #10623 and is exactly the case that test was written to catch; it is untouched by this branch otherwise, and the change here is the hook's own output.
…10902) * Studio: keep the operator's package-manager policy in the installer #8579 made the installer's own pip and uv commands survive a hardened uv.toml / pip.conf, but it did that with a blanket amnesty: every pinned install dropped no-build, only-binary and exclude-newer from the environment and ran with PIP_CONFIG_FILE at devnull and UV_NO_CONFIG=1, so the operator's build-time code execution controls went with it. Narrow that to the one thing the installer actually cannot satisfy. * Hash enforcement (PIP_REQUIRE_HASHES / UV_REQUIRE_HASHES) is still cleared: every requirements file we ship is pinned but unhashed, so require-hashes has no artifact to check and can only abort the install. * no-binary is still cleared for pinned commands, because it would FORCE a source build of a wheel the pin exists to fetch. That is less build-time execution, not more. * UV_NO_BUILD, UV_NO_BUILD_PACKAGE, PIP_ONLY_BINARY and UV_EXCLUDE_NEWER are now left in force. Every pinned index we install from serves wheels, so honouring them costs the pin nothing. * PIP_CONFIG_FILE points at a rewrite of pip's own config minus the four source keys (the existing _pip_config_without_sources) instead of devnull, so cert, proxy, trusted-host and only-binary survive while the pin still gets the index determinism it needed. Computed once per run. * UV_NO_CONFIG=1 has to stay (uv has no per-key override and a discovered uv.toml outranks the CLI pin), so a no-build in that file is read back and re-asserted as UV_NO_BUILD=1 rather than silently lost. * The hash relaxation is keyed on the pip SUBCOMMAND now, not on the word "install" appearing somewhere in argv. Measured against a real pip.conf carrying require-hashes, only-binary, no-index and cert: raw pip refuses the install, the installer path installs the wheel, the installer path REFUSES the same package when only an sdist is available, and a pinned --index-url install succeeds with cert and only-binary intact. The package-scoped --no-binary exemptions for the four audited wheel-less requirements and the diffusers source archive are unchanged; they are what keeps #8530 fixed. * Keep the pin deterministic: devnull, then put the policy back key by key Simulation caught a real regression in the first pass of this branch. Pointing PIP_CONFIG_FILE at a rewritten config does NOT suppress a SITE or GLOBAL pip.conf: pip documents, and pip 26.2 confirms, that naming an existing file skips the per-user file only, while os.devnull is what "disables the loading of all configuration files". So a venv-level or /etc-level `no-index` came back to life and killed the pinned install: pip install --index-url <pin> packaging==24.0 -> No matching distribution That would have broken every torch repair, the XPU triton fetch and the torchao pin on any host with a site or global pip.conf. Reverted to os.devnull and put the operator's settings back one key at a time instead: * _pinned_pip_config_overrides() reads `pip config list` once per run and re-asserts an ALLOWLIST as PIP_ environment variables: cert, client-cert, proxy, trusted-host, timeout, retries, keyring-provider and only-binary. The transport half also fixes a pre-existing bug, since devnull used to drop the CA and proxy a private index needs. * index-url, extra-index-url, find-links and no-index are never re-asserted (the pin replaces them), nor is no-binary (it would force a source build of a pinned wheel), nor require-hashes (unsatisfiable against unhashed requirements). * Only global/install/download/wheel sections are read, so a `list.format` does not become a global PIP_ variable, and `:env:` rows are skipped so the child cannot re-inherit the variables the scrub just cleared. Also dropped the uv side of the previous commit. Measured against uv 0.10.7, UV_NO_BUILD, UV_NO_BINARY and UV_ONLY_BINARY are not uv environment variables at all: uv reads no-build from its config file, and re-asserting the variable was dead code promising a guarantee uv does not honour. UV_EXCLUDE_NEWER and UV_REQUIRE_HASHES are real and are handled as before. A uv.toml no-build still applies to every non-pinned command, which is where source builds actually happen. _executable_stem() splits on both separators, so a Windows argv0 is recognised off-Windows too, and a degenerate command can no longer raise out of the subcommand test. Verified: 78 of 90 base-vs-head environment comparisons are byte-identical and the other 12 are the intended hardened-host cases; real installs across pip 21.3.1 to 26.2.1 and Python 3.9 to 3.13; a site-config no-index no longer breaks a pinned install while only-binary still refuses an sdist. * Make the config read unable to fail the install, and the tests hermetic Three defects found reviewing the previous commit, all in code this branch introduced. The `pip config list` read sits on the path to every pinned install, including the final torch repair, so it must degrade to "no overrides" for ANY unexpected answer and not just for a missing pip. It caught OSError and TimeoutExpired but would have propagated anything else: a listing that is not bytes, a stdout of None, a decode that raises. Parsing moved into _parse_pinned_pip_config() and the whole read is now wrapped, with cases for each shape. A command section now beats `global` for the same option, which is pip's own precedence. It previously depended on the order `pip config list` happened to print the two lines in, so `global.only-binary=:all:` plus `install.only-binary=numpy` resolved differently run to run. The tests were not hermetic. A CI image carrying its own /etc/pip.conf would have leaked into the pinned-env assertions, and a test that mocks subprocess could populate the memoised read with a Mock and poison whatever ran next under random ordering. An autouse fixture clears the cache around every test and stubs the read, with an opt-out marker for the few tests that drive it themselves. Verified by running the three files repeatedly under random ordering. * Fix eight defects found reviewing this branch All eight are in code this branch introduced. The exec-extraction in tests/studio/test_xpu_triton_swap.py stopped pulling the parser once it was split out, so the "real scrub" that file deliberately executes raised NameError into a broad except and returned {} for every case: the file still reported 62 passed while asserting nothing. The loader now executes the extracted parser once against a known listing, so an inert extraction fails loudly instead of agreeing with everything. That mask was the second defect. The read caught OSError and TimeoutExpired around the subprocess but then wrapped the parse in `except Exception`, turning any programming error into "this operator has no pip config", which on a corporate host is a silent loss of cert, proxy and trusted-host on every pinned install. Narrowed to (OSError, subprocess.SubprocessError) around the call, with the parser skipping unparseable lines as before. Section precedence let [wheel] and [download] overwrite [install], which is not "more specific", it is a different subcommand: an operator with `[install] only-binary = :all:` and `[wheel] only-binary = numpy` had their install-wide policy downgraded to one package. Only [global] and [install] are read now, install winning, since the PIP_ variable is command-wide anyway. The memoisation cached failures as well as successes, so one transient miss (the 60s timeout, or a read racing the pip bootstrap) cost the operator their transport settings for the rest of the run. Only a successful read is cached. Value joining applied one rule to keys with two. `cert` is a single value, and collapsing whitespace turned `C:\Program Files\ca.pem` into a path that does not exist; `only-binary` is comma separated, so a two-package value became one bogus name and the policy silently stopped applying. Measured against pip 26.2: PIP_ONLY_BINARY="a,b" refuses both as sdists, PIP_TRUSTED_HOST="a b" is accepted, and `pip config list` renders a multi-value setting on one line with an escaped \n. The subcommand scan skipped leading-dash tokens but not the VALUE of a global option that takes one, so `pip --cache-dir /tmp/c install x` read as not an install and would have lost the hash relaxation. It now looks for the first token that names a pip subcommand. UV_EXCLUDE_NEWER goes back to being cleared for pinned commands, which is the pre-existing behaviour. Only uv reads it, _build_pip_cmd never adds pip's --uploaded-prior-to, and pip_install falls back to pip whenever uv fails, so honouring it on the uv leg alone means a pinned install that fell back quietly installs an artifact the cutoff forbids. And a dead REAL_PINNED_PIP_CONFIG_OVERRIDES assignment that read as if it were the fixture's restore mechanism is gone. Suites: 10768 passed. The 2 torchcodec failures reproduce on unmodified main. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten the comments this branch added Comment and docstring lines in the diff: 178 to 105. Every measured fact is kept, in one line where it took four: the devnull suppression rule, the pip 26.2 and uv 0.10.7 measurements, the separator each config key is read with, and the NameError trap in the exec-extraction. AST-gated comment-only. * Read the pip config section that belongs to the command being run pip config is per subcommand, and the re-assertion was reading [install] for every pinned command. Measured on pip 26.2: a pip.conf carrying [download] no-index stops a pip download and leaves pip install untouched, so translating [install] onto _ensure_xpu_triton's pinned pip download both drops that command's own cert, proxy and trusted-host and imposes an install-only policy on it. _pinned_pip_config_overrides() now takes the subcommand and reads [global] plus that command's section, with the command section winning. _pip_subcommand_of() resolves it from the command; a uv command defaults to install, since the PIP_ variables only ever reach its pip fallback. The listing is memoised instead of the parsed result, so this still costs one subprocess per run. Suites pass, and the real-pip, audit, differential and old-pip simulations are unchanged: 27/27, 15/15, 78 identical environments with 12 intended, 30/30. * Accumulate repeatable pip options, and do not read an empty env value as set Two ways the re-assertion could still lose the operator's policy, and one test that could pass for the wrong reason. pip ACCUMULATES a repeatable option across sections rather than letting the command section replace the global one. Measured on pip 26.2: a pip.conf with [global] only-binary = :all: plus [install] only-binary = numpy still refuses an unrelated sdist, so emitting PIP_ONLY_BINARY=numpy dropped the :all: policy on every pinned install. List keys now accumulate global plus the command section, deduplicated, with the separator each key is read with; scalars still take the command section alone, since two certs cannot be concatenated. Verified end to end: that config now yields PIP_ONLY_BINARY=':all:,numpy' and a pinned sdist install is refused. An empty inherited value is no longer treated as an override. pip ignores an empty environment value and falls through to the config file, which the pinned branch has just removed with devnull, so PIP_CERT= in the parent environment left the child with neither and a private index unreachable. Confirmed with env_var: PIP_CACHE_DIR='/mnt/disks/unslothai/daniel1/.cache/pip' env: global: /etc/xdg/pip/pip.conf, exists: False /etc/pip.conf, exists: False site: /mnt/disks/unslothai/daniel1/workspace_1/pip.conf, exists: False user: /home/daniel1/.pip/pip.conf, exists: False /home/daniel1/.config/pip/pip.conf, exists: False: PIP_TIMEOUT='' shows the variable and then uses global.timeout from the file. A whitespace value is left alone; that is a value pip would use, not ours to second-guess. The download-section test now clears PIP_CERT: the caller's environment legitimately wins over the re-assertion, so on a host that exports one the test asserted on the ambient value. * Keep the order of a repeatable option instead of deduplicating it pip applies a repeatable option IN ORDER, and :none: empties the set, so a re-add after a reset has to survive. Deduplicating dropped it: with [global] only-binary = a,b and [install] only-binary = :none:,a the parser emitted a,b,:none:, which ends on the reset and allows exactly the sdist build the operator forbade. Measured on pip 26.2 against a venv pip.conf carrying that config: pip itself refuses the sdist, the deduplicated string allows it, and the order-preserving concatenation refuses it again. End to end, the installer and pip with its own config now return the same exit code for the same install. * Give trusted-host section precedence instead of accumulating it pip's own parser, asked with [global] and [install] both set, resolves trusted_hosts to the install value alone (an append option, assigned per section) while format_control holds both (a callback that mutates in place). Accumulating trusted-host re-trusted a host the install section had dropped, which is a TLS decision, so the two keys are now separated: _PINNED_PIP_CONFIG_SEPARATORS says how a value is spelled in the environment, _PINNED_PIP_CONFIG_ACCUMULATING says which key carries across sections, and only only-binary is in it. * Make both files a fixed point of the formatting hook Backend CI's formatter fixed point check was failing on this branch. One of the two files is mine: ruff 0.15 formats the new parser differently from the 0.6.9 the hook pins, so what I committed was not what the hook produces. The other, tests/python/test_docker_nvidia_toolkit_install.py, is pre-existing drift that reached main in #10623 and is exactly the case that test was written to catch; it is untouched by this branch otherwise, and the change here is the hook's own output. * Decode pip config output with the encoding the child wrote A piped child encodes stdout with its own locale encoding, which on Windows is the ANSI code page rather than UTF-8, so the unconditional UTF-8 decode corrupted a cert or client-cert path spelled with non-ASCII characters. That is worse than losing the setting: the corrupted path exists nowhere, so pip fails the pinned install outright on exactly the corporate host the allowlist exists to serve. UTF-8 is still tried first and strictly, so the POSIX case and Windows UTF-8 mode are unchanged; the locale codec is the fallback. * Enforce the restored only-binary on the uv leg, and dictate the read encoding Two gaps the review found. uv reads neither pip.conf nor PIP_ONLY_BINARY, and a pinned command runs with UV_NO_CONFIG=1 because a discovered uv.toml outranks the CLI pin (#6898), so restoring the policy in the environment alone left the leg that actually runs free to build a source distribution the operator had forbidden. Measured against uv 0.10.7: a pinned uv install builds the sdist with PIP_ONLY_BINARY=:all: set, and refuses it given --only-binary. _build_uv_cmd now translates the restored value into uv flags for pinned commands only, since a non-pinned one keeps its config file and uv applies the policy itself. Second, UTF-8 first was not a reliable encoding detector: cp1252 bytes can form valid UTF-8, so a mis-encoded cert path could decode cleanly into the wrong path. The read now dictates PYTHONIOENCODING=utf-8 rather than sniffing what the child wrote, at both call sites that read pip config, and the locale decode stays only as a fallback. * Tighten the comments added by this branch Comment and docstring text only, with no code change: the AST gate confirms it. Ten lines out, mostly from the two longest measurement notes, with each measured fact kept. * Single-source the uv policy flag, and bound what a wedged pip can cost Three findings from an independent audit of this branch. _build_uv_cmd asked for the pip config separately from _install_env_for_cmd, so if the first read failed and the second succeeded the uv command went out without --only-binary while its own environment carried PIP_ONLY_BINARY. The flag now comes off the env that very command will run with, so the two cannot disagree. The 60s timeout was per attempt and unbounded across the run, because failures are deliberately not memoised. A wedged pip therefore paid it once per pinned command. A HANG is now budgeted, twice at 30s for the whole run, which is what the comment always claimed. Budgeting every failure would have been wrong in the other direction: a fresh venv has no pip for the first part of the run, that answer is instant, and spending the budget on it would lose the operator's cert the moment pip appeared. Cheap failures stay freely retryable, with a test for each direction. * Tighten the comments added by the audit fixes Comment text only, no code change; the AST gate confirms it. * Derive uv's only-binary flags from the same config read as its environment * Exempt the sdist-only rocm package from the only-binary a pinned install re-asserts * Add an exported only-binary to the configured one instead of replacing it * Limit the rocm exemption to AMD per-arch index pins --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: oobabooga <[email protected]>

Summary
New vLLM settings use "Server default" for Min P and omit
min_pfrom requests. Choosing Custom sends the selected number, including zero, and switching modes keeps the saved number.Changes
0.01values. Reset restores Server default on vLLM.How to test
132 focused frontend tests and 142 backend tests passed, covering settings persistence, hydration, presets, recovery and provider requests. Production TypeScript compilation passed.
Browser checks covered mode switching, retained zero, reset, reload, SSE recovery and stale actions. On an RTX PRO 6000 with vLLM 0.29.0 and Qwen3-0.6B, omission and zero generated with neutral defaults and ngram speculation; positive Min P failed. All three generated with speculation disabled. With a positive server default, omission failed and explicit zero generated.
Migration notes
The mode is an optional settings field; no database backfill is required. Existing numeric values remain Custom because their provenance is unknown. Existing chats may need one manual switch to Server default.
Notes for reviewers
Server default delegates to the server's configuration; it does not guarantee speculation-compatible settings. Full test typechecking still reports missing
readFileSyncreferences in the unchangedchat-continuation.test.ts. The original GLM5.3 server and native desktop/CLI were not tested.Screenshots
Captured from two isolated installs, each built by
install.sh --localfrom its own tree: BEFORE is this PR's merge base178e1722f, AFTER is headf58360e54. Both sides drive the same scene against a vLLM connection created through the API, so theisVllmbranch is genuinely selected rather than assumed.Run settings, Min P control:
BEFORE has an enabled Min P slider and no mode control. AFTER adds the Server default Select, the line "Uses the server's sampling settings.", and greys the slider out.
The whole panel, showing nothing else moved:
Temperature, Top P, Top K, Repetition Penalty, Presence Penalty and Max Tokens are identical on both sides.
Read out of the live DOM on each side rather than judged by eye:
min_p_mode_select_presentmin_p_mode_valuemin_p_input_disabledhelper_text_present