Skip to content

Studio: keep Switch Back visible for a snapshot-path chat - #10511

Merged
danielhanchen merged 11 commits into
unslothai:mainfrom
claxman:fix/10338-switch-back-selectable-alias
Oct 5, 2026
Merged

danielhanchen merged 11 commits into
unslothai:mainfrom
claxman:fix/10338-switch-back-selectable-alias

Conversation

@claxman

@claxman claxman commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #10338 (with #10447, which restored the saved context on Switch Back; the token count in that report is #10337).

A chat whose model was loaded from its HF cache folder is stamped with .../models--org--name/snapshots/<sha>, while the model picker lists the same model as org/name. ChatModelNotice compared the raw ids, so:

  • the "This chat was started on X / Switch back" bar never appeared for such a chat once another model was loaded,
  • when it did appear, it was labelled with the revision sha,
  • a chat stamped org/name showed the bar while the same model was resident under its snapshot path.

Changes:

  • chatModelIsResident and chatModelSelectableId treat a snapshot path, its repo id and another snapshot of the same repo as one model (exact picker id first). External external::<provider>::<id> and ollama-manifest: ids stay exact and case-sensitive.
  • Switch Back loads the live picker id, never a stale snapshot path.
  • The bar is labelled the way the picker labels the model (modelDisplayName).

Tests:

  • cd studio/frontend && node --experimental-strip-types --test tests/chat-remembers-its-model.test.ts: 30 pass; tsc --noEmit clean.
  • Live Studio on GPU: a chat stamped with the snapshot path of unsloth/Qwen3.5-0.8B-MTP-GGUF (Q4_K_M), no model loaded. The bar reads "This chat was started on Qwen3.5-0.8B-MTP-GGUF."; clicking Switch back loads unsloth/Qwen3.5-0.8B-MTP-GGUF Q4_K_M from that snapshot and the bar then hides.
  • Studio regression switchboard (auth, settings, model_picker, crawl, upstream_ci, inference_settings), base vs head: no regression.

Before / after

A saved chat stamped with an HF cache snapshot path of a model the picker lists by repo id, no model loaded. Before: no bar. After: "This chat was started on Qwen3.6-27B-MTP-GGUF." with Switch back (repo name, not the snapshot sha).

before after

@claxman
claxman requested a review from Imagineer99 as a code owner September 8, 2026 12:59
chatgpt-codex-connector[bot]

This comment was marked as resolved.

residentModelIdMatches lowercases opaque external ids, so a case-distinct
connection looked already resident. Two HF snapshots of the same repo also
never matched, so Switch Back still loaded a deleted path. Exact picker
match is unchanged; aliases now return the selectable id and skip externals.
Hub labels keep a trailing .gguf.

cd studio/frontend && node --experimental-strip-types --test tests/chat-remembers-its-model.test.ts
31 passed. Reverting both notice files to 47d40f5: 6 failed.
@claxman

claxman commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the three notes on 47d40f5.

External ids stay exact. residentModelIdMatches is skipped when either side starts with external::::, so Vendor/Qwen3.8-27B and vendor/qwen3.8-27b no longer collapse.

Switch Back now loads chatModelSelectableId: the exact picker id if it is still present, otherwise the live HF cache row for the same repo (matched through publicModelId). A deleted path is never passed to handleCheckpointChange.

The notice label uses externalModelLabel ?? modelDisplayName, so org/model.gguf keeps its suffix. publicModelId still strips it.

Ran cd studio/frontend && node --experimental-strip-types --test tests/chat-remembers-its-model.test.ts: 31 passed. With both notice files reverted to 47d40f5, 6 of those fail.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

ollama-manifest: references are opaque. residentModelIdMatches lowercases
them, so two manifests that differ only by case looked like one model.
Exact picker match is unchanged.

cd studio/frontend && node --experimental-strip-types --test tests/chat-remembers-its-model.test.ts
32 passed. Reverting chat-model-notice-switch.ts to eddf860: 1 failed.
@claxman

claxman commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the ollama-manifest note on eddf860.

sameHfCacheIdentity now skips isOllamaLinkPath the same way it skips external ids. Exact picker match is unchanged. Two manifests that differ only by case are not treated as one model.

Ran cd studio/frontend && node --experimental-strip-types --test tests/chat-remembers-its-model.test.ts: 32 passed. Reverting chat-model-notice-switch.ts to eddf860 fails the new ollama-manifest test.

@claxman

claxman commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

#10447 covers the load half of #10338: rememberedConfigFor goes through resolveResidentInitialConfig, so the saved context pin comes back instead of 4096. The visibility half is still on main: chat-model-notice.tsx:85 returns null when selectableModelIds does not contain createdModel.modelId, so a stamp whose id is not in that set never shows the bar. This branch resolves through chatModelSelectableId to the live picker id before that check. Code-read only, I have not run a live Switch Back. The missing token count in that report is #10337 / #10467, both still open.

@danielhanchen danielhanchen self-assigned this Oct 4, 2026
@danielhanchen
danielhanchen self-requested a review as a code owner October 4, 2026 12:51
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 4, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 4, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member

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

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 d9b7589143 (this PR's d9b758914)

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

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

Reviewed commit: d9b7589143

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror d9b7589143 (this PR's d9b758914).

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.

[Bug] Pressing "Switch Back" on a chat that was originally started with a local model, loads the model with 4096 context.

3 participants