Skip to content

Studio: preserve local GGUF reload identity - #6976

Closed
Etherll wants to merge 9 commits into
unslothai:mainfrom
Etherll:patch-7826
Closed

Etherll wants to merge 9 commits into
unslothai:mainfrom
Etherll:patch-7826

Conversation

@Etherll

@Etherll Etherll commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Preserves local GGUF identity when Studio reloads model settings, especially after changing Context Length. Expired native path tokens now stop at the UI with a reselect prompt instead of being sent back through the reload path.

Motivation

Local .gguf loads use short-lived native path tokens. The settings reload path treated those tokens like durable loaded-model identity, so Apply could try to reload with an expired token and lose the original GGUF source behavior.

Fixes #6855.

Changes

  • Adds activeNativePathTokenExpiresAtMs and shared GGUF/native-token helpers in studio/frontend/src/features/chat/stores/chat-runtime-store.ts.
  • Carries native token expiry through staged selections, native model chips, and model load input.
  • Blocks expired native-token loads in use-chat-model-runtime.ts and asks the user to pick or drop the .gguf again.
  • Updates Apply in chat-page.tsx to use a shared loaded-GGUF classifier and only pass a native path token when it is still usable.
  • Updates chat-settings-sheet.tsx to use the same loaded-GGUF classifier as the reload path.
  • Skips staged GGUF metadata fetches when the staged native token is already expired.
  • Adds tests/studio/test_chat_native_gguf_reload_contract.py to lock the reload/token-expiry contract.

@Etherll
Etherll requested a review from danielhanchen as a code owner July 8, 2026 12:29

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces tracking and handling of native path token expiration for local GGUF models across the chat interface, including automatic cleanup of expired tokens, validation during model loading/staging, and new contract tests. The review feedback suggests optimizing the token cleanup effect in chat-page.tsx by adding activeNativePathToken to the dependencies to prevent redundant timers and clamping the delay to avoid browser setTimeout overflow bugs.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Etherll Etherll mentioned this pull request Jul 8, 2026

@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: b91f7e387b

ℹ️ 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".

@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: 840fa31a88

ℹ️ 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".

@Imagineer99

Copy link
Copy Markdown
Member

Ran a focused check here: https://github.com/Imagineer99/unsloth/actions/runs/28958822605
Looks good, the native GGUF reload/token-expiry contract test passed: 6 passed.

@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: e8f02b9b26

ℹ️ 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".

Comment on lines +2712 to +2716
if (
isLoadedGguf &&
state.activeGgufVariant == null &&
!isDirectGguf &&
!hasNativeToken

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 Gate native GGUF reloads on token even when a variant exists

When a picked/dropped native GGUF has a quantized filename, the backend can report a derived gguf_variant from the file path, so activeGgufVariant is non-null even though the durable identity is still only the native path token. Fresh evidence beyond the prior basename issue is that this new guard skips the reselect branch whenever activeGgufVariant is set; after the 15-minute token expires, Apply then calls selectModel with the native display basename and no token, so the reload still goes down the invalid/wrong-file path instead of asking the user to reselect the file.

Useful? React with 👍 / 👎.

@Etherll Etherll closed this Jul 24, 2026
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.

[Bug] VRAM being ignored

2 participants