Skip to content

Add Agents settings tab for unsloth start - #7303

Merged
danielhanchen merged 17 commits into
mainfrom
studio-settings-agents-tab
Jul 26, 2026
Merged

danielhanchen merged 17 commits into
mainfrom
studio-settings-agents-tab

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a new Agents tab under Studio Settings that documents the unsloth start command in one place, so users can connect coding agents to a locally served model without leaving the app.

The tab covers:

  • Quickstart to launch an agent against the first available local model.
  • Supported agents (Claude Code, Codex, Hermes, OpenClaw, OpenCode, Pi), each with a click-to-copy unsloth start <id> command and an icon. Claude Code and OpenAI Codex use the official Anthropic and OpenAI logos from the provider-logos registry; agents without an official asset use a brand-colored monogram tile. Agent CLIs found on PATH are badged as Installed (via the existing /api/settings/coding-agents endpoint).
  • Choosing a model: quantization suffix vs. explicit --gguf-variant.
  • Common options in a two-column flag/description layout.
  • Remote Studio connection, agent argument pass-through, and a dry-run preview.

Every command block is copy-paste ready.

Also

  • Removes the "New" badge from the System and Chat tabs.
  • Adds the Agents tab to the settings search index so its sections are findable.
  • Inverts the Ollama and OpenRouter provider logos in dark mode so their monochrome marks stay visible (previously only OpenAI was inverted).
  • Adds English strings under settings.agents. Other locales fall back to English, and check-parity.ts passes.

Notes

  • All new user-facing text lives in en.ts; no strings are hardcoded in the component.
  • No new logo assets are added. Only Claude Code and OpenAI Codex have official logos in the registry today; Hermes, OpenClaw, OpenCode, and Pi keep the monogram fallback until proper assets are available.

Testing

  • tsc -b passes with no errors.
  • npm run build succeeds.
  • npx tsx src/i18n/check-parity.ts passes.

Adds a Settings > Agents tab documenting the `unsloth start` command:
quickstart, supported agents with click-to-copy commands, model
selection, common options, remote Studio setup, argument pass-through,
and a dry-run preview. Agent CLIs found on PATH are badged as installed.

Also removes the "New" badge from the System and Chat tabs.

@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 a new 'Agents' tab in the settings dialog, allowing users to connect coding agents like Claude Code and Codex to local models running in Unsloth. It includes search index integration, store updates, and localization support. The review feedback highlights several improvement opportunities: managing copy timeout references with useRef in InlineCommand and CommandBlock to prevent race conditions and memory leaks, correcting a conditional check in AgentsTab to avoid showing a 'none detected' message if the API call fails, and removing unused translation keys from the localization file.

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.

Comment thread studio/frontend/src/i18n/locales/en.ts Resolved
…dark mode

Claude Code and OpenAI Codex now use the Anthropic and OpenAI logos from
the provider-logos registry; agents without an official asset keep the
monogram tile. Also inverts the Ollama and OpenRouter logos in dark mode
so their monochrome marks stay visible.
The in-tab header now reads "Agents (unsloth start)" while the sidebar
label stays "Agents". Reorders the tab to sit below Connections.

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

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


useEffect(() => {
let cancelled = false;
loadCodingAgents()

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 Guard PATH badges to local desktop sessions

When Studio is opened from a normal browser against a remote/tunneled backend, this endpoint probes the backend host's PATH, not the user's machine where the copied unsloth start command will run. The existing API examples avoid that with canUseLocalAgentDetection, but this unconditional call can mark agents as Installed (or not installed) based on the server environment, so the badges become misleading for remote Studio users.

Useful? React with 👍 / 👎.

Comment thread studio/frontend/src/i18n/locales/en.ts Resolved
…te snippet

- Only probe agent PATH in the desktop app on a loopback backend, so
  Installed badges are not driven by a remote server's environment.
- Show the "none found" note only when detection actually ran and
  returned empty, not when the call failed.
- Share one copy hook that resets its timeout on rapid clicks and clears
  it on unmount.
- Render the Remote Studio snippet with PowerShell syntax on Windows.
- Note that --no-launch can still load a model when --model is set.
- Drop unused quickstart translation keys.

@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: 853c66c002

ℹ️ 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 thread studio/frontend/src/i18n/locales/en.ts Resolved
…7303)

- Pick the remote snippet shell from the client platform, not the server deviceType
- Single-line the model examples so they paste in POSIX, PowerShell and cmd
- Split the pass-through block into independent one-command copies
- Derive detection visibility instead of clearing state in the effect
- Announce copy success to assistive tech
- Correct the quickstart/model copy: bare start uses the loaded model

Copy link
Copy Markdown
Member

Useful discoverability improvement and a good base for #7312. Frontend checks pass, but the Codex and GGUF requirement could be clearer. I’d merge this before #7312 or combine the two.

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

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

{ flag: "--yolo", descKey: "settings.agents.options.yolo" },
];

const QUICKSTART_CMD = "unsloth start claude";

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 Target the current Studio server in quickstart

When Studio is running anywhere other than the default local http://127.0.0.1:8888 (for example a custom port, HTTPS loopback, tunnel, or remote host), copying this quickstart command does not connect to the Studio instance the user is viewing; unsloth start falls back to its default unless UNSLOTH_STUDIO_URL is set. The API examples already build commands from the active base URL, so this tab should do the same or clearly scope the quickstart to the default local server.

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.

The quickstart is scoped to the default local Studio server, whose default port is also 8888, so the shown command is correct for that default. The Connect to a remote Studio section documents UNSLOTH_STUDIO_URL for custom ports, tunnels, and remote hosts. Building the one-liner from the live server URL is a reasonable enhancement but not a correctness fix, so leaving it.

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

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

</span>
) : null}
</div>
<InlineCommand command={`unsloth start ${agent.id}`} />

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 Require a GGUF model before offering Codex launch

When the currently loaded Studio model is not GGUF, copying the Codex row produces unsloth start codex, which fails because the Codex command unconditionally runs _require_gguf_for_codex after connecting. This is especially misleading because the Quickstart text tells users to swap claude for any supported agent; the existing API usage panel already explicitly excludes Codex from automatic selection unless the active model is GGUF. Disable/badge this command for non-GGUF models or state and enforce the requirement in this tab.

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.

Good catch, and the precedent argument is right: usage-examples.tsx already gates Codex on the loaded model being GGUF, citing the same _require_gguf_for_codex preflight, and this tab did not. Fixed in 6a2ede9: the Codex row now shows a "Needs a GGUF model" badge when the active model is not GGUF, using the same three-signal check (activeGgufVariant, activeNativePathToken, ggufContextLength) that panel uses.

@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: 6a2ede9a20

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

</span>
) : null}
</div>
<InlineCommand command={`unsloth start ${agent.id}`} />

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 Target copied commands at the active Studio server

When the desktop app falls back to a port other than 8888, or the UI is attached to any non-default Studio base, these bare commands still make unsloth start probe its default http://127.0.0.1:8888 rather than the server containing the loaded model. The desktop supports ports 8888–8908, and the existing API usage panel already avoids this failure by passing serverUrl ?? origin through buildAgentCommand; use the same base-aware generation for these rows and the other hardcoded quickstart/example commands.

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.

Confirmed and fixed in 648ffc9. The desktop backend really does scan 8888-8908 (DESKTOP_PORT_START/DESKTOP_PORT_END in desktop_backend_owner.rs), so a bare command probes the wrong server whenever it falls back off 8888. The quickstart and the per-agent rows now go through buildAgentCommand with serverUrl ?? origin, same as the API usage panel, so they stay bare for the default local server and set UNSLOTH_STUDIO_URL otherwise. This supersedes my earlier reply on the previous version of this item, which only considered the default-port case. The --model example strings are still literal, since they illustrate the flag rather than being the copy-and-run entry point.

{SUPPORTED_AGENTS.map((agent) => (
<div
key={agent.id}
className="flex items-center justify-between gap-4 py-2.5"

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 Stack agent rows on narrow settings dialogs

On phone-width layouts, this row cannot shrink enough when badges are present: the command chip, icon, gaps, and the non-shrinking “Needs a GGUF model” badge already exceed the roughly 272–327 px content width, and an Installed badge makes it wider still. The settings main panel consequently gains horizontal overflow and clips or forces sideways scrolling specifically for the Codex row; switch this row to a stacked/wrapping layout at max-sm rather than keeping every element on one line.

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.

Right, and it was my badge that pushed it over: the row was a single-line flex and both badges are shrink-0, so the Codex row could not fit narrow content widths. Fixed in 648ffc9 by letting the row wrap (flex-wrap with gap-x/gap-y) so the command chip moves to its own line instead of overflowing the panel.

Comment on lines +106 to +107
agents: [
"settings.agents.quickstart.title",

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 Index the Agents tab's command terms

The settings search only checks the sidebar label (Agents) and the strings in this array, but none of these section titles contains unsloth, Claude, or Codex. As a result, searching for the visible heading “Agents (unsloth start)” or either prominently advertised agent returns no Agents-tab result. Include settings.agents.title and settings.agents.description in the index so the tab is discoverable by the terms rendered at its top.

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.

Confirmed and fixed in 648ffc9. The index only held section titles, none of which contain unsloth, Claude or Codex, while the tab heading is "Agents (unsloth start)" and the description names both agents. Added settings.agents.title and settings.agents.description to the agents entry so those terms find the tab.

@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: 648ffc9c18

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

// default 127.0.0.1:8888 instead of the server holding the loaded model.
// buildAgentCommand keeps the bare form for the default local server and
// sets UNSLOTH_STUDIO_URL otherwise, matching the API usage panel.
const commandBase = serverUrl ?? origin;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Target the browser-reachable Studio in copied commands

When Settings is opened through a Cloudflare tunnel or reverse proxy, /api/health still reports the backend's direct server_url (often http://127.0.0.1:8888), so preferring serverUrl over window.location.origin makes every quickstart and agent-row command connect to the user's own localhost instead of the Studio currently displayed. Browser sessions should use the public/current origin (or the reported tunnel URL), reserving the direct backend URL for the desktop app.

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.

Confirmed and fixed in 5075a69. /api/health reports the backend's own server_url, so behind a tunnel or reverse proxy a browser session was being handed the user's localhost. The base is now isTauri ? serverUrl : origin, so the browser uses the origin it is viewing and the desktop keeps the reported backend URL, matching what the command builder in #7312 already does.

Comment on lines +298 to +299
const agentCommand = (agentId: string) =>
buildAgentCommand(commandBase, null, commandOs, agentId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include credentials in non-loopback agent commands

For any non-loopback Studio, passing null as the key causes buildAgentCommand to emit only UNSLOTH_STUDIO_URL=... unsloth start <agent>; it adds --api-key only when a key is supplied. Consequently, the advertised click-to-copy quickstart and every supported-agent command fail authentication for a user's first remote connection unless that CLI already happens to have a remembered key or ambient UNSLOTH_API_KEY.

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.

Confirmed and fixed in 5075a69. buildAgentCommand only appends --api-key when a key is passed and the base is non-loopback, so a null key silently dropped credentials for every remote command. It now passes the sk-unsloth-... placeholder used elsewhere in this tab, so a remote command shows the --api-key flag to fill in. Default local commands stay bare.

@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: 5075a69540

ℹ️ 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 +109 to +110
"settings.agents.title",
"settings.agents.description",

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 Index the intro text for agent-name searches

When a user searches Settings for Hermes or OpenCode, the new Agents tab is omitted because those names occur only in settings.agents.intro (en.ts), while this index includes the title and description but not the intro. Add the intro key so the agent-name searches described by the adjacent comment actually find the tab.

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.

Right, and the comment above the list already claimed the intro was covered while the code did not index it. Fixed in 1e64e80: settings.agents.intro is now indexed, so Hermes and OpenCode find the tab. The description only names Claude Code and Codex.

Comment on lines +128 to +130
className="inline-flex shrink-0 items-center gap-2 rounded-md border border-border bg-muted/40 py-1.5 pl-2.5 pr-2 font-mono text-xs text-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring dark:bg-white/[0.04]"
>
<span className="whitespace-nowrap">{command}</span>

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 Constrain long inline commands to the settings width

When Studio is opened through a non-loopback hostname, agentCommand includes the full origin and API-key placeholder, but this button is shrink-0 and its command text is whitespace-nowrap. On mobile or a narrow settings dialog, that makes the chip wider than the panel and can push the copy affordance outside the viewport; allow the chip to shrink and truncate or horizontally scroll its command text while keeping the icon reachable.

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.

Confirmed and fixed in 1e64e80. A non-loopback base now adds the origin and the key placeholder, so the chip could exceed a narrow panel while it was shrink-0 with nowrap text. The button is now min-w-0 max-w-full and the command text truncates, so the copy icon stays reachable.

@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: 1e64e80282

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

const agentCommand = (agentId: string) =>
buildAgentCommand(
commandBase,
REMOTE_API_KEY_PLACEHOLDER,

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 Avoid copying a placeholder as the remote API key

When Studio is opened through any non-loopback browser origin, buildAgentCommand appends this literal placeholder as --api-key sk-unsloth-... to every Quickstart and supported-agent command. The CLI treats any explicit key as authoritative in _agent_api_key, so the copied command proceeds with the fake credential and fails authentication rather than consulting a saved key or explaining that replacement is required. Supply a real key, omit the flag so the CLI can use a saved credential, or clearly require replacement before presenting these commands as copy-ready.

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.

Confirmed and fixed in 29e5856. _agent_api_key returns an explicit key for any base it did not auto-start, and it also calls _remember_key for that base, so the placeholder would have been cached and would overwrite a key the user had already saved. The commands no longer pass --api-key, which lets the CLI replay its saved key, and the Connect to a remote Studio section still covers exporting UNSLOTH_API_KEY for a first connection. This supersedes the earlier item asking for the flag to be shown: a fake credential is worse than omitting it, since it both fails auth and poisons the cache.

@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: 29e585675b

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

// ("unsloth start", the agent names); the section titles below do not.
"settings.agents.title",
"settings.agents.description",
"settings.agents.intro",

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 Make agent-name search results target a labeled element

When a user searches for an agent name such as “Claude” or “Hermes,” this intro string is the only matching indexed entry, but the rendered intro has no data-settings-label. SettingsDialog therefore cannot find the exact pending entry to scroll to, and if the shared settings pane was already scrolled down, it opens the long Agents tab at that retained position with the matched text off-screen. Index this as a tab-only match or add a matching settings label to the intro.

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.

Confirmed and fixed in b5ac032. settings-dialog scrolls by querying [data-settings-label], and the heading, description and intro carried none, so an indexed match had nothing to scroll to. All three now carry data-settings-label, following the same pattern profile-tab uses for its indexed title and description.

// treats an explicit one as authoritative and caches it per base, so a
// placeholder would overwrite a working saved key. Omitting the flag lets it
// replay the saved key; the remote section below covers first-time setup.
const commandBase = isTauri ? serverUrl : origin;

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 Use the active desktop API base before health resolves

When the desktop backend is running on a fallback port such as 8889, the interactive app becomes available as soon as desktop authentication succeeds, while the forced health request that populates serverUrl is still asynchronous. If the Agents tab is opened and a command is copied during that interval—or if that health refresh fails—commandBase is null, so buildAgentCommand falls back to bare unsloth start, which probes 127.0.0.1:8888 instead of the backend holding the loaded model. Use the already-selected Tauri API base as the synchronous fallback rather than waiting for serverUrl.

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.

Confirmed and fixed in b5ac032. serverUrl is filled by an async health request, so before it resolved (or if it failed) the base was null and the command fell back to the bare form pointing at 8888. It now falls back to getApiBase(), which is the base the app is already talking to, so a fallback port such as 8889 is used immediately.

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

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

// ("unsloth start", the agent names); the section titles below do not.
"settings.agents.title",
"settings.agents.description",
"settings.agents.intro",

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 Index every supported agent name

When a user searches Settings for OpenClaw or Pi, the Agents tab is not returned because search examines only these translated values, while those two names exist solely in the hard-coded SUPPORTED_AGENTS array; the indexed intro names only Claude, Codex, Hermes, and OpenCode. Add every supported agent name to an indexed translation value or derive searchable entries from the supported-agent list.

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.

Right, OpenClaw and Pi only existed in the hard-coded SUPPORTED_AGENTS list, so neither name was reachable from search. Fixed in 7bd7553: settings.agents.intro now names all six agents, and that key is both indexed and carries data-settings-label, so a match scrolls to a real target. A separate names-only key would have indexed fine but had nothing to scroll to, which is the problem the previous round just fixed.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 7bd75537c9

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

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: 853ed1a840

ℹ️ 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 +176 to +177
const MODEL_SUFFIX_CMD =
"unsloth start codex --model unsloth/gemma-4-E2B-it-GGUF:UD-Q4_K_XL --context-length 32768";

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 Target the active Studio in every copied command

When Studio is reachable anywhere other than the default 127.0.0.1:8888—notably when the desktop app falls back to ports 8889–8908—this copied model command omits UNSLOTH_STUDIO_URL, as do the passthrough and dry-run examples, while only the supported-agent rows use buildAgentCommand. The CLI therefore probes port 8888 and can fail or attach/load the model against a different service instead of the Studio instance displaying this tab; build these examples from commandBase as well.

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.

Confirmed and fixed in afbcd9c. Only the agent rows and the quickstart went through buildAgentCommand; the model, passthrough and dry-run blocks were hard-coded strings, so on the desktop port fallback (8889-8908) or a remote Studio they probed 127.0.0.1:8888. They are now built from the same commandBase via a small example() helper. Checked the output: with the default 127.0.0.1:8888 base the strings are byte-identical to before, and on 8889 they carry UNSLOTH_STUDIO_URL in both the POSIX and PowerShell forms and stay single line, so the copy still pastes as-is. I left the remote section alone, since it deliberately shows studio.example.com as a placeholder for pointing at a different host.

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

ℹ️ 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 +290 to +291
const agentCommand = (agentId: string) =>
buildAgentCommand(commandBase, null, commandOs, agentId);

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 Authenticate first-time remote agent commands

When Studio is opened through a non-loopback origin and this machine has not previously cached a key for that exact base, every generated quickstart and agent command fails because null prevents buildAgentCommand from adding --api-key; the CLI then rejects non-loopback servers without a saved key in unsloth_cli/commands/start.py. Provide a usable credential flow for these copied commands, or make them explicitly request the key required for the first launch.

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.

Leaving this one as is, because the alternative is the bug you already had me fix. Passing a placeholder is not inert: _agent_api_key caches an explicit key per base via _remember_key(cache, base, explicit, 'saved'), and that holds whether it arrives as --api-key or as UNSLOTH_API_KEY, so a placeholder would overwrite a working saved key for that server. The tab also has no real key to pass; the API keys panel can fill buildAgentCommand's key argument because the user just minted one there, and keys are not retrievable afterwards. What actually happens on a first non-loopback launch is a precise failure, not a silent one: the CLI stops with 'No saved API key for {base} and automatic minting only runs against a local Unsloth. Create an API key in Unsloth, Settings, API and pass it with --api-key (it is remembered per server), or set UNSLOTH_API_KEY.' The Remote section in this same tab shows exactly that flow. Happy to revisit if you see a way to surface a key that does not poison the per-base cache.

Comment on lines +240 to +243
const [isWindowsClient] = useState(() => {
const p = getClientPlatform();
return p.startsWith("win") || p.includes("windows");
});

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 Choose command syntax from the CLI shell

When Studio runs inside WSL but is viewed in a Windows browser, getClientPlatform() reports Windows even though the copied unsloth command runs in WSL's POSIX shell. This makes the remote snippet—and any non-default-base command—use PowerShell $env: syntax that fails in bash; the existing API usage panel explicitly treats WSL as Unix for this reason. Derive the syntax from the server/CLI environment or expose a shell selector instead of fixing it to the browser OS.

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.

Verified the precedent and you are right. usage-examples.tsx picks its shell from the server-reported deviceType, and config/env.ts notes explicitly that the browser platform can differ from the host for WSL and SSH, while update-banner.tsx treats any non-windows device_type including wsl as POSIX. The agents tab was the odd one out. Fixed in dba51f3: commandOs now comes from deviceType, so a WSL Studio viewed from a Windows browser emits the POSIX form its bash can run. I kept the remote snippet on the client platform, since that block is explicitly about running the CLI on your own machine against a Studio somewhere else, and the comment there now says only that.

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

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

// The browser OS would say Windows for a WSL Studio viewed from Windows and
// emit PowerShell $env: syntax that WSL's bash rejects; any non-windows
// deviceType (wsl included) is POSIX.
const commandOs = deviceType === "windows" ? "windows" : "unix";

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 Generate remote agent commands for the client shell

When a browser client and the remote Studio host use different operating systems—for example, PowerShell on Windows viewing a Linux Studio—deviceType describes the server, but these commands are copied and executed on the client. Consequently, Quickstart and every generated agent/model/passthrough command uses POSIX NAME=value syntax in PowerShell (or $env: syntax in a Unix shell) and fails before invoking unsloth; the remote snippet already uses getClientPlatform() correctly, so remote generated commands should do the same or expose a shell selector.

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.

You are right, and this is the other half of the WSL item from the last round: deviceType is correct only while the CLI runs on the Studio host. Fixed in ed93b67 by choosing per base rather than globally. A loopback base is this host, so it takes deviceType, which reports wsl where the browser would claim Windows; any other base is reached from the viewer's machine, so it takes getClientPlatform, matching the remote snippet. I pulled the loopback test out of canUseLocalAgentDetection into isLoopbackBase so both callers share it. That satisfies both cases without a shell selector: WSL Studio in a Windows browser still gets POSIX, and a Linux Studio viewed from Windows now gets the PowerShell form.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: ed93b67b39

ℹ️ 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
danielhanchen merged commit 0220104 into main Jul 26, 2026
34 of 41 checks passed
@danielhanchen
danielhanchen deleted the studio-settings-agents-tab branch July 26, 2026 07:09
@danielhanchen
danielhanchen restored the studio-settings-agents-tab branch July 26, 2026 07:13
@danielhanchen
danielhanchen deleted the studio-settings-agents-tab branch July 26, 2026 07:14
danielhanchen added a commit that referenced this pull request Jul 26, 2026
The Agents tab added in #7303 sets its avatar initial and its two status
pills with raw px utilities (text-[11px], text-[10px]). Those ignore the UI
font size preference, so the text stays fixed while the rest of Settings
scales, and tests/studio/test_ui_font_scale_contract.py fails on main.

Swapped for the existing tokens in index.css, which are the same sizes
multiplied by --ui-font-scale: text-ui-11 and text-ui-10.

Co-authored-by: danielhanchen <[email protected]>
danielhanchen added a commit that referenced this pull request Jul 27, 2026
* Add Agents settings tab for unsloth start

Adds a Settings > Agents tab documenting the `unsloth start` command:
quickstart, supported agents with click-to-copy commands, model
selection, common options, remote Studio setup, argument pass-through,
and a dry-run preview. Agent CLIs found on PATH are badged as installed.

Also removes the "New" badge from the System and Chat tabs.

* Use official brand logos for agents, invert Ollama and OpenRouter in dark mode

Claude Code and OpenAI Codex now use the Anthropic and OpenAI logos from
the provider-logos registry; agents without an official asset keep the
monogram tile. Also inverts the Ollama and OpenRouter logos in dark mode
so their monochrome marks stay visible.

* Title Agents tab "Agents (unsloth start)" and move it below Connections

The in-tab header now reads "Agents (unsloth start)" while the sidebar
label stays "Agents". Reorders the tab to sit below Connections.

* Address review: guard PATH detection, fix copy timeout, OS-aware remote snippet

- Only probe agent PATH in the desktop app on a loopback backend, so
  Installed badges are not driven by a remote server's environment.
- Show the "none found" note only when detection actually ran and
  returned empty, not when the call failed.
- Share one copy hook that resets its timeout on rapid clicks and clears
  it on unmount.
- Render the Remote Studio snippet with PowerShell syntax on Windows.
- Note that --no-launch can still load a model when --model is set.
- Drop unused quickstart translation keys.

* Add interactive Agents command builder

* Add local subagent command guidance

* Add official coding agent icons

* Use client OS for remote commands, fix copy a11y and model wording (#7303)

- Pick the remote snippet shell from the client platform, not the server deviceType
- Single-line the model examples so they paste in POSIX, PowerShell and cmd
- Split the pass-through block into independent one-command copies
- Derive detection visibility instead of clearing state in the effect
- Announce copy success to assistive tech
- Correct the quickstart/model copy: bare start uses the loaded model

* Shell-quote the model, forward the HF token, and fix the quant placeholder

- Quote the --model value in the generated and subagent commands so a local
  path with spaces or metacharacters stays a single argument (client-OS aware)
- Pass the saved Hugging Face token to listGgufVariants so gated repos resolve
- Show 'No separate quantization' instead of a stuck 'Loading quantizations...'
  when a model has no variants; clear the failure once a later request succeeds

* Fix Agents command discovery and routing

* Unsloth start improvements: download progress, server reuse, and safe model switching (#7313)

* Improve unsloth start runtime lifecycle

* Remove speculative Gemma prompt override

* Polish model download progress output

* Refine unsloth start status output

* Clarify unsloth readiness banner

* Clarify model reuse and switching output

* Queue model switches behind active inference

* Tighten unsloth start model switching

* Reduce model switch bookkeeping

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix Studio re-exec compatibility

* Recheck sidecar reservation after inference drain

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Pass start marker through child environment

* Fix key redaction, switch-waiter ordering, and stop/messaging gaps for PR #7313

- Redact minted sk-unsloth keys from the startup-failure log tail: the early
  key marker lands in the server log before the model load finishes, so a
  load-phase crash printed a live key to the terminal
- Deregister a finished switch waiter before releasing the swap gate so a
  swap on another event loop cannot count it as still queued and unload the
  model the finished request is about to generate against
- Warn on same-repo quant switches: an explicit variant replaces the resident
  weights for every attached session, but the repo ids match so no switch
  warning was printed
- Note the agent exit code when it is nonzero so the server keep-alive
  message does not read as a successful session
- Use taskkill /T in unsloth studio stop so llama-server children stop too

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Tighten comments in start, studio, and inference changes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Han <[email protected]>

* Unsloth start: add local subagents for Claude Code, Codex, OpenCode and Pi (#7326)

Bring the local-subagent support onto main. The original change (#7316) merged
into the stacked pr/daniel-unsloth-start-audit branch rather than main, and #7313
reached main via squash, so these files never landed on main.

Adds --as-subagent for claude, codex, opencode and pi: the parent agent keeps its
own cloud model while a locally served GGUF is registered as a delegated subagent,
using ephemeral per-session config that never touches the user's real agent config.

* Fix Agents builder defaults and flag validation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix Agents variant and provider fallbacks

* Fix local model and Pi subagent edge cases

* Agents tab: flag the Codex row when the loaded model is not GGUF

* Agents tab: target the active Studio server, wrap narrow rows, index the tab's search terms

* Agents tab: build copied commands from the browser-reachable Studio and show the key placeholder

* Preserve cache load ids and path variants in built commands for PR #7312

A GGUF outside the active Hugging Face cache only loads by its snapshot
path, so keep that load_id for --model while still listing the row by repo
id. Path based models carry their quant in --gguf-variant rather than a
":variant" suffix, and the active selection now keeps the variant inference
status reports for them.

* Agents tab: index the intro for agent-name searches and keep long commands inside the panel

* List GGUF variants from the cache the command loads from for PR #7312

A snapshot outside the active Hugging Face cache was offering the remote
variant list, so a quant absent from that snapshot could be selected and
the generated command would fail to load it.

* Agents tab: omit --api-key so the CLI can replay a saved key for the base

* Agents tab: label the indexed heading rows and fall back to the active desktop API base

* Agents tab: name every supported agent in the indexed intro for PR #7303

* Send the cached GGUF load path and fix the agents tab search targets for PR #7312

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Tighten the agents tab comments for PR #7303

* Build the agents tab example commands from the active Studio base for PR #7303

* Keep the resident model on its active cache load for PR #7312

* Tighten the agents tab and cached GGUF comments for PR #7312

* Take the agent command shell from the Studio host for PR #7303

* Stop emitting snapshot paths as --model and keep unsloth start searchable for PR #7312

* Pick the command shell from where the CLI runs for PR #7303

* Match a path load by its advertised id and follow the resident model for PR #7312

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Keep an explicit quantization and retire superseded native-grant labels for PR #7312

* Scope the remembered quant, stop following unloaded models and keep local GGUF paths for PR #7312

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Stop shadowing the path classifier, match snapshot ordering and sequence status polls for PR #7312

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Release stale native-grant picks, keep local GGUF identities and index snapshot aliases for PR #7312

* Index inactive-cache snapshots, widen local GGUF detection and clear retired quants for PR #7312

* Classify cached repos by snapshot, merge repo ids case-insensitively and keep loose GGUFs variantless for PR #7312

* Fix snapshot alias, partial split and mmproj-only handling for PR #7312

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Trust scanned model_format and drop incomplete snapshot ids for PR #7312

* Exclude mmproj and partial downloads, keep path case and drop duplicate scan for PR #7312

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Restrict revision aliases and require complete snapshot variants for PR #7312

* Index revisions individually and hide partial variants for PR #7312

---------

Co-authored-by: shimmyshimmer <[email protected]>
Co-authored-by: Daniel Han <[email protected]>
Co-authored-by: oobabooga <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

3 participants