Skip to content

Studio Desktop: open the OS folder dialog to add a model folder - #13843

Merged
danielhanchen merged 6 commits into
mainfrom
studio-desktop-native-model-folder-picker
Oct 15, 2026
Merged

danielhanchen merged 6 commits into
mainfrom
studio-desktop-native-model-folder-picker

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Fixes #6369

Summary

On Unsloth Desktop, Browse for a model folder now opens the OS folder dialog (Explorer on Windows, Finder on macOS, the GTK / portal chooser on Linux) instead of the in-app folder browser. Desktop already does this for Change download location, Link a document folder and picking a GGUF file; the model folder buttons were the ones left on the in-app browser.

Covered buttons:

  • Model picker, Custom Folders: the section title, the search icon next to it, and the browse button beside the typed path box.
  • Hub, On-device folders dialog: the Browse button next to the path box.

The picked folder goes through the same addScanFolder call as a typed path or the in-app browser, so the server keeps validating it exactly as before.

What does not change

  • Unsloth Studio in a browser keeps the in-app folder browser. A web page cannot read the absolute path of a folder the user picks, and the server may be on another machine, so a native dialog cannot work there.
  • Managed (non-owner) accounts keep the in-app browser. The server confines their folders to their own workspace, so a dialog showing the whole host disk would only confuse them.
  • If the native dialog fails to open for any reason, the click falls back to the in-app browser, so Browse always does something.
  • Cancelling the dialog adds nothing. Picking a folder that is already registered returns the existing row, as before, so repeating the action is a no-op.
  • No layout, label or tooltip changes; the typed path box and the Add button are untouched.

Changes

  • studio/src-tauri/src/native_intents.rs: new pick_native_model_folder command. It shares one helper with pick_hugging_face_cache_dir (dialog, canonicalize, folder check, Windows \\?\ prefix stripped), so the two pickers return paths the same way. Same error strings as before.
  • studio/src-tauri/src/main.rs: register the command.
  • studio/frontend/src/features/native-intents/api.ts: pickNativeModelFolder(isOwner) returns the picked path, null on cancel, or undefined meaning "use the in-app browser".
  • pickers.tsx and on-device-folders-dialog.tsx: the Browse buttons call it and fall back to the in-app browser on undefined.
  • studio/frontend/scripts/check-bundle-budget.ts: the eager picker code adds 235 B raw / 336 B transfer to the startup set (6,777,794 -> 6,778,029 B raw, 2,037,725 -> 2,038,061 B transfer against 199987c, one machine and build, Node 24, chunk count unchanged at 95); the budget is raised by that growth, like the entries above it. Main itself is already 2,897 B raw / 904 B transfer over at 199987c without this PR, so bundle:check stays red until that is sorted on main.
  • tests/native-model-folder-picker.test.ts: desktop owner gets the picked path, cancel adds nothing, web app and managed accounts never invoke the command, a failing dialog falls back, every Browse button is wired, and the command is registered. tauri-core-stub.mjs gains an optional result so a stubbed invoke can return a value (existing users unaffected).

Testing

  • cargo check --locked --all-targets in studio/src-tauri: clean (4 existing warnings in other files).
  • npm run typecheck and npm run build: pass. npm test: 12360 / 12360 pass, including the new file; the bundle budget tests pass (43 / 43).
  • Reverting the button wiring, the API helper, or the command registration each turns the new test red.
  • Studio regression A/B (merge base vs head): auth, settings, model picker and crawl journeys NO_REGRESSION (39 SAME, two 0 px DOM-only diffs on pages this PR does not touch); inference settings NO_REGRESSION on a Colab T4.
  • Staging CI: Unsloth Tauri CI and Desktop app clean machine (Windows, macOS, Linux builds) pass. The Backend CI failures there (diffusion_measured_peaks.py encoding and calibration tests, test_diffusion_capability_labeled_image_video_gen) fail the same way on main at 199987c; this PR changes no Python.

Desktop before / after

Real Desktop debug builds of the merge base and this branch, launched under Xvfb and driven over WebDriver on the staging runner: Model hub, Downloaded tab, Add folder, then Browse locations. Main opens the in-app folder browser; this branch opens the native folder dialog (GTK on Linux; there is no window manager under Xvfb, so it has no title bar, but the X window list shows it titled "Choose a model folder").

Main This PR
Native folder dialog window no yes
In-app folder browser yes no

Desktop: Browse locations opens the in-app browser on main and the native folder dialog with this PR

Browse in the model picker's Custom Folders and in the Hub's on-device
folders dialog now opens the native folder dialog on the desktop app, the
same way Change download location already does. The web app, managed
accounts, and a native dialog that fails to open keep the in-app browser.

Fixes #6369
@danielhanchen danielhanchen self-assigned this Oct 15, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-15T11:50:00.722302Z 20bdf6a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T12:33:24.799913Z 4eff827 Manual request
🔒 Security Review ✅ Completed 2026-10-15T11:57:13.366673Z f58e164 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f58e164ba7

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

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: f58e164ba7

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 4eff827dbe

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

danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Oct 15, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Oct 15, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 15, 2026
@danielhanchen
danielhanchen merged commit 62e0636 into main Oct 15, 2026
@danielhanchen
danielhanchen deleted the studio-desktop-native-model-folder-picker branch October 15, 2026 14:38
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.

[Feature] Isn't it possible to use native OS Open dialog boxes for selecting new model directories? For example, native Windows Open dialog box.

1 participant