Repository navigation
Unsloth Studio / Desktop: linked instances get no tools unless the owner allows them, and the proxy relays only media - #12388
Draft
LeoBorcherding wants to merge 83 commits into
Draft
LeoBorcherding wants to merge 83 commits into
LeoBorcherding wants to merge 83 commits into
Conversation
…rve their models through /v1
…mote's own API; API page panel and details dialog
…w and grows on scroll, detail pane follows the newest request, no truncated labels
…what the caller receives
The rail, the settings row and the details dialog read only the first GPU, so a machine with an RX 6500 XT and an RX 5700 XT showed as one 4 GB card (and the settings row as 2x RX 6500 XT). They now name each card, sum the VRAM, and the dialog adds a Total VRAM line.
The rail groups cards by model and draws one VRAM cell per card in rows of up to 8. The details dialog puts Total VRAM first and scrolls the per-card list past two cards, numbering each card and wrapping long names instead of cutting them off.
…d images A half pill beside On Device switches the chat and Images pickers to a linked Unsloth Studio. Recommended and On Device then list that machine's models; a pick downloads and loads there through an allowlisted proxy that adds the instance's key server-side. /v1/images/generations forwards @name/model ids, and the Images page loads and generates on the machine its model came from.
A probe that timed out marked a reachable machine offline and the panel refused to list it. The panel now tries the machine's inventory and reports only a real failure. Fit, the header and the machine menu use every card's VRAM, since llama.cpp splits a GGUF across them.
…detectCapabilities The Images trigger names the linked machine with the cloud icon, as chat does for @-ids. The media filter used detectCapabilities without importing it.
…s on the tab row Linked quant rows use the local variant markup: mono label, downloaded tag, fit badge and size. The panel widens by the machine switch so All and Recent no longer wrap.
Main's contrast-slider scan covers the rail: its bar tracks now use the contrast-wash gain.
…d UI scale checks Read the media catalogs inside a function, since they come through the chat barrel and a module-scope read throws when the import cycle re-enters. Keep the picker's resolved memo named currentModel and call the linked-machine wrapper triggerModel, so the dropped-model label check finds the memo that consults the connections. The gallery delete test stubs ip(), which every image route goes through for the linked machine. The machine name's max width scales with --ui-space-scale.
/v1/models lists every linked instance's models as @name/id, embedding models included, but /v1/embeddings had no linked branch, so a client that picked one got the local embedding path or an error instead of the instance that serves it. It now resolves and forwards like completions does. Test added.
…CI contracts The Hebrew and Swedish overlays arrived with the merge of main and had none of the 61 linked-instance strings, which fails the strict i18n check. The linked-instance routes are owner-only installation objects, so the account isolation matrix skips them with that reason, as it does for NPU models. The usage-examples contract reads the filtered catalog set, the API page's overflow contract leaves the font-mono example request alone, and a blank line from the merge resolution is formatted away.
The proxy is behind the same installation-owner check as the other linked-instance routes, so it carries the same skip reason.
Image, speech and separation models carry a task, and none of their endpoints forwards a linked id, so advertising them sent a client that picked one to the local media runtime. They are left out until their endpoint forwards. Test added.
Image generation resolves and forwards a linked id here, so text-to-image rows stay in the linked catalog; speech and separation rows stay out.
The catalog filter ran after probe, so the status cards in Settings still listed media models as copyable ids. The filter now runs in probe, which both read. Test added.
…witch Picking a model on another machine moved progress polling, Stop and the gallery before the busy check, so Stop could go to the wrong machine. The switch is now refused while work is running. An idle switch kept the old machine's shelf, whose actions then went to the new machine; it is now dropped, any listing in flight is fenced, and the new shelf is fetched. Test added.
…gone A removed linked instance left its id stored, so every Images request went to its proxy and returned 404. Once the refreshed list lacks it, the page switches to this machine through the same path a pick takes; the list is force-refreshed on open so a removal in Settings is seen. Test added.
Chat completions ran the local tool admission before resolving a linked model, so on a managed install a full-access request to a linked model was refused here although the linked server applies its own policy. It now resolves first, as responses and messages already do. Test added.
… its body [skip ci]
…nk moves, and harden the /v1 relay and catalog read
LeoBorcherding
marked this pull request as draft
November 20, 2026 08:15
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #12093 (linked model picker), which builds on #12092 (linked instances). Review those first; the diff includes their commits until they merge.
Linking another machine (Colab, WSL, a PC on the LAN) makes its models usable here as
@name/model. Before this PR, the request was forwarded as-is, tool fields included. So any caller with an API key on this machine could ask@wsl/...forenable_tools: true, enabled_tools: ["python"], permission_mode: "off", and the remote would run that code with no prompt anywhere. This PR keeps tools off for a linked instance until its owner turns them on, and stops the proxy from serving a remote's HTML or scripts from this app's origin.What changes
forward()drops every tool field (enable_tools,enabled_tools,mcp_enabled,permission_mode,bypass_permissions,confirm_tool_calls,deep_research_armed) and sends an explicitenable_tools: false, so the remote's own default can't turn tools back on.linked_instance_tools_stripped, with the instance and the fields dropped.allow_toolscolumn, migrated in withDEFAULT 0, so existing links start with tools off.image/,video/,audio/,application/octet-streamandtext/event-streamkeep their type. Anything else, including a missing type or a body that claimed JSON and wasn't, goes out asapplication/octet-streamwithContent-Disposition: attachment.X-Content-Type-Options: nosniff, asandboxCSP andX-Frame-Options: DENY.Content-Dispositionis kept only on media types.Screenshots
Coming in a follow-up comment, from a full test pass on a second machine: Settings before and after, the Allow tools confirm, and the first-use notice in the chat and Images pickers.
Where it was run so far
Measured at
edd2f08172, on Windows 11 + R9700 (Unsloth Desktop debug build), with an Unsloth Studio instance in WSL2 Ubuntu 24.04 linked as@wsl.810655de03)edd2f08172)/v1/chat/completionsto@wsl/unsloth/Qwen3.5-0.8B-MTP-GGUFwithpythonenabled andpermission_mode: "off", asking it to write/tmp/unsloth_linked_probe@wsl; the file was writtenenable_tools,enabled_tools,permission_modestrippedtext/htmltext/html(local server returning HTML)test_linked_instances.py)Still to run, on the second machine:
@wslor a LAN instance with Allow tools on, to confirm tools still reach the remote when allowed. A unit test covers it, but there's no live run yet.Not in this PR
trycloudflare.comhostname is reused by someone else, they receive the instance's API key. The fix is to pin the remote's identity from/api/system; that's a follow-up.httpto a LAN address sends the key in cleartext. There's no warning for it yet.