Skip to content

Fix S3 tab flashing on reload - #7106

Merged
danielhanchen merged 2 commits into
unslothai:mainfrom
NilayYadav:fix-s3-tab-flash
Jul 14, 2026
Merged

danielhanchen merged 2 commits into
unslothai:mainfrom
NilayYadav:fix-s3-tab-flash

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

isVisionModel and isAudioModel weren't persisted, so the S3 tab would flash on reload until the model-config fetch re-derived them. Persist both flags to fix it.

@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 updates the training configuration store to persist the isAudioModel and isVisionModel state keys across page reloads, ensuring multimodal-only UI elements render correctly on reload. The reviewer suggests also persisting modelType to prevent UI flashing and preserve the user's step selection on reload.

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.

@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: 397e690e39

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

@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: 777cd03255

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

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@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: 777cd03255

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

Comment on lines +588 to +590
patch.isVisionModel = false;
patch.isAudioModel = false;
patch.isEmbeddingModel = 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 Clear persisted modelType on model switch

This reset clears the boolean capability flags, but modelType is now persisted and remains from the previous model until getModelConfig finishes. If a user switches from a vision/audio model to a text model and reloads before that fetch completes (or it fails), localStorage keeps the new selectedModel with the old modelType; DatasetSection treats modelType === "vision" || "audio" as multimodal and continues hiding/blocking S3 for the new model. Reset modelType along with these flags when selectedModel !== previousModel.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as the earlier thread, declined. modelType stays consistent with selectedModel through the category filtered picker, and modelDefaultsAppliedFor is not persisted, so ensureModelDefaultsLoaded re-derives modelType from the model-config fetch on every mount. The only non-self-healing case is a double config-fetch failure, which is an outage rather than well-formed input. Resetting modelType on switch would reintroduce the reload flash this PR removes and undo the Step 1 canProceed persistence.


// modelType / isVisionModel / isAudioModel persist so multimodal-only UI
// paints right on reload; the model-config fetch still re-derives them.
const NON_PERSISTED_STATE_KEYS: ReadonlySet<keyof TrainingConfigState> = new Set([

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Avoid rendering S3 for old persisted configs

Removing these keys from the non-persisted set only helps snapshots written after this build. Existing unsloth_training_config_v1 records at version 11 were created while modelType, isVisionModel, and isAudioModel were omitted, and the version is still 11, so on the first reload after upgrading they hydrate as null/false and the S3 tab still appears until getModelConfig finishes. Add a rehydration/migration path that treats missing capability fields for an already-selected model as unsettled so existing users get the no-flash behavior immediately.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Accurate that pre-existing v1 records lack these keys and flash once on the first reload after upgrading. A migration cannot fix that though: the capability fields cannot be backfilled without the model-config fetch, which is exactly the flash. Since modelDefaultsAppliedFor is not persisted, that fetch already runs on mount and settles the tab, so the transient is one-time and self-healing for existing users and gone for all state written afterward. Not worth a version bump here; a general fix would be gating the dataset source tabs on isLoadingModelDefaults, which is a separate UX change.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@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: 777cd03255

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

Comment on lines +586 to +590
// Reset capability flags so a mid-fetch reload can't persist the
// previous model's vision/audio flags against the new model.
patch.isVisionModel = false;
patch.isAudioModel = false;
patch.isEmbeddingModel = 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 Reset persisted modelType when switching models

When switching from a resolved vision/audio model to a different model, this set(patch) now persists the new selectedModel and reset flags, but leaves the newly-persisted modelType from the previous model in place. If the user reloads before getModelConfig finishes, or the fetch fails, localStorage can contain the new text model with modelType: "vision"/"audio", so DatasetSection/validateS3Source will keep hiding or rejecting S3 for the wrong model. Clear modelType in this same switch patch (or avoid persisting it) along with the capability flags.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same point as the two threads above, declined for the same reason. modelType is re-derived on every mount because modelDefaultsAppliedFor is not persisted, so ensureModelDefaultsLoaded refetches on load; the only non-self-healing case is a double config-fetch failure, which is an outage rather than well-formed input. Clearing modelType on switch would reintroduce the reload flash this PR removes and undo the Step 1 canProceed persistence.

@danielhanchen
danielhanchen merged commit bb80602 into unslothai:main Jul 14, 2026
36 checks passed
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.

2 participants