Repository navigation
fix(studio): stop false MTP/vision capability reports - #7332
danielhanchen merged 13 commits into
Conversation
MTP probing only inspected the first physical --spec-type help line and treated empty/crash --help output as "lacks MTP", which false-warned on otherwise capable builds. Parse the full --spec-type help block, fail open when the probe is inconclusive, and stop blaming bare mmproj crashes on a projector-format mismatch when the text-only retry also fails. Fixes unslothai#7302
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 001091d9bd
ℹ️ 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".
| if saw_spec_type: | ||
| supports_mtp = mtp_token is not None | ||
| else: | ||
| supports_mtp = True # fail open for UI/warning; mtp_token stays None |
There was a problem hiding this comment.
Don't mark successful no-spec probes as MTP-capable
When llama-server --help succeeds but the binary is old enough to have no --spec-type flag at all, this fail-open path returns supports_mtp=True and mtp_probe_inconclusive=True. /status uses supports_mtp directly for the llama_cpp_supports_mtp field, and startup warnings are now gated on not mtp_probe_inconclusive, so genuinely pre-MTP builds stop recommending unsloth studio update until a model load later falls back. Empty/crashed probes should fail open, but a nonempty successful help dump with no --spec-type is a definitive lack of MTP support.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed both Codex items on fix/7302-llama-cpp-vision-mtp-reporting:
P1 — No-spec successful probes (supports_mtp accuracy)
Probe now has three outcomes: (1) --spec-type block present → supports_mtp = (mtp_token is not None), (2) nonempty --help with no --spec-type → definitive supports_mtp=False, mtp_probe_inconclusive=False, (3) empty/crash → supports_mtp=False, mtp_probe_inconclusive=True (startup banner still suppressed via inconclusive flag).
P2 — Inconclusive probe at MTP load
_emit_mtp() checks mtp_probe_inconclusive: inconclusive probes load with --spec-default but do not set spec_fallback_reason=binary_no_mtp or emit the false "lacks MTP" warning.
/status no longer fail-opens to supports_mtp=True on probe exceptions.
pytest studio/backend/tests/test_llama_cpp_mtp_detection.py — 252 passed.
| "mtp_token": mtp_token, | ||
| "supports_mtp": mtp_token is not None, | ||
| "supports_mtp": supports_mtp, | ||
| "mtp_probe_inconclusive": not saw_spec_type, |
There was a problem hiding this comment.
Preserve inconclusive state when MTP is requested
For an empty or crashing --help probe this new field records the probe as inconclusive, but the MTP launch path still checks only caps.get("mtp_token"); with mtp_token=None it logs that llama-server "lacks --spec-type mtp/draft-mtp", sets binary_no_mtp, and disables speculative decoding. That means the startup banner no longer fires, but the same false lack-of-MTP report still appears as soon as an MTP model is loaded under exactly the inconclusive-probe scenario this change is trying to handle.
Useful? React with 👍 / 👎.
…7302) Treat nonempty --help without --spec-type as definitive no-MTP, keep only empty/crash probes inconclusive, skip binary_no_mtp UI hint on inconclusive loads, and stop reporting supports_mtp=True in /status for unknown probes.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b252a1c7dd
ℹ️ 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".
| elif help_nonempty: | ||
| supports_mtp = False | ||
| mtp_probe_inconclusive = False |
There was a problem hiding this comment.
Treat failed help probes as inconclusive
When llama-server --help exits nonzero but prints any stdout/stderr without --spec-type (for example a dynamic-loader error, illegal-instruction message, or crash diagnostic), subprocess.run(..., check=False) returns normally and help_nonempty is true, so this branch records mtp_probe_inconclusive=False and re-enables the false “lacks MTP/update llama.cpp” path for a probe that actually failed. Please gate the definitive no-MTP result on a successful help exit, or keep nonzero help outputs inconclusive.
Useful? React with 👍 / 👎.
Gate definitive no-MTP results on a zero exit code so crash diagnostics with nonempty stderr do not re-enable the false lacks-MTP warning path.
|
Fixed in 29110ce. P2 — Treat failed help probes as inconclusive: Valid. Definitive no-MTP results now require Tests: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29110cea34
ℹ️ 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".
| else: | ||
| supports_mtp = False | ||
| mtp_probe_inconclusive = True |
There was a problem hiding this comment.
Preserve inconclusive MTP status
When --help is empty, crashes, or times out, this branch records mtp_probe_inconclusive=True but still stores supports_mtp=False. The fresh evidence in this version is that /status still exposes only this boolean (llama_cpp_supports_mtp) without carrying the inconclusive bit, while the response schema documents False as a reason to recommend updating, so clients can still see a definitive “no MTP” result for exactly the inconclusive probe path this patch is trying not to report. Please either fail-open the exported boolean for inconclusive probes or add/pass through an explicit unknown state.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid but latent: the frontend drives the update affordance from spec_fallback_reason (correctly None when inconclusive) and does not read llama_cpp_supports_mtp. Threading the inconclusive bit into /status is a follow-up.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a9bd0b0ed
ℹ️ 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".
| else: | ||
| supports_mtp = False | ||
| mtp_probe_inconclusive = True |
There was a problem hiding this comment.
Preserve fail-open MTP status for inconclusive probes
When --help crashes, times out, or produces no usable output, this marks the probe inconclusive but still returns supports_mtp=False. /status directly maps that field to llama_cpp_supports_mtp (routes/inference.py:5814), whose API contract treats False as a definitive lack of MTP and recommends an update. Thus a capable binary with an inconclusive probe continues to be falsely reported as lacking MTP—the case this change is intended to avoid. Keep the public capability status fail-open for this case, or expose and consume an explicit tri-state/inconclusive value.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 20ec723: /status now reports llama_cpp_supports_mtp fail-open when the probe is inconclusive; only a definitive lacks-MTP probe or a missing binary reports False.
Resolve llama_cpp.py conflict: keep upstream signal-crash guard on text-only mmproj retry and PR branch _retry_detail classification.
|
Ready for review — undrafted after @danielhanchen's commits on ``. Maintainer changes incorporated; awaiting CI + review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc837425ff
ℹ️ 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".
| flags.append("--spec-default") | ||
| self._speculative_type = "default" | ||
| self._spec_fallback_reason = "binary_no_mtp" | ||
| if inconclusive: | ||
| self._spec_fallback_reason = None |
There was a problem hiding this comment.
Don't disable MTP after an inconclusive probe
When llama-server --help crashes, times out, or prints nothing, the probe now records mtp_probe_inconclusive=True, but this branch still appends --spec-default before suppressing the fallback reason. In that exact inconclusive-probe case on a capable binary with an MTP model, Studio silently launches without speculative decoding and also hides the update/fallback hint, so users lose MTP until a successful help probe. Please fail open here by attempting MTP and relying on the existing startup retry on real failure, or expose an explicit unknown state instead of forcing --spec-default.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Cannot fail open here: an inconclusive probe means the accepted enum token (draft-mtp vs mtp) is unknown, and guessing a wrong --spec-type value makes llama-server fail to launch entirely, which is strictly worse than loading without speculation. --spec-default is required to override an inherited LLAMA_ARG_SPEC_TYPE.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20ec723b0e
ℹ️ 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".
| _supports_mtp = bool( | ||
| _caps.get("supports_mtp", False) | ||
| or _caps.get("mtp_probe_inconclusive", False) |
There was a problem hiding this comment.
Report a missing llama-server as lacking MTP
When binary discovery fails, probe_server_capabilities(None) returns found=False, supports_mtp=False, and mtp_probe_inconclusive=True; this or consequently reports llama_cpp_supports_mtp=True even though no server exists that could run MTP. The response model documents False as the update recommendation signal, and before this change the missing-binary case correctly produced False, so installations without llama.cpp now receive a false capability report.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 36f9612: fail-open now additionally requires found=True, so a missing binary reports False again.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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 |
|
@codex review |
|
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". |
|
Reviewed and verified. llama.cpp based models were falsely reporting MTP and vision capability, which misled the UI. This detects capability from the actual spec help output and fails open safely when the probe cannot run. Ran the MTP detection and mmproj fallback suites (316 tests) and simulated the probe success, failure, and unknown spec paths. Codex review converged with no open items. Good to merge. |
Summary
Fixes #7302 — Studio could warn that the llama.cpp prebuilt “lacks MTP support” and report vision loads as “Vision projector incompatible…” even when those conclusions were wrong.
MTP false warning
probe_server_capabilitiesonly inspected the first physical--helpline containing--spec-type. Builds that put the enum on the indented description line were treated as missing MTP. Empty/--helpcrashes were also treated as “lacks MTP” instead of inconclusive.Fix: parse the full
--spec-typehelp block; only claim missing MTP when that enum is clearly present withoutmtp/draft-mtp; fail open (supports_mtp=True,mtp_probe_inconclusive=True) when the probe is inconclusive so the startup banner does not fire.Vision misreport
A bare
llama-servercrash with--mmproj(common on some ROCm/driver paths) still correctly retries text-only, but if that retry also failed the user was told the projector format was incompatible.Fix: keep the historical wording only for confirmed projector-format errors; otherwise report a crash-with-
--mmprojfailure.Test plan
tests/test_llama_cpp_mtp_detection.py(multiline help, empty/crash fail-open, outdated still reports false, real b10069 probe)tests/test_llama_cpp_mmproj_fallback.py(retry messaging contract)tests/test_llama_cpp_props_readback.py/root/.unsloth/llama.cpp/llama-server(version: 10069,mtp_token=draft-mtp);_run_llama_cpp_startup_probesprinted no MTP lacks-support WARNINGUnknown projector typeabort still surfaces the historical projector message_is_projector_incompatibilitymatches the Gemma-4 old-build abort;_mmproj_retry_failure_message(projector_confirmed=True)still starts withVision projector incompatible with this llama.cpp build...