Skip to content

Magenta RealTime 2: accept the legacy duration_seconds field and add the missing WebUI catalog entry - #1158

Merged
0xShug0 merged 3 commits into
0xShug0:mainfrom
noctrex:fix/magenta-duration-seconds-legacy
Nov 1, 2026
Merged

0xShug0 merged 3 commits into
0xShug0:mainfrom
noctrex:fix/magenta-duration-seconds-legacy

Conversation

@noctrex

@noctrex noctrex commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Two requests to a Magenta RealTime 2 model configured through the server config fail from the WebUI with strict-whitelist rejections:

unknown Magenta RealTime 2 request option: duration_seconds. ...
unknown Magenta RealTime 2 request option: max_tokens. ...

No issue or PR for this exists yet (searched before opening this one).

Root causes

1. duration_seconds (server side). The request parser forwards the top-level duration_seconds field verbatim into the options map (app/cli/request.cpp), and the WebUI's shared gen path sends exactly that legacy field to every family except controlfoley and midashenglm_gen (+page.svelte:2213). Magenta RealTime 2 is spec-backed and validates every option key against its schema-v1 contract before parsing (magenta_realtime_2/session.cpp), and its spec declares only duration_sec - so GUI music requests were rejected before generation started.

2. max_tokens (WebUI side). PR #1121 added the family everywhere except webui/configs/models_catalog.json. A config-defined magenta model therefore finds no catalog base (exact id or family+task), and its GUI entry carries no request_options metadata. With the metadata missing, supportsMaxTokens falls back to the task-based assumption ("task gen -> yes"), shows the max-tokens field, and sends max_tokens on every request - which magenta's strict whitelist rejects. Every other music family (ace_step, heartmula, stable_audio, yue2) has a catalog entry, which is why only magenta misbehaves.

Fixes

  • Server: normalize legacy request names with runtime::apply_option_v1_compatibility({{"duration_seconds", "duration_sec"}}, ...) before the whitelist check, the same pattern stable_audio/request.cpp and heartmula/session.cpp already use, and parse all options from the normalized map. Sending both spellings still fails with the explicit "options contain both ...; use duration_sec" error.
  • WebUI: add the missing magenta_realtime_2 catalog entry following the other music-gen families, and regenerate the embedded dist/index.html. Config-defined magenta entries now match the catalog by family and task, take their request options from the family spec, and no longer send max_tokens.

Both changes are needed: the catalog fix alone does not help duration_seconds (the GUI still sends the legacy field to families outside the hardcoded two), and the server shim alone cannot fix max_tokens (the field is meaningless for a duration-driven model, so accepting it would pollute the spec).

Testing

  • Local ROCm build (gfx1100), server started via llama-swap with --backend rocm, model: config-defined magenta-rt2-base-f16.gguf (2.4B Base, F16).
  • WebUI gen request with a custom duration now generates 48 kHz stereo audio correctly; previously failed with the two errors above.
  • npm run check reports 0 errors / 0 warnings; npm run build regenerated dist/index.html.
  • Also verified: sending both duration_seconds and duration_sec together still fails with the explicit error, matching stable_audio's behavior.

LLM Disclamer: I had the help of a clanker.

The server forwards the top-level duration_seconds field verbatim, and the
WebUI gen path sends that legacy field to every family except controlfoley
and midashenglm_gen. Magenta RealTime 2 validated raw option keys against
its schema-v1 contract before parsing, so GUI music requests failed with
"unknown Magenta RealTime 2 request option: duration_seconds".

Normalize legacy request names with apply_option_v1_compatibility before
the whitelist check, as stable_audio and heartmula already do, and parse
all options from the normalized map. Sending both spellings still fails
with the explicit use-duration_sec error.
PR 0xShug0#1121 added the family everywhere except models_catalog.json, so a
Magenta RealTime 2 model configured through the server config found no
catalog base and its GUI entry carried no request_options metadata. With
that metadata missing, supportsMaxTokens fell back to the task-based
assumption and sent max_tokens with every gen request, which magenta's
strict schema-v1 whitelist rejected with "unknown Magenta RealTime 2
request option: max_tokens".

Add the catalog entry following the other music-gen families, and
regenerate the embedded dist bundle. Config-defined magenta entries now
match the catalog by family and task, get their request options from the
family spec, and no longer send max_tokens.
@0xShug0

0xShug0 commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR! AFK now and I will check the PR later today.

@0xShug0

0xShug0 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

@noctrex It's a WebUI integration bug rather than the model issue. After v0.9.2, new models are expected to use normalized option names instead of ad-hoc ones. Released models can still use the old names for compatibility, but new models should not. I just updated the PR directly.

Update: PR merged.

@0xShug0
0xShug0 merged commit 4643cbb into 0xShug0:main Nov 1, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants