Repository navigation
studio: add a sampling seed to the chat run settings - #9144
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f07971711
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18384a941e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const showSeed = | ||
| !isExternalModel && | ||
| modelReadsSamplingSeed( |
There was a problem hiding this comment.
Hide or forward the seed during deep research
When Deep Research is enabled for a local GGUF model, this predicate still exposes the Seed control, but the adapter exits through the earlier buildResearchInferenceRequest path, whose input and resulting ResearchInferenceRequest contain temperature, top-p, and max tokens but no seed. Consequently every research run silently ignores the pinned value despite the control promising reproducible sampling; either propagate the seed through the research request/backend or exclude Deep Research from showSeed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one. ResearchInferenceRequest carries temperature, topP and maxTokens only, so topK, minP, repetitionPenalty and presencePenalty are dropped on the research path exactly as the seed is, and the panel shows all four during deep research today. Singling out the seed would be inconsistent with its neighbours and would not be a fix. Deep Research is also a per-turn mode rather than a model class: buildResearchInferenceRequest runs only while the branch guard at chat-adapter.ts holds, and a thread that already researched falls through to the ordinary seeded body, so hiding the control whenever the toggle is on would remove a knob that still works for those turns. Carrying sampling settings through the research run is worth doing for the whole set in its own change, not for one field here.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Confirmed the gap is real, InferenceParams had no seed while ChatCompletionRequest.seed already reaches llama-server, and gating the control on modelReadsSamplingSeed is the right call. Could you rebase off the conflict and get Backend CI on Python 3.13 and the Mac GGUF smoke green so this can be reviewed? |
Lyxot
left a comment
There was a problem hiding this comment.
Reviewed against current main. The gap is real and the persistence handling is the good part, but main moved under the branch. Also diagnosed the red CI, since it turns out not to be yours.
Verified
ChatCompletionRequest.seedreaches llama-server on both the tools and no-tools GGUF paths;InferenceParamshas noseed. Gap confirmed.- The backend edit is required, not incidental:
ChatInferenceSettingsisextra = "forbid". - The
seed === nullbranch is load-bearing — the sanitizer runs on the outgoing patch too (savePersistedChatSettingsPatch), and_deep_merge_settingsoverwrites per key without ever deleting, so an omitted key would leave the old pin in place. That is the subtle part of this change and it is right at every layer. LLAMA_DEFAULT_SEEDis0xFFFFFFFFand the server parsesseedas auint32_twith clamping, so the reasoning behind the ceiling holds for that backend.
A note on the issue rather than the PR: the seed key in inference_defaults.json is families.seed, a model-family sampling block, not a seed parameter. Your description cites ChatCompletionRequest.seed instead, which is the correct evidence — flagging only so the issue's premise does not get quoted onward.
Blocking
1. modelReadsSamplingSeed is out of date since #9262. The MLX backend now declares and uses seed: generate_chat_response takes it and builds _make_seeded_mlx_sampler from it, the chat route forwards payload.seed on the non-GGUF path, and worker.py's _backend_declares gate passes it through. The transformers backend is the one that still drops it, deliberately.
As written the predicate returns false for a loaded MLX model — ggufVariant is a quant label and is null for non-GGUF, and ggufContextLength "covers only GGUF" per the store's own comment — so the panel hides the control and the adapter strips the seed for models that would honor it. Since the rebase is needed anyway, this is worth redoing on top of it. activeModel.isMlx is a clean signal here: for a loaded model that flag comes from backend.device == "mlx" rather than from the repo name, so it already answers "is this served by MLX" including the Apple-Silicon-safetensors case.
2. A test comment asserts something that is not true. The ceiling is justified with "a run whose server-drawn seed landed there could not be replayed" — but no chat path reports the seed back. Every seed echo in routes/inference.py belongs to the diffusion gallery recipes, and no chat response type carries one. A seed can only be replayed if the user typed it. The bound itself is fine; the rationale should go or change, since it will be read as documenting behavior that exists.
Worth changing
3. The hint promises more than the seed delivers. #9090's own table shows seed + temperature 0 + top_k 1 still producing 3,960 vs 150 characters, and reproducing only at n_parallel = 1 with speculative decoding off. The hint covers the sibling sampling knobs and greedy decoding but not the two levers that actually broke it, so the likely outcome is a user pinning a seed, getting a different reply, and reporting the seed as broken. One clause would cover it.
4. The panel and the request body do not gate identically. The panel passes the active model summary as a fourth argument; the adapter passes three. It is harmless today, since an audio-output model returns through generateAudio before the chat body is built — but the test asserting the invariant is a regex on the call name and cannot see the difference. That is the same blind spot as finding 1.
Notes
5. The request body already computes activeModel?.isGguf for context_overflow while modelReadsSamplingSeed re-derives the same fact from three other signals. Two notions of "is this a GGUF" in one object literal will drift.
6. NumericValueInput keeps a raw draft while focused and commits on blur, specifically so it does not rewrite what the user is typing; this field clamps on every keystroke, so typing past the maximum silently rewrites the box mid-entry. It cannot be reused as-is (value: number, no unset state), so the hand-roll is fair — just noting the divergence.
7. The type="number" precedent named in the description is in chat-providers-dialog.tsx, not chat-settings-sheet.tsx. The test comment has it right.
CI: neither failure is yours
The red checks predate and outlive this branch, so the rebase alone should clear them.
Backend CI / (Python 3.13) — failing on main itself. All six main runs of that workflow on 18 Aug failed on that job, with (Python 3.11) green on the same runs, which matches the pattern here.
Mac Studio GGUF CI / GGUF inference smoke — broadly red in the window this branch ran in. Between 03:00 and 08:00 UTC on 18 Aug that workflow failed on 17 distinct branches, main among them (nine main failures in that window, two of them at 05:38 and 05:39, minutes from this branch's 05:07 run) — 25 failures against 3 successes overall. It recovered later the same day and was green on every branch from about 16:00 onward.
Unsloth Tauri CI / Tauri Linux debug build — not a failure at all; that job was cancelled.
Mechanics
302 commits behind with conflicts, unchanged since 19 Aug. The three formatting hunks (test_lan_access_settings.py, test_compile_caches_are_per_worker.py, test_no_test_shadows_another.py) are already on main verbatim, so the rebase should shrink the diff rather than grow it.
One design thought, not a request
The client-side capability gate is the fragile part here. It was correct when written and went stale in six days, silently, in the direction of dropping a parameter the backend would have honored. The backend already solves this properly — _backend_declares inspects the live signature and fails closed. Having the load or status response report which sampling parameters the loaded backend honors, and reading that in the panel, would have lit this field up for MLX with no frontend change at all. Too large for this PR, but worth knowing it is the pattern the next parameter will copy.
18384a9 to
bbbdb98
Compare
|
Rebased onto latest 1. 5, folded into the same change. The predicate now reads the same 4. Identical gating. Both call sites are 2. The ceiling comment. Removed. You are right that no chat path reports a seed back: every 3. The hint. Added: "Matching a reply also needs the model loaded with Parallel Slots at 1 and Speculative Decoding off, since both change how tokens are batched and that moves the result." Those are the load-config labels in 6. Mid-entry clamping. Fixed rather than left as a note. The box keeps the raw keystrokes in a 7 and 8, in the description. The The design note. Agreed and out of scope here. A load or status response reporting which sampling parameters the loaded backend honors, read by the panel, is the right shape, and Checks on the rebase: |
InferenceParams had no seed, so a Studio generation could not be reproduced even though ChatCompletionRequest.seed already reached llama-server. Add the field, default null, and surface it in the Sampling section as a blank-means- random text box. The seed is sent only when set and only when the loaded model decodes through llama-server, which modelReadsSamplingSeed answers for the panel and the request body alike. Range is 0 to 4294967294: llama.cpp reads a uint32 and spends 0xFFFFFFFF on LLAMA_DEFAULT_SEED. Persisting it needed the storage sanitizer to range-check the value and pass an explicit null, ChatInferenceSettings to accept the key at all since it is extra="forbid", and PresetOwnedParams to carry it so a preset captures the pin.
An audio-output GGUF (isAudio and no hasAudioInput) answers through the generateAudio branch in chat-adapter.ts, whose request carries no seed, so the control let a user pin and persist one that every audio run ignored. modelReadsSamplingSeed now takes the active model summary and excludes that case. A model that takes audio in still decodes through llama-server and keeps the field.
modelReadsSamplingSeed dropped the seed for MLX, which reads one since unslothai#9262: generate_chat_response takes it, _make_seeded_mlx_sampler uses it, and worker.py's _backend_declares gate passes it through. The old predicate answered from activeGgufVariant, ggufContextLength and the .gguf suffix, none of which is true for a loaded MLX model, so the panel hid the control and the adapter stripped the pin. It now takes the models[] summary the request body already reads isGguf from for context_overflow and returns isGguf || isMlx, so there is one notion of "is this a GGUF" per request and both call sites pass the same argument. The transformers backend still declares no seed kwarg, so it is still the one that drops it. The Seed box keeps a raw draft while it is being typed into and clamps on blur. Clamping every keystroke rewrote the box mid-entry, which is the trap NumericValueInput's blur commit exists to avoid. The hint now names Parallel Slots at 1 and Speculative Decoding off. unslothai#9090's table shows seed plus temperature 0 plus top_k 1 still producing 3,960 against 150 characters without them, so the old wording promised more than the seed delivers. The ceiling test justified the bound with a run whose server-drawn seed could not be replayed. No chat path reports a seed back, so that comment is gone.
bbbdb98 to
f6cbb21
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8511a59f01
ℹ️ 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".
The seed was persisted per model and installation-wide, so a pin taken in one chat fixed the draw for every other chat opened on that model, and reopening the first could not bring its own value back. Every other per-turn sampling control in the panel already travels with the conversation; maxTokens is out for a reason that does not apply here, since a context budget belongs to the model that loaded. seed joins THREAD_SCOPED_PARAM_KEYS and ChatThreadSettings, with the same 0 to 4294967294 bound and boolean guard the installation copy uses. It is the first thread-scoped value whose cleared state is null rather than absent, so the three fallbacks that read a snapshot key can no longer use ??: null there is the chat's own choice, and coalescing it would hand back the installation pin the user had just dropped. firstSetThreadScopedValue takes the first value that is not undefined instead.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ca58a6763
ℹ️ 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".
…ve the seed being typed Two ways the seed reached the wrong answer. A locally scanned model is in neither /api/models/list nor the external ids, so its models[] summary is minted from the load or status response. Both hops that mint one, syncModelCapabilities and ensureActiveModelInStoreList, dropped is_mlx, so modelReadsSamplingSeed read false for a model MLX was serving: the panel hid the field and the adapter stripped the pin. Both now carry it, the same way hasVideoInput is carried for the GGUF row that /api/models/list leaves incomplete. Clicking Save on a preset blurs the seed box during mousedown, but React has not re-rendered by the time that button's onClick runs, so the save wrote the seed from before the entry, and over an otherwise-unmodified preset the button was still disabled and the first click did nothing at all. committedSeed computes what blur would land on, and the save, the unsaved-changes check and the blur handler all read it, so no two of them can answer differently. NumericValueInput bridges the same gap with commit().
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c90a9f6d72
ℹ️ 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".
…t as null The thread response dumped every unset field as null, which runtime-provider.tsx notes and sanitizeThreadScopedSettings drops. That worked while no thread-scoped setting had a meaningful null. seed does: null means this chat draws its own rather than taking the pin it would otherwise inherit, so a snapshot written before the field existed read as a chat that had cleared it, and opening one wiped the seed the chat should have inherited. A field_serializer on ChatThread.settings dumps with exclude_unset, so the three cases separate on the wire: absent for a key the snapshot never held, null for a pin the chat cleared, a number for one it set. thread_from_row validates the stored dict, so model_fields_set is exactly the stored keys, and the test drives it through a real response_model to cover FastAPI re-validating the return value. POST /threads stores payload.model_dump(), so a create now stores the keys it was sent instead of every key with nulls. The PATCH path already did that.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7bd723235
ℹ️ 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 QueuedModelCapabilities is a Pick over ChatModelSummary that left isMlx out, so a queued run adopting a resident MLX model with no catalog row minted a private summary that looked like a backend with no seed support, and the request dropped the pin. Enumerating the rest of the family found two more: the queued snapshot at snapshotVisibleModelState, and the compare composer's own models[] sync, which mints a row the same way. Four places mint or refresh a summary and three were missing the flag. Replaced the two spot checks with a rule over the capability cluster: every literal that writes hasVideoInput has to write isMlx too, named by file and line when it does not. Verified by dropping the flag at each of the five sites in turn.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
Blur is the only commit the Seed field has, and a browser fires no blur when a focused element is removed: focus moves to the body and no handler runs. A draft left behind when the field goes away, or when the loaded model changes underneath it, therefore stayed in state with nothing able to clear it, went on answering for committedSeed, and so marked the preset modified with the field no longer on screen and handed a preset save a seed the user had abandoned. Discard the draft rather than commit it when the field's model or visibility changes: an entry walked away from was never confirmed, least of all for whichever model is loaded now.
`modelReadsSamplingSeed` answers from `isGguf`, `isMlx`, `isAudio` and `hasAudioInput`. All four were optional, so a row that left one out did not fail — it read as `false` and the gate answered wrong, hiding the seed field for a model whose backend does read one. Two commits on this branch are each a mint site that was missed that way, and the compiler had nothing to say about either. The flags stay optional on `ChatModelSummary`, because not every summary is a catalog row and some are built by tests with no opinion on a backend. What changes is the shape the store holds: `models[]` and `setModels` now take `ChatModelRow`, a summary that has stated the four, and the gate takes `SeedGateFlags` so it cannot be handed a shape that has not. Anything minting a row therefore has to answer, and answering is cheap — every mint site already holds the backend response the flags come from. That named a fifth site the earlier passes had not reached: the default-model row in the chat adapter stated neither `isMlx` nor `hasAudioInput`.
…gs models The guard was copied into a third model with the sampling seed, and the uint32 ceiling was spelled out twice. Both are one rule: bool subclasses int, so lax mode takes `true` for a number nobody set, and llama.cpp keeps 0xFFFFFFFF for its draw-one sentinel. The bound sits inside the Optional rather than beside it. Outside, pydantic compares None against it and a cleared pin raises TypeError instead of validating -- the settings and thread-settings tests both catch that, which is how the placement was settled.
Four comments repeated what the line beside them says. The seed bound in the thread-scoped table names a constant whose own definition carries the llama.cpp rationale; the preset entry said a preset captures the seed, which is the `Pick` above it, in place of saying why the value is normalised; the adopted-model row explained that the seed gate reads `isMlx`, which the summary type now requires outright; and the storage branch restated its own `null` test ahead of the reason that null is kept. The remaining comments record constraints the code cannot: the blur gap in the numeric input, the audio-output path that answers through generateAudio, the transformers backend's missing `seed` kwarg, and the hydration paths the bound applies to.
The test pins the shape of the seed-draft reset and read as though it proved the reset runs. It cannot: this project has no DOM environment, so nothing here mounts the panel or watches the effect fire. It now states that limit, and where the claim behind it actually comes from — removing a focused input was measured in a browser to run no blur and no focusout.
|
Pushed five commits addressing the review points. Summary of what changed and why: A seed entry could outlive the field it was typed into. Blur is the only path that commits the draft, and browsers fire no blur when a focused element is removed — focus just moves to the body. So typing a seed and then switching model, or switching to a backend that reads no seed, left the draft live in The seed gate could answer wrong instead of failing. The boolean guard and the seed bound were duplicated across the settings models. Three near-identical validators became one Comment trim. Removed prose that restated the line beneath it, keeping the parts the code can't say — the browser blur gap, One correction worth flagging: a comment I'd written claimed the seed bound had to sit inside the Validation: 105 frontend tests, 145 backend tests, |
|
@codex review |
|
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". |
Lyxot
left a comment
There was a problem hiding this comment.
Approving. The code checks out and CI is clean once main's own breakage is accounted for.
To get a full check run without waiting on the upstream queue, I mirrored this branch into a fork PR at the same commit — identical diff, verified by hash:
upstream #9144 diff sha1: 0ef2ff984028957fd60bae61eeaca5fd8bd9a9d8
mirror diff sha1: 0ef2ff984028957fd60bae61eeaca5fd8bd9a9d8
Result: 41 pass, 5 fail, 4 skipped. All five failures are inherited from main, not introduced here:
| Check | Actual failure | Origin |
|---|---|---|
| Frontend build + bundle sanity | Locale parity: 4 missing settings.agents.* keys |
#9752 added them to en.ts only, no overlays |
| Repo tests (CPU) | test_pip_cache_naming.py reads without an encoding, ×3 |
#9781 |
| workflow-trigger lint | Same file reads a workflow but isn't in the unfiltered guard job | #9781 |
| Python 3.13 | test_control_markup_neutralize_7066 — 1 fail in 32,733 |
pre-existing on main |
| Core (HF=latest + TRL=latest) | mxfp4.dequantize missing on transformers 5.16.0 |
upstream API drift |
Two things make the attribution solid: this branch touches none of those files — the four missing i18n keys appear zero times in the diff — and both root-cause commits landed on main after this branch's merge-base, so they only appear because CI tests the merge. pre-commit.ci is red for the same reason: it is currently failing on main itself, and the 163 files it rewrites include none from this PR.
What I checked beyond CI:
- The seed reaches inference.
payload.seedalready flowed to llama-server before this PR, so the frontend field lands on working plumbing rather than a no-op. - The
??→firstSetThreadScopedValuechange is the risky one, since it touches every thread-scoped param and the backend declares them allOptional. It is safe:sanitizeThreadScopedSettingsdropsnullfor every bounded-number key and re-adds it only forseed. Feeding it a legacy all-nulls snapshot returns{"seed": null}and nothing else. - Seed input edges:
""clears,4294967295clamps to4294967294so a pin can never land onLLAMA_DEFAULT_SEED, overlong input clamps, non-numeric clears. - Locally: 1317 frontend chat tests and 155 backend tests pass.
Studio has no way to pin a sampling seed, so a generation cannot be reproduced. The backend already accepted one:
ChatCompletionRequest.seedinstudio/backend/models/inference.pyreaches llama-server throughroutes/inference.pyandcore/inference/llama_cpp.py. The gap was the frontend's parameter set, so this adds the field and the control rather than any new server plumbing.Fixes #9090.
The issue's own evidence points at the
seedkey ininference_defaults.json, which isfamilies.seed, a model-family sampling block rather than a seed parameter.ChatCompletionRequest.seedis the field that actually carries the pin.What changed
InferenceParamsinstudio/frontend/src/features/chat/types/runtime.tsgainsseed?: number | null, defaulting tonull. A blank field is unset, so nothing changes for anyone who does not touch it.The run settings panel renders a Seed box in the Sampling section, below Max Tokens. It is a text input rather than
type="number": the HTML value sanitization algorithm reports an entry the engine cannot parse as the empty string, which would silently clear the pin.chat-providers-dialog.tsxdocuments the same trap for the provider Max Tokens field. The box keeps the raw keystrokes inseedDraftand clamps on blur, so an entry past the maximum is not rewritten while it is still being typed.committedSeedis that clamp as a value rather than a side effect, so a click on Save, which blurs the box during mousedown but runs itsonClickbefore React re-renders, saves the seed that was typed instead of the one before it.NumericValueInputcannot be reused here (value: number, no unset state) but its blur commit exists for that reason.chat-adapter.tssendsseedon the local chat body only when it is set and when the loaded model's backend reads one.modelReadsSamplingSeedintypes/runtime.tsanswers that for both the panel and the request body, from the samemodels[]summary the body already readsisGguffrom forcontext_overflow, so the two cannot drift and a pin left over from a GGUF is not sent invisibly.llama-server reads the seed, and so does MLX since #9262:
generate_chat_responsetakes it and builds_make_seeded_mlx_sampler, andworker.py's_backend_declaresgate lets it through. The transformers backend declares noseedkwarg, so it is the one that drops it, and the one the control stays hidden for. An audio-output model is excluded too, since it answers throughgenerateAudio, whose request carries no seed.The flag has to reach the summary for that to work. A locally scanned model is in no
/api/models/listrow, so itsmodels[]entry is minted from the load or status response, and both hops that mint one,syncModelCapabilitiesandensureActiveModelInStoreList, now carryis_mlxthe way they already carryhas_video_input.The pin covers 0 to 4294967294. llama.cpp reads the seed as a
uint32_tand spends0xFFFFFFFFonLLAMA_DEFAULT_SEED, its draw-one sentinel, so that value is the one a pin cannot name.The hint says a matching reply also needs Parallel Slots at 1 and Speculative Decoding off. #9090's table shows seed plus temperature 0 plus top_k 1 still producing 3,960 against 150 characters without them.
Persistence
seedjoinsPERSISTED_INFERENCE_PARAM_KEYS, so it survives a reload and is remembered per model. Three places needed it:utils/chat-settings-storage.tsgates both the hydration read and the outgoing PUT, sosanitizeInferenceParamsnow range-checks the seed and lets an explicitnullthrough. Without the null the server merge, which only overwrites the keys it receives, would leave an old pin in place after the user cleared it.ChatInferenceSettingsinstudio/backend/routes/chat_history.pyisextra="forbid", so an unknown key would 400 the whole settings save. It bounds the seed and rejects booleans, matching the_no_booleansguardChatPresetLoadConfigalready applies tonBatchandnUbatchfor the same reason:boolsubclassesint, so lax mode would storetrueas a pin of 1.presets/preset-policy.tsaddsseedtoPresetOwnedParams. The control sits with Temperature through Max Tokens, all preset-owned, so saving a preset captures the pin and applying one restores it.utils/thread-scoped-settings.tsandChatThreadSettingsadd it to the per-chat snapshot, so a pin belongs to the conversation it was taken in. Every other per-turn sampling control already travels that way;maxTokensis the one left out, and the reasonthread-scoped-settings.test.tsgives is that the context belongs to the model that loaded, which does not cover a seed. It is also the first thread-scoped value whose cleared state isnullrather than absent, so the three snapshot fallbacks inchat-runtime-store.tsgo throughfirstSetThreadScopedValueinstead of??: coalescing would read a cleared seed as a missing key and hand back the installation pin.Checks
Run on the rebase.
npm run typecheckcleannpm test5161 passed, 0 failed, including 24 intests/chat-sampling-seed.test.tspytest tests/test_chat_settings_payload.py tests/test_chat_history_routes.py tests/test_chat_thread_settings.py tests/test_chat_history_storage.py195 passed, 0 failedruff checkclean on both backend files