Skip to content

Studio: dismiss the llama.cpp update toast once the job finishes - #9199

Merged
danielhanchen merged 18 commits into
unslothai:mainfrom
indrajeetapache:studio/llama-update-toast-completes
Oct 6, 2026
Merged

danielhanchen merged 18 commits into
unslothai:mainfrom
indrajeetapache:studio/llama-update-toast-completes

Conversation

@indrajeetapache

@indrajeetapache indrajeetapache commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Clicking Update on the llama.cpp toast installs the new prebuilt, but the toast can stay on "Updating llama.cpp..." with a half-filled bar and no close button, even though the backend job already reports success. Reported in #9196.

The job poll is a 500 ms setInterval with an async body, so fetches overlap. A poll that left while the job was still running can resolve after a later poll already saw success and cleared the timer. It then sets applying back to true, and nothing is left polling to clear it.

Fix

Each poll checks it still belongs to the live timer before touching state; a response from a cleared or replaced poller is dropped. 5 lines in use-llama-update-check.ts, backend unchanged.

Verification

tests/llama-update-poll-race.test.ts drives the real hook with stubbed React and controlled fetch ordering (running poll resolves after the success poll). It fails on main (applying ends true) and passes here.

Fixes #9196

A late /update-status poll that left while the job was still running
could land after success and re-pin the Updating toast, which has no
close button. Ignore that stale snapshot, serialize the polls, and
drive the progress UI from the job state.

Co-authored-by: Cursor <[email protected]>
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@indrajeetapache

Copy link
Copy Markdown
Contributor Author

The update itself succeeded. By the time the toast was stuck, GET /api/llama/update-status already had job.state: "success", progress: 1.0, and update_available: false, and the new binaries were on disk. The log stopping at 90% is normal — _log_llama_update_progress() only logs while the job is still running. Restart clearing the card is just the frontend state resetting, not the backend doing anything different.

What's stuck is the in-progress UI: "Updating llama.cpp...", half-filled bar, no close button. That only shows while applying is true, and dismiss is intentionally hidden for the length of an update — so if applying gets stuck, the card has no way out.

On the tag mismatch: installed_tag is b10472 but latest_tag is b10472-mix-4b653db. That's display-only — detection already compares the full release identity via is_behind, which is why update_available was correctly false. After a restart those two tags are still different, and the toast doesn't come back. So it's not a tag-equality check keeping it pinned.

What actually pins it: /update-status can be slow , and the banner polls every 500ms with overlapping fetches. A poll that went out while the job was still running can land after a later poll already saw success, flip applying back on, and stop the timer. No dismiss button, so it sits there until reload.

Opened #9199 for this — serialize the polls, ignore a late running snapshot once we've already adopted the job as finished, and drive the progress UI off job.state so a stale applying flag can't pin the card

@danielhanchen

This comment has been minimized.

@indrajeetapache

Copy link
Copy Markdown
Contributor Author

@danielhanchen done—dropped banner override + updated test; kept hook-only fix

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

This comment has been minimized.

indrajeetapache and others added 2 commits August 20, 2026 16:37
Recheck availability after terminal jobs, order status responses by a client-side request sequence, and bound each serialized request so polling cannot remain latched.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Keep the job poll active when the immediate post-terminal status read fails, then stop only after a valid reconciliation arrives without repeating completion effects.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Assign each backend operation an opaque ID and key terminal reconciliation to it so a distinct job cannot be mistaken for a retry of an earlier terminal snapshot.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 20, 2026
@unslothai unslothai deleted a comment from Etherll Aug 20, 2026
Apply the client-side deadline only to serialized active-job polling while initial, reminder, and force-refresh discovery checks retain the backend timeout.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 20, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 20, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

This comment has been minimized.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 20, 2026
@Imagineer99

This comment has been minimized.

@chatgpt-codex-connector

This comment has been minimized.

@indrajeetapache

Copy link
Copy Markdown
Contributor Author

@danielhanchen, can you please review this change to determine whether this PR is still required?

@danielhanchen

This comment has been minimized.

Per review, drop the /update-job-status endpoint, the poll-orchestration source test, and the unrelated project-source-save comment edits. Keep the late-running-snapshot guard in the update hook.
@indrajeetapache

Copy link
Copy Markdown
Contributor Author

@danielhanchen — narrowed this per your suggestion.

Kept only the hook guard: a late running poll for a job already adopted as success / error is ignored, so it cannot re-set applying after the timer is cleared.

Dropped from this PR:

  • /update-job-status and the job_id polling
  • studio/frontend/tests/llama-update-poll-orchestration.test.ts
  • the unrelated comment deletions in studio/frontend/tests/project-source-save.test.ts

Rebased onto current main. Diff is now just the hook, llamaUpdateSnapshotIsStale, and the lifecycle test.

chatgpt-codex-connector[bot]

This comment was marked as outdated.

@shimmyshimmer

Copy link
Copy Markdown
Member

Review record for #9199, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#470.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror 9f0b0bbd6 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 9f0b0bbd65

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 9f0b0bbd6 (no equivalent commit found on this PR).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Minor Bug] llama.cpp update toast never completes and it stays pinned even after download is done

4 participants