Skip to content

Re-check whisper after the llama phase, so it stops raising a second banner - #10026

Closed
danielhanchen wants to merge 1 commit into
mainfrom
fix/whisper-rechecked-after-llama-phase
Closed

danielhanchen wants to merge 1 commit into
mainfrom
fix/whisper-rechecked-after-llama-phase

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The two popups

routes/llama.py calls itself "the single main update item" and POST /api/llama/update really does chain a whisper phase. In practice you can still get two popups in a row, one for llama.cpp and then one for whisper.cpp.

The cause is ordering. The job plans every phase before any of them runs:

whisper_plan = _whisper_phase_plan(
    backend_request,
    llama_will_run = llama_spec is not None,
    ...
)

So whisper is judged against the llama build that is about to be replaced. A llama update that is itself what makes a newer whisper available, or what first makes one pairable, is invisible at that moment. The job finishes, the next poll sees whisper behind, and update_component flips:

status["update_component"] = (
    "llama" if status["llama_update_available"]
    else "whisper" if whisper_update_available
    else None
)

The frontend reads that single value straight into its label, so the same banner reappears naming whisper.cpp seconds after the llama one. dismiss() is only setVisible(false) with no memory of which component was dismissed, so closing the first does nothing about the second.

The change

Re-plan whisper once the new llama is in place and run it in the same job, instead of leaving it for the next poll to raise a banner about.

paired_llama_will_update is False by then, because it already did, so the plan consults the installer's read-only resolver and skips cleanly when no compatible whisper release exists rather than attempting an install that cannot succeed. That matters: the old code assumed the new llama would always supply a workable pairing, and the comment said so, but that assumption is exactly what failed while whisper stayed pinned to b10472-mix-4b653db and llama shipped b10639, b10672, b10679 and b10687.

Behaviour after this change matches the rule the update item was written for:

llama.cpp whisper.cpp result
behind behind one banner, one apply, both installed
behind current at plan time, behind after one banner, one apply, whisper picked up by the re-check
behind no compatible release one banner, whisper phase skipped with a reason, no second popup
current behind whisper-only banner, which is correct and already guarded

Two things it deliberately preserves

Skip reasons survive. A phase can now report a skip from its result, not only from its plan, so the breakdown still reads skipped: up_to_date or skipped: local_link rather than degrading into a success with an empty message. Deciding later must not mean explaining less. Without this, test_apply_llama_only_when_whisper_current and test_apply_skips_whisper_local_link_silently both broke, and they were right to.

The fail-open holds. The re-check is scheduled only when the probe actually produced a plan. An empty one means the piggyback is disabled or the probe failed, and re-importing the module there would undo the guard that keeps a broken whisper from taking a llama update down with it. test_llama_update_survives_unavailable_whisper_module catches exactly that, and caught it here.

Tests

  • the re-check re-plans with paired_llama_will_update = False and force_refresh = True, then installs
  • it is a no-op for up_to_date, paired_llama_unavailable, and a plan that claims an update but carries no phase, reporting a skip with the reason in each case
  • it is not scheduled at all when the whisper probe failed

test_combined_update.py and test_llama_backend_switch.py are 64 passed, and the wider update surface is 3847 passed. One unrelated failure, test_mlx_repair.py::test_install_requires_prebuilt_wheels, fails identically without this branch: it is a local huggingface-hub version mismatch, not a code defect.

Not in this PR

When both are behind, the banner still says only llama.cpp, even though the apply covers whisper too. Naming the union would mean changing update_component from a single Literal["llama", "whisper"] into something the frontend can render as both, which touches the status shape, the hook and the component. It is worth doing, but it is a separate change and it is cosmetic: with this fix the second popup is gone either way.

…banner

The combined update item plans every phase before any of them runs, so whisper is
judged against the llama build that is about to be replaced. A llama update that is
itself what makes a newer whisper available, or what first makes one pairable, was
therefore invisible at planning time. The job finished, the next poll saw whisper
behind, update_component flipped from llama to whisper, and the same banner came
straight back naming whisper.cpp. Two popups for what the code calls the single
main update item.

Re-plan whisper once the new llama is in place and run it in the same job.
paired_llama_will_update is False by then, so the plan consults the installer's
read-only resolver and skips cleanly when no compatible whisper release exists,
rather than attempting an install that cannot succeed. That is the pairing gap that
kept whisper pinned to b10472-mix-4b653db while llama shipped four releases.

Two things this deliberately preserves.

A phase can now report a skip from its result, not only from its plan, so the
breakdown still reads "skipped: up_to_date" or "skipped: local_link" instead of
degrading to a success with no message. Deciding later must not mean explaining
less.

The re-check is scheduled only when the probe produced a plan. An empty one means
the piggyback is disabled or the probe failed, and re-importing the module there
would undo the fail-open that keeps a broken whisper from taking a llama update
down with it.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-30T21:04:59.171445Z 1318dc6 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1318dc6155

ℹ️ 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 whisper_spec.get("repair")
else (lambda set_progress: _whisper.run_chained_phase(whisper_spec, set_progress))
)
elif backend_request is None and llama_spec is not None and whisper_plan:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Schedule the late recheck only for eligible whisper plans

When whisper is a local link, source build, or not installed, chained_phase_plan() still returns a nonempty plan with no runnable phase, so this condition turns a permanent skip into a runnable late phase. Consequently the job announces that it is installing both llama.cpp and whisper.cpp, reserves 30% of progress for whisper, and initially reports whisper as pending even though the installation is unmanaged and can only be skipped. Restrict the recheck to plans whose state can actually change after the llama update, such as skip_reason == "up_to_date".

Useful? React with 👍 / 👎.

is reported as a skip carrying the plan's reason, so the phase breakdown reads the
same as it did when the decision was made before the job started.
"""
plan = chained_phase_plan(force_refresh = True, paired_llama_will_update = False)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the post-llama probe fail-open

If this second status probe raises after the llama installer has succeeded—for example because binary discovery, marker inspection, or another optional whisper status dependency fails—the exception escapes directly into run_chained_update(), which marks the whole combined job as an error with whisper.cpp update failed. The initial probe is deliberately protected by _whisper_chain_status() so whisper cannot break a llama update, but this newly added direct call bypasses that guard; catch probe failures here and return a skipped result so an optional recheck cannot turn an already successful llama replacement into a failed job.

Useful? React with 👍 / 👎.

is reported as a skip carrying the plan's reason, so the phase breakdown reads the
same as it did when the decision was made before the job started.
"""
plan = chained_phase_plan(force_refresh = True, paired_llama_will_update = False)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reuse the macOS compatibility result during the recheck

On macOS, this forced chained_phase_plan() call runs the host resolver once inside get_update_status() to choose the compatible release and then runs it again at the slim-pairing gate because force_refresh=True bypasses the memo both times. Besides adding another potentially 60-second subprocess after llama finishes, a transient failure of only the second call returns paired_llama_unavailable and skips installation while leaving the first successful resolver result cached; the next non-forced status poll reuses that cached result, reports whisper behind, and raises the exact second banner this change is intended to prevent. Reuse the resolver payload from the status calculation rather than forcing a second independent probe.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member Author

Closing this: the reason I gave for it does not hold.

I claimed a llama update can newly expose a whisper update, which is what produced the second banner. It cannot. whisper_cpp_freshness carries no reference to llama at all, so whisper's update_available is a straight comparison of the installed tag against the latest whisper release, and a llama update cannot flip it from up_to_date to behind. In the both-behind case the existing code already chains whisper correctly, since the slim pairing gate is deliberately skipped when llama is updating. The sequence described in the body does not occur.

There is a real defect underneath, but it is a different one: when llama updates to a build with no paired whisper release, the plan skips the pairing gate on the grounds that the llama phase will supply a workable pairing, the whisper phase then attempts an install that cannot succeed, the installer exits 2, and the whole job reports failure after llama already landed. That is the state the pipeline was in while whisper stayed on b10472-mix-4b653db through four llama releases.

Reopening that as a narrow change that does only the pre-flight, rather than the re-planning this PR grew into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant