Skip to content

Studio: audio.cpp models land on the right pages - #14072

Merged
danielhanchen merged 21 commits into
unslothai:mainfrom
Etherll:feat/audiocpp-models-right-pages
Oct 19, 2026
Merged

danielhanchen merged 21 commits into
unslothai:mainfrom
Etherll:feat/audiocpp-models-right-pages

Conversation

@Etherll

@Etherll Etherll commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

An audio.cpp model family that Unsloth Studio's tables don't list used to land on one Audio page, picked from the first task in its runtime spec. It now lands on every page the spec allows: a spec with tts and clone shows on Text to Speech and Clone (fish_drama3, kitten_tts2), sep on Separate, asr on Transcribe, and music/sfx on Music with a conservative setup (lyrics only when the spec declares a lyrics option, and no seed when its declared options leave seed out). Voice conversion stays limited to the families Unsloth Studio already configures.

The Audio pages can also list umbrella folders and Community repos that the bundled seed doesn't know about yet, so a new upload shows up without a frontend release. For example, Jmica/Drama-3-GGUF (named by the fish_drama3 spec) shows under "More models" on Text to Speech and Clone.

Community rows come from the installed runtime's model_specs/. Prebuilt runtimes don't ship that folder yet; the audio.cpp v0.9.2 support PR adds it at install. Until then the catalog lists umbrella folders only (runtime_specs: false), and the pickers behave as before for everything in the bundled seed.

Changes

Backend placement (audio_cpp_models.py):

  • _family_from_spec_tasks builds one page set per family from the spec. Clone sends a reference on every run, so reference_text is required when the spec declares it and unused when the spec declares a request list without it.
  • mira_tts and sopro_tts are Clone only, since both need a reference clip on every run.
  • A spec family whose recommended package has more than one GGUF is refused with the existing "multi-file package" message instead of failing at load.
  • The default variant follows the spec's ui.recommended_package (falling back to its default GGUF package). K and IQ quants are ranked after F32, so the existing preference order is unchanged.
  • User-facing refusal strings name "Unsloth Studio" in full.

New GET /api/inference/audio/catalog (audio_cpp_catalog.py):

  • Lists every folder in the umbrella repo plus Community repos named by the installed runtime's model_specs/, with pages, languages, status, size and whether it is downloaded.
  • The Hub listing is cached for 300 s. If the Hub is unreachable it falls back to the last good listing saved under the state dir, then to the local HF cache, and retries after 30 s.
  • Rows are filtered per account with account_access.filter_model_rows. Failures return a 503 without exception text.

Frontend:

  • A single pageModels() resolver (page-models.ts) decides which models each Audio page shows. The per-page filters and orderings in clone-page.tsx, convert-page.tsx, edit-page.tsx, music-page.tsx, separate-page.tsx and speak-page.tsx are removed, and audioRowMatchesWorkflow now calls the same resolver.
  • Catalog rows the seed lacks appear in a "More models" group in the existing model picker (moreModels prop on ModelSelector/HubModelPicker). The row tooltip shows pages, languages and status, and the size column shows the size. A downloaded new folder still lists under On Device.
  • The nightly catalog:check --network now emits a ::warning:: for an umbrella folder the seed doesn't list, instead of failing. A stale AUDIO_CPP_UNOFFERED_FOLDERS entry still fails.

MCP:

  • list_models takes a workflow filter that keeps only audio models whose audio_workflows include that page.
  • generate_audio takes model, which Unsloth Studio loads first when "Switch model by request" is on. Option checking against the loaded model is skipped when a different model will run the request.
  • When the requested model can't run the workflow, the switch guard error now names the model and the pages it does run on, for example "X can't run Separate (separate). It runs on Text to Speech (speak) and Clone (clone)." It names the model as requested, never the resolved local path.

Not in this PR

  • The per-model "Show on" page choice moves to a follow-up: with the 14 locale overlays it would push this PR past its size budget.
  • "Try on ... (experimental)" is dropped. The backend guards refuse a page outside a model's workflows, and off-contract runs either fail or quietly ignore the reference voice.

Testing

  • Backend: tests/test_audio_cpp_*.py, test_audio_catalog_route.py, test_audio_run_route.py, test_audio_inputs.py, test_openai_auto_switch.py, test_mcp_*.py, test_stt_*.py: 3894 passed, 4 skipped. The affected files were rerun after the last edits: 1081 passed, plus 837 passed in test_openai_auto_switch.py -k "audio or switch". ruff check is clean.
  • The new placement test fails on main (20 failures; a fish_drama3-like spec lands on Text to Speech only) and passes here.
  • Clone route, live on CPU: a sopro_tts model on a plain tts session returns audio for /v1/audio/speech with voice_ref, and refuses without one. So spec-derived clone families run Clone on the speech session, with no clon task.
  • Catalog builder against the live Hub with the v0.9.2 and HEAD runtime specs: 139 rows, 37 Community, no host paths in the payload. With the Hub rate-limited (429), it fell back to the HF-cache listing without raising.
  • Frontend: npm test passes (the files that timed out under load pass when rerun alone, 61/61). npm run typecheck, npm run catalog:check, npm run catalog:check:network, npm run i18n:check:strict and npm run build pass. A throwaway parity script showed pageModels() gives the same lists, in the same order, as the six removed page functions for every page, with and without Mac, over the bundled seed.
  • Before/after screenshots of the Text to Speech and Clone pickers are in the comment below.

UI before / after

Audio > Text to Speech model picker, scrolled to the end of the list: before, the list stops at the last Recommended row; after, a new "More models" group lists Plapre-3-GGUF with its 1.1 GB size. BEFORE is the merge base, AFTER is this PR, two separate installs. Community rows need a runtime with model_specs/, which this capture host does not have.

Text to Speech picker before and after

Audio > Clone model picker: the same "More models" group appears under Recommended.

Clone picker before and after

A model family that Unsloth Studio's tables don't list now lands on every
Audio page its runtime spec allows, not just the first task: a spec with
tts and clone shows on Text to Speech and Clone (fish_drama3, kitten_tts2),
sep on Separate, asr on Transcribe, music/sfx on Music with a conservative
music setup. Voice conversion stays limited to the families Unsloth Studio
already configures. mira_tts and sopro_tts are Clone only, since they need a
reference on every run. The default variant follows the spec's
recommended_package, and K/IQ quants rank after the established order.

GET /api/inference/audio/catalog lists every umbrella folder (300 s TTL,
saved last-good listing, HF-cache fallback) plus Community repos named by
the runtime's model specs. The Audio pages use one pageModels() resolver
and show a "More models" group in the existing picker, with the pages,
languages and status in the row tooltip and the size in the size column.
The nightly catalog check warns on a new folder instead of failing.

MCP: list_models takes a workflow filter, generate_audio takes model, and
the switch guard names the pages a model runs on.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 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 ⚠️ Failed 2026-10-19T00:26:17.327456Z 6ccd867 New commits
ℹ️ 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.

- A catalog entry the backend could not place no longer hides a model the
  bundled seed already knows, so a degraded catalog (no runtime specs, late
  header probes) leaves every page as it was.
- A build whose family probe missed the deadline is cached for 30 s, not
  300 s; concurrent cold requests share one build; a spec package with an
  empty file list no longer fails the whole catalog.
- More models rows follow the picker's format and fit filters, show when
  the Recommended list is empty, and appear on Transcribe for catalog ASR
  models.
A More models row has no Hub pipeline tag, so a catalog ASR model picked
on Transcribe was treated as a speech model and loaded on Text to Speech.
The pick now carries the catalog's speech-recognition task.
The picker's loading spinner and Hub failure hint replaced the whole list,
so catalog rows that were already available stayed hidden until the Hub
answered. Those states now apply only when neither list has rows.
…catalog rows

- More models rows now join the picker's roving option list after the
  recommended rows, in the order they are drawn. Before, each got the
  shared fallback option id and arrow keys could not reach them.
- When the backend read the installed runtime's own model specs, its
  catalog verdict decides which umbrella folders appear under More models,
  so a folder the static unoffered list holds back shows up once the
  runtime supports it. Without runtime specs the static list still applies.
… folder's spec

The audio catalog guessed a folder's family from its name when no runtime
spec placed it. Voxtral-4B-TTS reads as voxtral_realtime, whose spec places
the Voxtral Realtime folder, so on a runtime without voxtral_tts the TTS
folder was offered on Transcribe. A hint whose runtime spec places other
folders but not this one is now ignored, and the GGUF header decides.
@Etherll

Etherll commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator Author

Audio models missing from the bundled list now appear on every Audio page their runtime spec allows. On b74c455, a spec with tts and clone (Drama 3, Kitten TTS 2) lands on both Text to Speech and Clone. Catalog speech-to-text models land on Transcribe. The pickers list new umbrella folders and Community repos under "More models".

What changed

  • Placement reads the whole task list. Before, a model reached only the first page its spec named, so a model that can speak and clone never showed up on Clone. mira_tts and sopro_tts are Clone-only, because both need a reference clip on every run.
  • The catalog covers more than the bundled list. Pickers used to know only the 76 bundled models. GET /api/inference/audio/catalog now lists every umbrella folder, plus the Community repos that runtime specs name.
    • Each "More models" row shows its pages, languages and size.
    • The rows follow the picker's format and fit filters, and work with arrow keys.
    • They still show while the Hub list is loading or offline.
    • A speech-to-text pick loads on Transcribe.
  • Runtime support decides what's listed. When Unsloth Studio can read the installed runtime's specs, the backend decides which folders are listed. A folder that was held back appears once the runtime supports it. Without those specs, the static list still applies. When the catalog can't place a model, the bundled list decides, so a degraded catalog never hides a known model.
  • Misleading folder names no longer misplace models. Some folders have names that match a different model's family, such as Voxtral 4B TTS and Voxtral Realtime. For these, Unsloth Studio now reads the GGUF header instead of trusting the name, so a TTS folder is never offered on Transcribe.
  • Agent tools know the pages. Agents can filter list_models by Audio page, pass model to generate_audio, and get a switch error that names the pages a model runs on.

Testing

  • Automated tests. On this head, the audio catalog, placement, model and MCP backend suites (271 tests) and the full frontend suite (12,541 tests) pass. The new placement, More-row and option-list tests fail on the code before each fix.
  • Real catalog data. The real umbrella listing was run through the catalog builder:
    • With v0.9.1 specs, Voxtral-4B-TTS is refused as needing a newer runtime.
    • With v0.9.2 specs, it lands on Text to Speech.
    • No other folder changes.
  • Earlier checks. An earlier CPU run confirmed that a clone model placed from its spec accepts a reference clip on the speech endpoint. Earlier rounds checked the picker in Chrome, Edge and Firefox.
  • Keyboard. In the browser on this head, all 39 Transcribe picker options have unique ids, and arrow keys move through the More group.

Community rows need runtime specs, which prebuilt runtimes don't ship yet. The screenshots below therefore use a catalog response that the real backend built from the v0.9.2 and HEAD runtime specs. Each "After" picker is scrolled to the More group.

Text to Speech, before and after

Speak

Clone, before and after

Clone

Transcribe, before and after

Transcribe

Row tooltips and Clone with the Hub listing offline

Tooltip
Drama 3 tooltip
Hub offline

@danielhanchen danielhanchen self-assigned this Oct 18, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@danielhanchen

Copy link
Copy Markdown
Member

@codex security review

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

ℹ️ 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 +16 to +18
useEffect(() => {
if (enabled) void store.refresh();
}, [enabled]);

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 Schedule catalog retries and TTL refreshes

When the initial catalog request fails, or after a successful response reaches its TTL, nothing calls store.refresh() again: enabled remains true, and the Audio page is kept mounted while users navigate elsewhere, so this effect runs only once. The store's nextFetchAt only rejects early calls; it does not schedule a future call. A transient 503 therefore leaves all dynamic/community models absent for the rest of the SPA session, and a successful catalog never refreshes until a full reload. Schedule a retry/refresh timer (or refresh on activation/focus) rather than only invoking the store on the initial effect.

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.

Fixed in fec462e: the hook now refreshes when the persistent Audio page becomes active and polls refresh (a no-op until the retry or TTL is due) while it stays active.

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

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


test("the Audio page builds its picker lists from pageModels and the catalog hook", () => {
const page = readSrc("features/audio/audio-page.tsx");
assert.match(page, /const audioCatalog = useAudioCatalog\(true\);/);

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 Match the assertion to the active catalog hook

The frontend test job in studio-frontend-ci.yml runs npm test, and this assertion cannot match the implementation introduced here: audio-page.tsx calls useAudioCatalog(active), not the literal true. With dependencies installed, audio-page-models.test.ts therefore fails every run before validating the rest; assert the active argument instead.

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.

Fixed in d70fd94: the assertion now matches useAudioCatalog(active).

source: response.source,
runtimeSpecs: response.runtime_specs === true,
};
nextFetchAt = now() + ttlMs;

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 Honor the backend's degraded catalog retry interval

The fresh case not covered by the polling fix is a successful but degraded response: when /audio/catalog returns saved/cache, or a hub response with incomplete header probes, the backend intentionally caches it for only 30 seconds, but this branch unconditionally suppresses frontend fetches for the default 300 seconds. The new 30-second timer consequently no-ops for five minutes, leaving missing dynamic/community rows stale after a transient Hub or probe failure; allow polling refreshes through so the backend can enforce its own TTL.

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.

Fixed in d70fd94: a saved or cache answer now sets the next fetch at the retry interval, so the poll re-asks once the backend's degraded TTL lapses; hub answers keep the 5 minute TTL.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: d70fd94913

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

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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 pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 18, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 18, 2026
@danielhanchen
danielhanchen merged commit df9a01c into unslothai:main Oct 19, 2026
danielhanchen added a commit that referenced this pull request Oct 19, 2026
…ol annotations (#14077)

Includes #14072 (Studio: audio.cpp models land on the right pages);
review this PR's own commits from 4d58b31 on. `git diff e1d6db4
HEAD` (the #14072 head) shows only this PR's changes; the merge commit
just brings #14072 up to date.

## Summary

Connecting an agent to the Unsloth Studio MCP server meant copying a
per-agent command from `MCP.md`, and the documented Claude Code command
expanded `$UNSLOTH_API_KEY` in the shell, so the key itself was written
into `~/.claude.json`. Agents also had no way to see which image, video
or audio models they could download, or whether one would fit on the
GPU. This adds a setup command, a connection check, a download catalog
in `list_models`, and two recipe prompts.

## Changes

`unsloth mcp add {claude-code,codex,cursor,generic}` writes the agent's
MCP entry. The entry names an environment variable (`UNSLOTH_API_KEY` by
default, `--env-var` to change it) in the `Authorization` header, and
the command never reads, prints or writes the key.

- It uses `--url`, then `UNSLOTH_STUDIO_URL`, then a running Unsloth
Studio on this machine, then `http://127.0.0.1:8888`.
- Claude Code goes through `claude mcp add --scope user` when `claude`
is on PATH, otherwise it edits `~/.claude.json` directly. Codex gets a
`[mcp_servers.unsloth-studio]` table with `tool_timeout_sec = 300`, and
the edit is refused if any other TOML setting would change. Cursor gets
`~/.cursor/mcp.json` with `${env:UNSLOTH_API_KEY}`. `generic` prints a
JSON snippet, or merges it into `--output`.
- `--dry-run` prints just the entry it would write and writes nothing.
It never prints the old entry it would replace, since one written by
hand may hold a key. Re-running with the same arguments reports
"unchanged". New config files are created with mode 0600, and existing
files keep their mode.

`unsloth doctor --mcp [--env-var NAME]` checks that Unsloth Studio
answers, that the key is accepted, and that `/mcp/` is on (it tells
"turned off" apart from "this Unsloth Studio predates MCP"). It warns,
without failing, when a configured Codex or Claude Code tool timeout is
under 240 s. Plain `--mcp` skips the GPU checks; `--mcp --gpus` runs
both.

`list_models(source="catalog")` lists image, video and audio models
Unsloth Studio can download. Audio rows are forwarded from the audio.cpp
catalog route in #14072 (`/api/inference/audio/catalog`), rather than
importing its builder, so they stay filtered per account like every
other MCP call. Image and video rows come from a new `GET
/api/inference/media/catalog`, built from the diffusion and video family
registries, filtered to what the calling account may load, and limited
to the video families this device can run (as on the Video page).
Catalog rows carry `size_bytes` (decimal bytes), `low_vram` (a video
family's GGUF repo) and `fits_now`, which compares the size against the
free memory of the single GPU with the most free memory, or is null when
either value is unknown. The default `source="local"` output is
unchanged.

LLM rows in `list_models(source="catalog")` are a possible follow-up
pending a maintainer decision. For now the docstring tells agents to
list downloaded LLMs with the default source or load a Hugging Face id.

The MCP server now offers two prompts, which Claude Code shows as slash
commands:

- `make_short_film(idea, length_seconds)` reads free GPU memory, loaded
models and the video, music and voice catalog rows that fit now, then
lists the calls from `load_model` through `generate_video`, `get_job`
and `generate_audio`.
- `build_dataset_and_train(goal, base_model)` reads the downloaded LLMs
and lists the dataset, Data Recipe, `start_training` and `export_model`
calls.

Both fall back to plain steps when Unsloth Studio can't be read, and the
rendered text is capped at 4000 characters.

`MCP.md` gets a "One command" section for `mcp add` and `doctor --mcp`,
the catalog in the `list_models` row, and a Prompts section. The
hand-written Claude Code commands now single-quote `${UNSLOTH_API_KEY}`
and use `--scope user`, so the key stays out of `~/.claude.json`.

Tool annotations (titles, `idempotentHint`, `destructiveHint` on
`load_model`) will land as a final commit after the other MCP PRs merge.

## Testing

New tests: `unsloth_cli/tests/test_mcp_add.py`,
`unsloth_cli/tests/test_doctor_mcp.py`,
`studio/backend/tests/test_mcp_prompts.py`,
`studio/backend/tests/test_media_catalog.py`, and catalog cases in
`studio/backend/tests/test_mcp_tools_models.py`.
`test_mcp_no_host_paths.py` also runs `list_models(source="catalog")`,
and the `list_models` schema row in `test_mcp_server.py` is now a
superset check, so it accepts `source`.

- `unsloth_cli/tests/`: 2084 passed, 4 skipped. The 1 failure,
`test_studio_update_verify.py::test_a_no_torch_install_keeps_that_mode_in_the_reinstall`,
fails the same way on the #14072 head.
- `studio/backend/tests/test_mcp_*.py` plus the media and audio.cpp
catalog tests: 1708 passed, 3 skipped (fastmcp 3.4.8). The MCP, catalog
and prompt files also pass on fastmcp 3.2.4. `FastMCP.prompt(title=)`
exists back to the 3.0.2 floor.
- Leak tests: a dry run over configs holding literal keys (any `Bearer`
spelling, other headers, `args`, TOML `bearer_token` in any quoting,
multi-line strings, another server's token) prints none of them, across
56 probe cases. Another test sets `UNSLOTH_API_KEY` to a canary and
checks stdout, every written file and the `claude` argv for all four
agents, with and without `--dry-run`.
- `fits_now` is covered for a stubbed 24 GB and 12 GB card
(Wan2.2-TI2V-5B, 24.2 GB, fits only the first), the GiB/GB boundary, and
two GPUs (the max counts, not the sum).
- Negative controls: `unsloth doctor --no-gpus` output is byte-identical
to the #14072 head, and `doctor --help` only gains the `--mcp` line.
Dumping every MCP tool's schema, description and annotations before and
after shows only `list_models` changed.

Against a running Unsloth Studio (no model loaded):

- `unsloth doctor --mcp` with a valid key printed "API key: set,
accepted", "MCP endpoint: on" and "Verdict: OK", exit 0. With a wrong
key it printed "set, refused" and exit 1. The key appeared in neither
output.
- `mcp add claude-code`, `codex` and `cursor`, each run twice in a
sandboxed home, wrote once and then reported "unchanged". `--dry-run`
printed the diff and wrote nothing, and every created file was mode 600.
`claude mcp get` and `codex mcp get` read the entries back with the env
var name, not a key.
- Claude Code 2.1.302 expands `${UNSLOTH_API_KEY}` in a user-scope
header when it connects, so the entry `mcp add claude-code` writes
authenticates.
- A no-context Claude Code agent with only this MCP server, asked to
plan a 20 s film with music and a voice-over for one 24 GB GPU, called
`studio_status`, then `list_models(source="catalog")` for video, audio
and TTS. It picked `unsloth/Wan2.2-TI2V-5B-GGUF` (a `low_vram` row),
Stable-Audio-3-Medium-GGUF (3.6 GB) and
Qwen3-TTS-12Hz-1.7B-VoiceDesign-GGUF (2.8 GB). That took 6 tool calls
with no errors. The full catalog is 130 rows (33 KB) and returns in 0.09
s.
- `prompts/list` and `prompts/get` for both prompts work over HTTP with
live GPU and catalog data.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Han <[email protected]>
danielhanchen added a commit that referenced this pull request Oct 19, 2026
…eset the startup budget to the build (#14168)

## Summary

Main is over the startup bundle budget, so `Frontend build + bundle
sanity` fails on every PR based on it:

```
over the startup budget: transfer 2005.9 KB > 2003.5 KB, raw 6665.4 KB > 6659.1 KB      (main at 2fee36f)
```

This PR takes two steps. It moves #14137's prompt upsampler client out
of the startup chunks, which is real growth with a lazy home. It then
resets both limits to the measured build. Main has gone over this budget
repeatedly, and the root of that is a shortfall in how the limits were
raised, which this corrects.

## Cause

**#14137 (FLUX.3 prompt upsampling).** The Images page is lazy
(`ImagesPage = lazy(...)` in `__root.tsx`), but `features/images/api.ts`
is not. Startup modules import it for other calls
(`loaded-models-api.ts`, `loaded-models-sources.ts`,
`use-media-companion-bytes.ts`). #14137 put the four upsampler calls
there, with value imports from `lib/prompt-enhance.ts`, so that module
joined the startup chunks. Only `prompt-enhance-panel.tsx`, inside the
lazy Images page, calls them.

**The limits themselves.** Each raise since #14073 was sized from its
own PR's delta and added to the previous limit. That previous limit
already sat below the build, starting at #14073:
- `475a02ac` measures 2,047,700 B transfer against the 2,047,608 B limit
#14073 set.
- By `2fee36ff` the gap is 6,500 B raw and 2,409 B transfer.

The raises since (#14072, #14075, #14110, #14108, #14113) each added
their delta, so the shortfall carried forward. CI agrees with my machine
to the byte: the first run of this PR read 1999.7 KB transfer on both.

## Change

- **New `features/images/prompt-upsampler-api.ts`:** holds
`getPromptUpsamplerStatus`, `startPromptUpsamplerDownload`,
`cancelPromptUpsamplerDownload` and `previewEnhancedPrompt`, moved
unchanged, with the same `parseJson` error handling.
- **`api.ts`:** now imports only the `PromptEnhancement` type from
`lib/prompt-enhance` (erased at build).
- **`prompt-enhance-panel.tsx`:** imports the calls from the new module.
- **No behavior change** in the app.
- **`check-bundle-budget.ts`:** both limits are reset to the measured
build plus the usual margin (160 B raw, 189 B transfer), with an entry
in the BUDGET comment block explaining why the reset is absolute rather
than by delta.
  - `rawBytes`: 6,819,206 (main after #14113) -> 6,825,885.
  - `transferBytes`: 2,051,727 -> 2,054,261.

## Testing

One machine and build, Node 24, exact byte totals from the budget
script, 95 chunks throughout:

| tree | raw B | transfer B |
|---|---|---|
| main `2fee36ff` | 6,825,378 | 2,053,999 |
| main `2fee36ff` + the move | 6,821,006 | 2,052,708 |
| main `78e5eefa4d` (adds #14113) + the move | 6,821,334 | 2,052,857 |
| + #14183 | 6,821,410 | 2,052,614 |
| + #14172 (one tooltip design) | 6,825,307 | 2,053,990 |
| this PR (main `b227654927`, adds #14184, + the move) | 6,825,725 |
2,054,072 |

- **The move saves:** 4,372 B raw and 1,291 B transfer.
- **#14113 adds:** 328 B raw and 149 B transfer on this build.
- **Landed while main was over, with no raise:** #14183 (+76 B raw, -243
B transfer), #14172 (+3,897 B raw, +1,376 B transfer, the shared tooltip
is in the eager shell) and #14184 (+418 B raw, +82 B transfer). This is
the treadmill the absolute reset stops: while main is red on this check,
growth lands unaccounted.
- **With the new limits:** `within budget (0.2 KB transfer, 0.2 KB raw
to spare)`.
- **`npm run typecheck`:** clean.
- **`bundle-budget-cli.test.ts`, `bundle-budget-closure.test.ts`,
`image-prompt-enhance.test.ts` and
`loaded-models-platform-matrix.test.ts`:** 74 passed.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@Etherll
Etherll deleted the feat/audiocpp-models-right-pages branch October 20, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants