Repository navigation
Studio: stop /api/inference/status raising on every loaded GGUF - #8074
Conversation
_llama_runtime_fields() returns one entry per field on _InferenceRuntimeFields and get_status splats it. #8007 added chat_template_override to that model while get_status was already passing the same keyword explicitly, so the call raised TypeError: got multiple values for keyword argument 'chat_template_override'. Every status poll with a GGUF loaded returned 500. The chat UI showed 'Failed to get status' plus 'Failed to refresh models', and the model picker rendered empty, which is what took studio-windows-ui-smoke red on main. Assign into the dict before splatting. Pinning the duplicate to None would not help: two values for one keyword is a TypeError whatever the values are. Adds a source-level contract so any future field added to _InferenceRuntimeFields cannot collide with an explicit keyword at a splat site.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf9c777ef1
ℹ️ 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 isinstance(kw.value, ast.Call) | ||
| and isinstance(kw.value.func, ast.Name) | ||
| and kw.value.func.id == SPLAT_HELPER |
There was a problem hiding this comment.
Track the indirect runtime-field splat
The matcher only recognizes **_llama_runtime_fields(...), but the fixed status path now assigns that result to _runtime_fields and splats the variable. Consequently, adding a runtime field already passed explicitly by InferenceStatusResponse—for example spec_fallback_reason—would make /status raise the same duplicate-keyword TypeError while this regression test still passes because it examines only the separate load-response call. Extend the analysis to follow the local assignment or otherwise include the status constructor.
Useful? React with 👍 / 👎.
#8074 fixed the duplicate-keyword TypeError and added a source-level contract that no runtime field is also passed as an explicit keyword at a splat site. That contract cannot see the value, so the assignment it relies on can be dropped without failing it. Removing `_runtime_fields["chat_template_override"] = ...` leaves the contract test green while /status starts reporting the raw backend value. An auto-applied bundled family template then reads as a user override, and the frontend re-sends it for the next, unrelated model. Adds two cases to the existing loaded-GGUF status tests: the user override is echoed, and an auto-applied template still reports None.
test_status_path scans the InferenceStatusResponse construction for a literal _llama_runtime_fields(llama_backend). #8074 had to bind that call to _runtime_fields one line above the construction so it could overwrite chat_template_override before passing it on, which moved the call out of the block the test reads. The route still applies the runtime fields, so the test has been red on main since that merge and on every PR branched from it. Accept either shape, and only count the splat when the dict is the helper's, so removing the fields from the route still fails the test. Co-authored-by: Unsloth <[email protected]>
* Studio: pin the /status chat template echo behaviour #8074 fixed the duplicate-keyword TypeError and added a source-level contract that no runtime field is also passed as an explicit keyword at a splat site. That contract cannot see the value, so the assignment it relies on can be dropped without failing it. Removing `_runtime_fields["chat_template_override"] = ...` leaves the contract test green while /status starts reporting the raw backend value. An auto-applied bundled family template then reads as a user override, and the frontend re-sends it for the next, unrelated model. Adds two cases to the existing loaded-GGUF status tests: the user override is echoed, and an auto-applied template still reports None. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: shimmyshimmer <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
/api/inference/statushas returned 500 for every loaded GGUF since #8007 landed on main.What happens
_llama_runtime_fields()builds its dict by comprehension over_InferenceRuntimeFields.model_fields, so it returns one entry per field on that model.get_statussplats that dict and passes the same keyword explicitly:#8007 added
chat_template_overrideto_InferenceRuntimeFields. From that commit on, the key is in the dict and in the argument list, and Python raises before the response is constructed.The sibling field was handled correctly:
chat_template_override_reasonis pinned toNoneinsidefields.update(...). That pattern does not work here, because the collision does not depend on the values. The key has to be absent from the dict, notNone.The other splat site (line 3706) does not name any runtime field explicitly, so it was never affected.
User-visible effect
The chat UI polls status from first paint. With status failing it shows
Failed to get statusand twoFailed to refresh modelstoasts, and the model picker renders with no models in it.That is also what took
studio-windows-ui-smokered on main. The assertion that fired readswhich is a downstream symptom: with an empty picker, both queries produce the same text. Typeahead filtering is fine. The screenshots in that run's artifacts show the empty picker with both error toasts.
The fix
Assign into the dict, then splat once, so the reported-override logic above still wins:
Test
tests/studio/test_inference_status_runtime_fields_contract.pyparses both modules and asserts that no call splatting**_llama_runtime_fields(...)also names one of_InferenceRuntimeFields's fields as an explicit keyword. It is source level because importing the routes module pulls in the whole studio stack, and this is a call-shape property AST can see directly.Verified in both directions: it fails on the parent commit, reporting
line 8032: ['chat_template_override'], and passes with the fix.It guards the general case rather than this one field, so the next field added to
_InferenceRuntimeFieldscannot reintroduce the same collision at either splat site.