Skip to content

Studio: recount tokens when status sync adopts a resident GGUF - #10467

Merged
danielhanchen merged 4 commits into
unslothai:mainfrom
claxman:fix/10337-api-load-token-recount
Oct 5, 2026
Merged

danielhanchen merged 4 commits into
unslothai:mainfrom
claxman:fix/10337-api-load-token-recount

Conversation

@claxman

@claxman claxman commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

The status poll in use-chat-model-runtime.ts only called refreshContextUsage after adopting a resident GGUF when params.checkpoint was empty (#10337). A local model loaded via API while Studio already had that checkpoint selected never took that path, so the bar stayed blank until the next completion.

The empty-checkpoint guard is gone. A blank bar with a known window and an active thread is enough, same as loadModel's already-resident tail.

.venv/bin/python -m pytest -q tests/studio/test_new_chat_context_recount.py::test_status_poll_adoption_reprices_when_a_local_checkpoint_is_already_selected passed. Replacing use-chat-model-runtime.ts with upstream/main failed assert 0 == 1 on counts.

Before / after

Same thread, Qwen3-0.6B GGUF already selected in Studio and loaded again through the API, tab refocused. On the merge base the context bar stays blank (no token count); with this PR it shows 37 / 4.1k.

Context bar before and after

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed the recount in use-chat-model-runtime.ts is still gated on an empty params.checkpoint on main, so a local model loaded through the API leaves the context bar blank until the next completion, which matches #10337. Will get this reviewed.

danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Sep 16, 2026
danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Sep 16, 2026
@danielhanchen danielhanchen self-assigned this Oct 4, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member

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

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 21059f8906 (this PR's 579fcc1b2)

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

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 21059f8906

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 21059f8906 (this PR's 579fcc1b2).

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.

3 participants