Repository navigation
Answer /status the runtime fields a backend double cannot invent - #11076
Conversation
`Backend CI` has been red on main since af4e98e with three multi-account tests asserting `{"detail":"Failed to get status"}`, and `Repo tests (CPU, studio)` red alongside them. The message names neither the field nor the cause. af4e98e added four reasoning fields to `_InferenceRuntimeFields`. They are not Optional, which is right: `LlamaCppBackend.__init__` sets `_reasoning_budget = -1` and `_reasoning_budget_message = ""`, so the real backend never answers None for them. `_llama_runtime_fields` mirrors every field in that model off the backend, public name first and the `_name` slot as a fallback, and the doubles in these tests answer None for anything nobody set. None is not a value those four accept, so /status raised ValidationError and the route returned 500. The PR is correct; the doubles were not. ## What changed `FakeLlamaCppBackend` now carries the runtime surface /status mirrors, at the values `LlamaCppBackend.__init__` gives them. The same block was being re-declared by hand in the per-test fakes, which is exactly what the shared double exists to end. Fields the real backend holds only as `_name` are declared under that name here, so the double claims nothing production cannot read. The blanket `__getattr__` that several fakes carry defeated that fallback: answering None for the public name hides the private slot that has the value. It lives on the shared double now and defers to the private sibling before answering None, so one contract covers every double instead of each one re-deriving it. ## Coverage The existing canary drives /chat/completions, which never reaches this. A second one builds the /status runtime payload from the bare double and validates it, failing with the offending field in the message. Mutation-tested: removing the four reasoning fields reproduces af4e98e and the canary names all four; restoring the blanket None `__getattr__` names the seven private-only fields.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b03526879
ℹ️ 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 name.startswith("_"): | ||
| try: | ||
| return object.__getattribute__(self, f"_{name}") | ||
| except AttributeError: | ||
| pass | ||
| return None |
There was a problem hiding this comment.
Preserve fallback semantics for absent backend capabilities
Returning None for every missing attribute prevents callers' getattr(..., default) fallbacks from running. For example, _ToolGguf in test_video_chat_completions_behaviour.py sets supports_tools = True but omits supports_tool_passthrough; the route intentionally defaults that capability to supports_tools, whereas this method now returns None, causing the request to be rejected as lacking tool passthrough before reaching the guided-decoding media guard. Consequently, the existing test at lines 491–509 receives the wrong error and fails. Restrict this private-name fallback to the runtime fields or raise AttributeError when no private sibling exists.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs 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". |
A blanket __getattr__ on the shared double took away callers' getattr(..., default) fallbacks: the route defaults supports_tool_passthrough to supports_tools, and None is not absent, so a double that set supports_tools and omitted the passthrough flag had its request rejected before reaching the guard the test was asserting on. The fallback now covers only the names /status mirrors, taken from _InferenceRuntimeFields rather than listed, and anything else raises AttributeError as before. Within that set the private slot still comes first, which is what the response model needs for the fields the real backend holds only as _name. Attributes the status route reads straight off the backend rather than through the model-field loop are declared too, at the real backend's initial values: requested_spec_mode, requested_parallel_slots, effective_parallel_slots, requested_n_ctx, requested_extra_args, spec_fallback_reason and spec_drafter_kind. An absent one is an AttributeError before the drift check can name it. Mutations: dropping the four reasoning fields reproduces af4e98e and the canary names all four; answering None instead of the private slot names the seven private-only fields; restoring the blanket fallback fails the video chat-completions tests again.
|
Agreed and fixed in The fallback now covers only the names /status mirrors, taken from Removing the blanket fallback also exposed the attributes the status route reads straight off the backend rather than through the model-field loop, where an absent one is an Mutations: dropping the four reasoning fields reproduces @codex review |
|
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". |
…lothai#11076) `Backend CI` has been red on main since the reasoning-budget controls landed, with three multi-account tests answering `{"detail":"Failed to get status"}`, a message naming neither the field nor the cause. Four reasoning fields were added to `_InferenceRuntimeFields` and they are not Optional, which is right: `LlamaCppBackend.__init__` sets `_reasoning_budget = -1` and `_reasoning_budget_message = ""`, so the real backend never answers None for them. `_llama_runtime_fields` mirrors every field in that model off the backend, and the test doubles answered None for anything nobody set, so /status raised ValidationError and the route returned 500. The PR that added the fields is correct; the doubles were not. ## What changed `FakeLlamaCppBackend` carries the runtime surface /status mirrors, at the values `LlamaCppBackend.__init__` gives them. The same block was being re-declared by hand in the per-test fakes, which is what the shared double exists to end. Fields the real backend holds only as `_name` are declared under that name, so the double claims nothing production cannot read. The blanket `__getattr__` several fakes carried defeated that fallback: answering None for the public name hides the private slot that has the value. It lives on the shared double now, scoped to the names /status mirrors and taken from the model rather than listed. Everything else raises `AttributeError` as before, so `getattr(backend, name, default)` keeps its default; a blanket version broke `supports_tool_passthrough` defaulting to `supports_tools`, which Codex caught during review. Attributes the status route reads straight off the backend rather than through the model-field loop are declared too, at the real backend's initial values. ## Coverage The existing canary drives /chat/completions and never reaches this. A second one builds the /status runtime payload from the bare double and validates it, failing with the offending field in the message. Mutation-tested: removing the four reasoning fields reproduces the original break and the canary names all four; answering None instead of the private slot names the seven private-only fields; restoring the blanket fallback fails the video chat-completions tests. All nine files that use the double pass, 110 tests. `(Python 3.13, rest)` is green here, against red on main. The two remaining red jobs are inherited from main and fixed elsewhere: the studio shard by unslothai#11065, and the python shard's kaggle launcher flake by unslothai#11085.
Answer /status the runtime fields a backend double cannot invent
Backend CIhas been red on main since af4e98e with three multi-accounttests asserting
{"detail":"Failed to get status"}, andRepo tests (CPU, studio)red alongside them. The message names neither the field nor the cause.af4e98e added four reasoning fields to
_InferenceRuntimeFields. They arenot Optional, which is right:
LlamaCppBackend.__init__sets_reasoning_budget = -1and_reasoning_budget_message = "", so the real backend never answersNone for them.
_llama_runtime_fieldsmirrors every field in that model off thebackend, public name first and the
_nameslot as a fallback, and the doublesin these tests answer None for anything nobody set. None is not a value those
four accept, so /status raised ValidationError and the route returned 500.
The PR is correct; the doubles were not.
What changed
FakeLlamaCppBackendnow carries the runtime surface /status mirrors, at thevalues
LlamaCppBackend.__init__gives them. The same block was beingre-declared by hand in the per-test fakes, which is exactly what the shared
double exists to end.
Fields the real backend holds only as
_nameare declared under that namehere, so the double claims nothing production cannot read. The blanket
__getattr__that several fakes carry defeated that fallback: answering Nonefor the public name hides the private slot that has the value. It lives on the
shared double now and defers to the private sibling before answering None, so
one contract covers every double instead of each one re-deriving it.
Coverage
The existing canary drives /chat/completions, which never reaches this. A
second one builds the /status runtime payload from the bare double and
validates it, failing with the offending field in the message.
Mutation-tested: removing the four reasoning fields reproduces af4e98e and
the canary names all four; restoring the blanket None
__getattr__names theseven private-only fields.