Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

let a federated audio render carry the lyrics it was routed to sing (#4348)

[._.]/ Adam Eivy95c801296901
diff --git a/CLAUDE.md b/CLAUDE.md
index ead14573c5..06339bd355 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -28,7 +28,7 @@ npm run test:db # DB-backed suites → portos_test ONLY (see Se
- **Auth** — an optional instance password (`server/services/auth.js`, enforced by `server/lib/authGate.js`) gates all of `/api/*` and `/data/*` when set, with a small always-public set (`/api/auth/status`, `/api/system/health`). Peers reach a password-gated instance via a per-peer Basic credential on the peer record, attached to every outbound hop by `peerFetch` (`server/lib/peerHttpClient.js`).
- **HTTPS** — provisioned by `npm run setup:cert`; `:5555` flips to TLS with a loopback-only HTTP mirror on `:5553`. Peer hops set `rejectUnauthorized: false` ("Tailnet is the trust boundary") — between two tailnet nodes WireGuard already supplies mutual auth, but a non-tailnet peer (plain LAN IP / non-`.ts.net` host, see `peerRequiresTailscale()`) gets no server authentication.
-Because both are off by default, **never treat "the password is set" as an available guarantee** when designing a feature — gate on it explicitly, or design for the default posture. **PII must not ride the federation layer at all** — see ADR [privacy records machine-local](docs/decisions/2026-08-08-privacy-records-machine-local.md). That rule governs *records* and *status/capability payloads*; its one scoped carve-out — a submitted image/video job body carrying the prompt an allowlisted peer is being asked to render — is ADR [federated visual prompts](docs/decisions/2026-08-20-federated-visual-prompts.md).
+Because both are off by default, **never treat "the password is set" as an available guarantee** when designing a feature — gate on it explicitly, or design for the default posture. **PII must not ride the federation layer at all** — see ADR [privacy records machine-local](docs/decisions/2026-08-08-privacy-records-machine-local.md). That rule governs *records* and *status/capability payloads*; its one scoped carve-out is a submitted job body carrying the conditioning an allowlisted peer is being asked to render — the prompt (ADR [federated visual prompts](docs/decisions/2026-08-20-federated-visual-prompts.md)), and, under the same gate, lyrics and conditioning images (ADR [conditioning crosses to an allowlisted peer](docs/decisions/2026-08-22-federated-media-input-assets.md), which also records what stays refused: model weights and multi-step chain state).
**Distribution model (across installs).** PortOS is distributed software: many independent people each run their own install, on their own machine(s), each upgrading on their own schedule — and a single user commonly runs **several machines federated as sync peers**. Backward/forward compatibility across installs and versions is first-class, NOT optional:
diff --git a/client/src/components/music/MusicGenPanel.jsx b/client/src/components/music/MusicGenPanel.jsx
index 56553d6973..61312c4b76 100644
--- a/client/src/components/music/MusicGenPanel.jsx
+++ b/client/src/components/music/MusicGenPanel.jsx
@@ -241,7 +241,24 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
: engine.modelReady === true;
const autoDurationAvailable = supportsAutoDuration(generationEngine);
const hasLyrics = typeof lyrics === 'string' && lyrics.trim().length > 0;
- const conditioningLyrics = generationEngine?.lyrics && !instrumentalOnly && !isRemote ? lyrics : '';
+ // Two independent facts, and the server refuses the combination where they
+ // disagree (ADR docs/decisions/2026-08-22-federated-media-input-assets.md
+ // rule 2): `lyrics` is the model's own capability, `acceptsLyrics` is whether
+ // the peer's BUILD carries the words. A peer predating lyrical federation
+ // publishes the first and not the second, so absent must read as false —
+ // otherwise this panel offers a lyric render the peer answers with a 400.
+ const remoteLyricsAvailable = isRemote
+ && generationEngine?.lyrics === true
+ && generationEngine?.acceptsLyrics === true;
+ // Remote renders that cannot carry lyrics are instrumental by construction,
+ // not by choice — the checkbox reflects that rather than pretending the user
+ // picked it. Where the peer CAN sing, it is an ordinary choice again.
+ const forcedInstrumental = isRemote && !remoteLyricsAvailable;
+ const effectiveInstrumentalOnly = forcedInstrumental || instrumentalOnly;
+ const lyricsCondition = !isRemote || remoteLyricsAvailable;
+ const conditioningLyrics = generationEngine?.lyrics && !effectiveInstrumentalOnly && lyricsCondition
+ ? lyrics
+ : '';
const lyricDuration = useMemo(() => analyzeMusicLyrics(conditioningLyrics, {
minDurationSec: Math.max(60, generationEngine?.defaultDurationSec || 60),
maxDurationSec: generationEngine?.maxDurationSec || 300,
@@ -380,11 +397,14 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
prompt: prompt.trim(),
engine: generationEngine.id || generationEngine.engine,
modelId: isRemote ? generationEngine.modelId : selectedModelId,
- instrumentalOnly: isRemote ? true : instrumentalOnly,
+ instrumentalOnly: effectiveInstrumentalOnly,
};
if (isRemote) {
body.mediaProviderPeerId = selectedRemotePeer.id;
body.remoteMusicProfile = remoteProfile;
+ // Only when the resolved capability says the peer carries them. Sending
+ // otherwise is the 400 `forcedInstrumental` exists to avoid.
+ if (remoteLyricsAvailable) body.lyrics = lyrics || '';
} else if (engine.lyrics) {
// Keep authored lyrics available to the track record even when the server
// deliberately excludes them from this render's engine conditioning.
@@ -496,7 +516,11 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
</label>
))}
</div>
- <p className="text-[10px] text-gray-500">Only this fixed musical profile crosses the peer boundary; your prompt and lyrics remain on this instance.</p>
+ <p className="text-[10px] text-gray-500">
+ {remoteLyricsAvailable
+ ? 'This fixed musical profile crosses the peer boundary in place of your prompt, which stays on this instance. Lyrics are sent as written — they are the words the model sings.'
+ : 'Only this fixed musical profile crosses the peer boundary; your prompt and lyrics remain on this instance.'}
+ </p>
</RemoteMediaTargetPicker>
{!isRemote && (
@@ -634,9 +658,9 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
<input
id="musicgen-instrumental-only"
type="checkbox"
- checked={isRemote || instrumentalOnly}
+ checked={effectiveInstrumentalOnly}
onChange={(event) => setInstrumentalOnly(event.target.checked)}
- disabled={isGenerating || isRemote}
+ disabled={isGenerating || forcedInstrumental}
aria-describedby="musicgen-instrumental-only-hint"
className="h-4 w-4 accent-port-accent"
/>
@@ -645,12 +669,16 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
</label>
</div>
<p id="musicgen-instrumental-only-hint" className="mt-1 text-[11px] text-gray-500">
- {isRemote
- ? 'Remote audio is instrumental-only; your prompt and lyrics remain on this instance.'
- : instrumentalOnly
+ {forcedInstrumental
+ ? generationEngine?.lyrics
+ ? 'This peer runs a PortOS build that cannot carry lyrics, so this render is instrumental. Your prompt and lyrics stay on this instance.'
+ : 'The selected remote model is instrumental-only. Your prompt and lyrics stay on this instance.'
+ : effectiveInstrumentalOnly
? `An explicit no-vocals instruction will be added${hasLyrics ? '; saved lyrics will not condition this render' : ''}.`
: generationEngine?.lyrics && hasLyrics
- ? 'This engine will use the track’s lyrics as conditioning.'
+ ? isRemote
+ ? 'The track’s lyrics will be sent to this peer as conditioning; your prompt stays on this instance.'
+ : 'This engine will use the track’s lyrics as conditioning.'
: 'No lyric text will condition this render, but vocals may still follow the prompt unless instrumental mode is enabled.'}
</p>
</div>
diff --git a/client/src/components/music/MusicGenPanel.test.jsx b/client/src/components/music/MusicGenPanel.test.jsx
index 1d8bd455f9..168fa93c9e 100644
--- a/client/src/components/music/MusicGenPanel.test.jsx
+++ b/client/src/components/music/MusicGenPanel.test.jsx
@@ -266,37 +266,43 @@ describe('MusicGenPanel', () => {
expect(onGenerated).toHaveBeenCalledWith(expect.objectContaining({ id: 'generated-track' }));
});
- it('selects a fresh federated audio provider without sending prompt or lyrics as conditioning', async () => {
+ const lyricCapablePeer = (capabilityOverrides = {}) => ({
+ id: 'peer-example',
+ name: 'Example GPU',
+ status: 'online',
+ mediaProvider: { enabled: true, audioModels: [{ engine: 'minimax-music3', modelId: 'minimax-music3' }] },
+ mediaProviderStatus: {
+ state: 'ready',
+ // A capacity claim needs a verifiable freshness window: the panel
+ // re-derives `stale` at render time rather than trusting the state
+ // the probe recorded, so a snapshot with no window reads as stale.
+ checkedAt: new Date().toISOString(),
+ freshUntil: new Date(Date.now() + 60_000).toISOString(),
+ snapshot: {
+ queue: { accepting: true, running: 0, queued: 0 },
+ capabilities: [{
+ kind: 'audio', engine: 'minimax-music3', engineName: 'MiniMax Music 3', modelId: 'minimax-music3',
+ modelName: 'MiniMax Music 3', ready: true, autoDuration: false, lyrics: true,
+ minDurationSec: 10, maxDurationSec: 300, defaultDurationSec: 60,
+ ...capabilityOverrides,
+ }],
+ },
+ },
+ });
+
+ // The mixed-version case, and the reason `acceptsLyrics` exists at all: this
+ // peer's MODEL sings (`lyrics: true`) but its build predates lyrical
+ // federation and never publishes `acceptsLyrics`. Absent must read as false,
+ // or the panel offers a render the peer answers with a 400.
+ it('falls back to an instrumental remote render when the peer build cannot carry lyrics', async () => {
api.listMusicEngines.mockResolvedValue({ defaultEngine: 'musicgen', engines: [engine({ ready: true })] });
- api.getInstances.mockResolvedValue({
- peers: [{
- id: 'peer-example',
- name: 'Example GPU',
- status: 'online',
- mediaProvider: { enabled: true, audioModels: [{ engine: 'minimax-music3', modelId: 'minimax-music3' }] },
- mediaProviderStatus: {
- state: 'ready',
- // A capacity claim needs a verifiable freshness window: the panel
- // re-derives `stale` at render time rather than trusting the state
- // the probe recorded, so a snapshot with no window reads as stale.
- checkedAt: new Date().toISOString(),
- freshUntil: new Date(Date.now() + 60_000).toISOString(),
- snapshot: {
- queue: { accepting: true, running: 0, queued: 0 },
- capabilities: [{
- kind: 'audio', engine: 'minimax-music3', engineName: 'MiniMax Music 3', modelId: 'minimax-music3',
- modelName: 'MiniMax Music 3', ready: true, autoDuration: false, lyrics: true,
- minDurationSec: 10, maxDurationSec: 300, defaultDurationSec: 60,
- }],
- },
- },
- }],
- });
+ api.getInstances.mockResolvedValue({ peers: [lyricCapablePeer()] });
api.generateMusic.mockResolvedValue({ track: { id: 'track-1' } });
render(<MusicGenPanel track={{ id: 'track-1' }} prompt="private prompt" lyrics="private lyrics" />);
fireEvent.change(await screen.findByRole('combobox', { name: /generation target/i }), { target: { value: 'peer-example' } });
+ expect(screen.getByLabelText(/instrumental only/i)).toBeDisabled();
fireEvent.click(screen.getByRole('button', { name: /^generate$/i }));
await waitFor(() => expect(api.generateMusic).toHaveBeenCalledWith(expect.objectContaining({
@@ -312,6 +318,48 @@ describe('MusicGenPanel', () => {
expect(requestBody).not.toHaveProperty('lyrics');
});
+ // ADR docs/decisions/2026-08-22-federated-media-input-assets.md rule 2: the
+ // words the model sings cross. The free-form style prompt still does not, but
+ // that is the SERVER's doing — it blanks params.prompt and renders the wire
+ // prompt from the profile — so this body legitimately carries it for the
+ // track record. federatedMediaProvider.test.js guards the wire side.
+ it('sends lyrics to a peer that advertises it accepts them', async () => {
+ api.listMusicEngines.mockResolvedValue({ defaultEngine: 'musicgen', engines: [engine({ ready: true })] });
+ api.getInstances.mockResolvedValue({ peers: [lyricCapablePeer({ acceptsLyrics: true })] });
+ api.generateMusic.mockResolvedValue({ track: { id: 'track-1' } });
+
+ render(<MusicGenPanel track={{ id: 'track-1' }} prompt="private prompt" lyrics="private lyrics" />);
+
+ fireEvent.change(await screen.findByRole('combobox', { name: /generation target/i }), { target: { value: 'peer-example' } });
+ // Instrumental is an ordinary choice again once the peer can sing.
+ expect(screen.getByLabelText(/instrumental only/i)).not.toBeDisabled();
+ fireEvent.click(screen.getByRole('button', { name: /^generate$/i }));
+
+ await waitFor(() => expect(api.generateMusic).toHaveBeenCalledWith(expect.objectContaining({
+ mediaProviderPeerId: 'peer-example',
+ instrumentalOnly: false,
+ lyrics: 'private lyrics',
+ }), { silent: true }));
+ });
+
+ it('drops lyrics from a lyric-capable remote render when instrumental-only is chosen', async () => {
+ api.listMusicEngines.mockResolvedValue({ defaultEngine: 'musicgen', engines: [engine({ ready: true })] });
+ api.getInstances.mockResolvedValue({ peers: [lyricCapablePeer({ acceptsLyrics: true })] });
+ api.generateMusic.mockResolvedValue({ track: { id: 'track-1' } });
+
+ render(<MusicGenPanel track={{ id: 'track-1' }} prompt="private prompt" lyrics="private lyrics" />);
+
+ fireEvent.change(await screen.findByRole('combobox', { name: /generation target/i }), { target: { value: 'peer-example' } });
+ fireEvent.click(screen.getByLabelText(/instrumental only/i));
+ fireEvent.click(screen.getByRole('button', { name: /^generate$/i }));
+
+ // The field still rides along so the track record keeps the authored words;
+ // `instrumentalOnly` is what the server reads to drop the conditioning.
+ await waitFor(() => expect(api.generateMusic).toHaveBeenCalledWith(expect.objectContaining({
+ instrumentalOnly: true,
+ }), { silent: true }));
+ });
+
// The usable branch has no remedy text behind it, so without an assertion
// here collapsing it back to `help || 'requires a ready peer'` would print
// the not-ready sentence beside an enabled button and still ship green.
diff --git a/docs/FEDERATED_MEDIA_PROVIDERS.md b/docs/FEDERATED_MEDIA_PROVIDERS.md
index 4b20070bc8..809ddb8d0f 100644
--- a/docs/FEDERATED_MEDIA_PROVIDERS.md
+++ b/docs/FEDERATED_MEDIA_PROVIDERS.md
@@ -89,7 +89,18 @@ An API caller deliberately selects remote execution on Music generation by sendi
}
```
-`POST /api/music/generate` performs the fresh capacity preflight before returning the normal queued media-job response. Omitting `mediaProviderPeerId` keeps the existing local-engine behavior. The peer id and free-form `prompt` stay local. The worker renders the provider prompt only from the profile's enum values; non-empty remote lyrics are rejected so arbitrary personal text cannot cross the federation boundary.
+`POST /api/music/generate` performs the fresh capacity preflight before returning the normal queued media-job response. Omitting `mediaProviderPeerId` keeps the existing local-engine behavior. The peer id and free-form `prompt` stay local — the worker renders the provider prompt only from the profile's enum values.
+
+**Lyrics do cross**, and the asymmetry between the two text fields is deliberate. A style/mood/instrument profile renders the prompt at no expressive cost, so the privacy-safe canonical form is required there; lyrics *are* the words, so no alphabet encodes them without discarding them (ADR [conditioning crosses to an allowlisted peer](decisions/2026-08-22-federated-media-input-assets.md) rule 2). Add a `lyrics` field alongside the profile to condition a remote render.
+
+Sending them needs **two** capability signals to agree, and the second is the one that matters on a mixed-version tailnet:
+
+| Capability field | Means | Absent |
+|---|---|---|
+| `lyrics` | the **model** sings | — (always present) |
+| `acceptsLyrics` | **this provider's build** carries lyrics on the wire | reads as `false` |
+
+A provider predating lyrical federation advertises `lyrics: true` for MiniMax Music 3 and then rejects the field at submission, so absence must fail closed or every remote lyrical render becomes a 400 the user cannot act on. When it does, `POST /api/music/generate` refuses with `400 MEDIA_PROVIDER_LYRICS_UNSUPPORTED` naming which half is missing, and Music Studio pins Instrumental only with the reason — it never silently renders a wordless take of a song the user wrote words for.
### Remote image and video renders
@@ -423,11 +434,11 @@ Send a unique, stable `Idempotency-Key` header with the canonical instrumental r
}
```
-Unknown fields, free-form prompts, and non-empty lyrics are rejected. The contract accepts no source URL, filesystem path, shell argument, provider credential, or arbitrary proxy target. Keeping the wire shape as prompt text lets an older wire-v1 provider accept a newer consumer, while the canonical grammar lets a newer provider fail closed on arbitrary text from an older consumer.
+Unknown fields and free-form style prompts are rejected. Lyrics are accepted for a model whose capability reports `lyrics: true`, and refused with `400 MEDIA_PROVIDER_LYRICS_UNSUPPORTED` otherwise — dropping them would render a plausible take of the wrong thing. The contract accepts no source URL, filesystem path, shell argument, provider credential, or arbitrary proxy target. Keeping the wire shape as prompt text lets an older wire-v1 provider accept a newer consumer, while the canonical grammar lets a newer provider fail closed on arbitrary text from an older consumer.
Within the queue's retained job window, repeating the same caller/key/body returns the original job without enqueuing again. Reusing that key with a different body returns `409 MEDIA_PROVIDER_IDEMPOTENCY_CONFLICT`. Job lookup and cancellation return the same not-found response for an unknown id and another peer's id.
-The provider persists accepted work in the existing machine-local `data/media-jobs.json` queue. No commission, CoS, schedule, taste, Digital Twin record, free-form prompt, or lyrics are copied to the provider. Its queue contains only the canonical instrumental prompt derived from fixed musical descriptors.
+The provider persists accepted work in the existing machine-local `data/media-jobs.json` queue. No commission, CoS, schedule, taste, Digital Twin record, or free-form style prompt is copied to the provider — its queue holds the canonical prompt derived from fixed musical descriptors, plus the submitted lyrics when the caller sent them.
### Download and verify a result
@@ -453,8 +464,16 @@ Each kind then registers the render exactly as a local one would, which is what
The sidecar and history row record the render's provenance as `federatedPeerId` / `federatedJobId` — instance-level identifiers already shared across the federation, never a hostname, address, or credential.
-A remote job's conditioning prompt is persisted **only inside its versioned `remoteMedia` marker**, never in top-level job params. That is what makes a rolled-back install fail closed: an older build cannot route the marker, so it falls through to the local generator with an empty prompt and no configured runtime instead of quietly re-rendering the job on local hardware. The queue's public job projection rebuilds the prompt for display without exposing peer routing state.
+A remote job's conditioning — the prompt, and an audio job's lyrics — is persisted **only inside its versioned `remoteMedia` marker**, never in top-level job params. That is what makes a rolled-back install fail closed: an older build cannot route the marker, so it falls through to the local generator with an empty prompt and no configured runtime instead of quietly re-rendering the job on local hardware. The queue's public job projection rebuilds the prompt for display without exposing peer routing state.
## Current boundary
-Wire v1 carries instrumental audio, text-to-image, and text-to-video. Interactive remote selection is exposed on the Image Gen, Video Gen and Music Studio surfaces; unattended work routes through **Instances → Unattended render routing**. Still remaining from #4348: a privacy-preserving design for remote lyrical conditioning (which is also what keeps unattended audio local), input-asset transfer (init/reference images, LoRAs, chained renders), and multi-provider fairness/failover.
+Wire v1 carries lyrical and instrumental audio, text-to-image, and text-to-video. Interactive remote selection is exposed on the Image Gen, Video Gen and Music Studio surfaces; unattended work routes through **Instances → Unattended render routing**.
+
+The boundary's remaining edges are **decisions, not gaps** — see ADR [conditioning crosses to an allowlisted peer](decisions/2026-08-22-federated-media-input-assets.md):
+
+- **LoRA weights never cross** (rule 3). A LoRA is a model, not conditioning, and remote model installation is out of scope for federation. Install it on the provider and allowlist a model that uses it.
+- **Multi-step chain state never crosses** (rule 4) — a source video to extend, chained chunks, IC-LoRA references. The consumer sequences the chain; a provider holding one step of it cannot see the rest.
+- **No automatic fairness or failover** (rule 5). A job that silently re-targets another peer has changed both where the data went and which model produced the result.
+
+Each is refused with `400 MEDIA_PROVIDER_INPUT_UNSUPPORTED` naming what has to go.
diff --git a/docs/README.md b/docs/README.md
index 86e17b7ed4..ed9cdfd0be 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -47,7 +47,7 @@ Comms & voice: [openclaw-operator-chat](./features/openclaw-operator-chat.md) ([
## Point-in-time records
- **[plans/](./plans/README.md)** — dated design plans (`YYYY-MM-DD-<slug>.md`), archived on approval before implementation. Historical records, not living docs.
-- **decisions/** — ADRs (`YYYY-MM-DD-<slug>.md`), e.g. the [Postgres-as-primary-datastore decision](./decisions/2026-06-07-postgres-as-primary-datastore.md) and what may cross the federation layer ([privacy records machine-local](./decisions/2026-08-08-privacy-records-machine-local.md), [federated visual prompts](./decisions/2026-08-20-federated-visual-prompts.md)).
+- **decisions/** — ADRs (`YYYY-MM-DD-<slug>.md`), e.g. the [Postgres-as-primary-datastore decision](./decisions/2026-06-07-postgres-as-primary-datastore.md) and what may cross the federation layer ([privacy records machine-local](./decisions/2026-08-08-privacy-records-machine-local.md), [federated visual prompts](./decisions/2026-08-20-federated-visual-prompts.md), [conditioning crosses to an allowlisted peer](./decisions/2026-08-22-federated-media-input-assets.md)).
- **research/** — dated investigation and incident write-ups (e.g. the [mflux GPU-watchdog panic](./research/2026-06-13-mflux-training-watchdog-panic.md)).
- **superpowers/** — plan/spec pairs from superpowers-driven builds: `specs/<date>-<slug>-design.md` (design) + `plans/<date>-<slug>.md` (implementation plan).
diff --git a/docs/decisions/2026-08-22-federated-media-input-assets.md b/docs/decisions/2026-08-22-federated-media-input-assets.md
new file mode 100644
index 0000000000..3197bc0677
--- /dev/null
+++ b/docs/decisions/2026-08-22-federated-media-input-assets.md
@@ -0,0 +1,205 @@
+# ADR: Conditioning Crosses to an Allowlisted Peer; Weights and Chain State Do Not
+
+- **Date:** 2026-08-22
+- **Status:** Accepted
+- **Supersedes (in part):** the "Local input assets are out of scope, and stay
+ out" section and rule 2's closing sentence of ADR
+ [federated visual prompts](./2026-08-20-federated-visual-prompts.md), which
+ named both as decisions to be revisited by a later ADR. Rules 1, 3, 4 and 5 of
+ that ADR are unchanged and still govern.
+- **Related:** epic #4348 (federated media providers),
+ [`server/lib/federatedMediaWire.js`](../../server/lib/federatedMediaWire.js),
+ [`server/lib/validation.js`](../../server/lib/validation.js),
+ [`docs/FEDERATED_MEDIA_PROVIDERS.md`](../FEDERATED_MEDIA_PROVIDERS.md),
+ ADR [privacy records machine-local](./2026-08-08-privacy-records-machine-local.md) (#2148).
+
+## Context
+
+Federated media rendering shipped text-to-image, text-to-video and instrumental
+text-to-audio. Four items were deliberately left undecided rather than
+unimplemented, and each one has been re-raised by a later review because there
+was no record saying which way it went:
+
+1. **Input-asset transfer.** An init image, a reference image or a start/end
+ video frame is refused with `400 MEDIA_PROVIDER_INPUT_UNSUPPORTED`. That
+ makes every image-to-image, reference-conditioned and keyframed render
+ local-only, which is exactly the work a user offloads to the GPU peer.
+2. **Remote lyrical conditioning.** A federated audio submission is instrumental
+ only. The flagship federatable audio model (MiniMax Music 3) is a *lyrical*
+ model, so the one thing worth sending it is the one thing the wire refuses.
+3. **Multi-provider fairness / failover.**
+4. **A fixed-vocabulary "visual profile"** as a privacy-preserving substitute
+ for a free-form image/video prompt.
+
+The prior ADR settled the general shape — a *submission body* may carry what the
+work is; a *status payload* may carry nothing — but explicitly reserved (1) and
+(2) for a new ADR, because both widen what a submission body contains rather
+than merely restating rule 1. This ADR decides all four.
+
+## Decision
+
+**Conditioning is part of the submission, and crosses under the same gate as the
+prompt. Model weights and multi-step chain state are not conditioning, and do
+not cross at all.**
+
+### 1. Conditioning images cross as uploaded assets
+
+An init image, reference images, and a video start/end frame are what the render
+is *of*. Rule 1 of the prior ADR already answered the general question for
+prompts — "a peer that cannot read the prompt cannot do the work at all" — and
+an image-to-image render is the same argument with a denser payload: a peer that
+cannot read the init image cannot perform an image-to-image render, so "render
+this remotely" and "the source image stays home" are mutually exclusive for that
+mode, exactly as they were for the prompt.
+
+The denser payload does change the *mechanism*, not the *authorization*:
+
+- Bytes travel through a dedicated, authenticated provider endpoint
+ (`POST /api/federation/media/v1/assets`), never inline in a job body and never
+ as a filesystem path. The upload declares its SHA-256 and the provider
+ verifies it before storing, so a truncated or altered transfer fails rather
+ than rendering something subtly different.
+- The provider stores an uploaded asset **caller-scoped**, keyed by content
+ hash, in a staging area outside every user-facing media root, with a bounded
+ TTL and an explicit size and MIME allowlist. Re-uploading identical bytes is
+ idempotent, which is what makes a reconcile after a restart free rather than a
+ second multi-megabyte transfer.
+- A provider advertises whether it accepts input assets at all, and with what
+ limits, on its capability projection. **Absent reads as unknown, never as
+ supported** — an older provider that has never heard of the field keeps
+ refusing conditioning, and a consumer that cannot see the field refuses to
+ send it. That is the same fail-closed rule the queue-capacity fields already
+ follow.
+- Every existing gate still applies unchanged: the peer must be registered,
+ enabled, enabled as a media provider, allowlisted for this exact
+ kind/engine/model, authenticated with a verified Basic credential, and — for a
+ standing unattended route — recognized as a tailnet host (rule 5 of the prior
+ ADR). Conditioning does not get its own weaker path.
+
+### 2. Lyrics cross; the instrumental style prompt still does not
+
+Rule 2 of the prior ADR required a privacy-safe canonical form *where one is
+available at no expressive cost*, and closed by noting that remote lyrical
+conditioning stayed unsolved. It is not unsolved so much as mis-framed: the
+qualifier was doing all the work, and lyrics fail it.
+
+A style/mood/instrument profile renders an instrumental prompt with no
+expressive loss, so the fixed-vocabulary requirement stays exactly as it is for
+`prompt`. **Lyrics have no such form.** Lyrics *are* the words; there is no
+alphabet that encodes them without discarding them, which is the same reason the
+prior ADR rejected a fixed vocabulary for visual prompts. So lyrics cross
+verbatim under rule 1's logic, bounded by length and gated on the provider
+capability already advertising `lyrics: true` for the selected model.
+
+The consequence for persisted state is deliberate and is called out here because
+it reverses an earlier comment: the remote audio marker now stores the lyrics it
+will submit, exactly as the image and video markers already store their prompts.
+Keeping them out was what made a routed audio job unable to carry the
+conditioning it was routed to produce.
+
+### 3. Model weights do not cross
+
+A LoRA is not conditioning — it is a model. The issue that opened this work
+lists **remote model installation and automatic model downloads under Out of
+scope**, and nothing here changes that: a provider renders with the models its
+operator installed and allowlisted, and a consumer selects from that
+advertisement. A per-job weight upload would be a model-distribution channel
+wearing a conditioning costume — unbounded in size, persistent in effect on the
+provider, and outside the capability contract that makes provider selection
+honest.
+
+A federated request naming LoRA weights therefore keeps failing closed with
+`MEDIA_PROVIDER_INPUT_UNSUPPORTED`, naming the weights as the reason. The
+supported path for a user who wants remote LoRA rendering is to install the LoRA
+on the provider and allowlist a model that uses it.
+
+### 4. Multi-step chain state does not cross
+
+A source video to extend, chained chunks, and IC-LoRA video references are not
+single-render conditioning: they are the state of a multi-step pipeline whose
+steps the consumer sequences. Sending them would make the provider a
+partial owner of a chain it cannot see the rest of, and it re-opens the failover
+question in the middle of a sequence. These stay local, refused with the same
+typed code.
+
+### 5. Multi-provider fairness and failover: won't-do
+
+Declined, not deferred. Automatic load balancing is listed under **Out of scope**
+on issue #4348, and automatic failover directly contradicts the fail-closed
+routing decision taken in #4679: a job that silently re-targets a different peer
+on failure has changed both *where the user's data went* and *which model
+produced the result*, without anyone seeing it happen. Both are exactly the
+outcomes the explicit-selection contract exists to prevent.
+
+If a future need for this appears, it needs a decision about routing policy and
+idempotent re-submission first, and its own ADR — reopening it as an
+implementation detail is what this entry exists to prevent.
+
+### 6. A fixed-vocabulary visual profile: won't-do
+
+Declined. The prior ADR already rejected it under Alternatives considered — "any
+enum small enough to be privacy-safe cannot express what the user asked for… it
+would not protect the prompt so much as discard it." It is recorded here only
+because it kept resurfacing as an open item on #4348 after that ADR settled it.
+
+## Alternatives considered
+
+- **Inline the asset in the job body as base64.** Rejected: it inflates the
+ payload by a third, forces the whole conditioning set through the JSON body
+ size limit, and makes an idempotent replay after a restart re-send every byte.
+ A separate content-addressed endpoint gets deduplication and integrity checking
+ for free.
+
+- **Let the provider fetch the asset from the consumer by URL.** Rejected: it
+ inverts the connection direction the federation transport is built around
+ (the consumer holds the peer credential and initiates every hop), and it would
+ require the consumer to expose an unauthenticated or separately-credentialed
+ asset surface to a peer. Push, authenticated by the same credential as every
+ other hop, adds no new inbound attack surface.
+
+- **Keep refusing conditioning and tell users to render locally.** Rejected: it
+ is the status quo, and it removes remote rendering from precisely the workloads
+ where offloading matters most. The peer is allowlisted for this work because
+ it is trusted with it — a reference image is denser than a prompt, but it is
+ the same trust boundary and the same machine.
+
+- **Strip or downscale the asset before sending.** Rejected for the same reason
+ the prior ADR rejected redacting names from prompts: it makes the render
+ silently wrong. A conditioning image that arrives altered produces a plausible
+ render of something the user did not ask for.
+
+- **Allow lyrics only when the consumer confirms per render.** Rejected as
+ security theater on top of a decision already made locally: enabling a peer as
+ a media provider and allowlisting a lyrical model for it *is* the consent, and
+ a second prompt on every render trains the user to click through it.
+
+## Consequences
+
+- The wire stays **version 1**. Every field this decision adds is optional in
+ both directions, and absence reads as *unsupported*, so an older provider and
+ a newer consumer (and the reverse) both degrade to the pre-existing
+ text-only behavior instead of failing. No `SCHEMA_VERSIONS` bump is warranted:
+ no record kind, sync category, or federated record shape changes.
+- Rule 3 of the prior ADR is untouched and its guard still holds: status and
+ capability payloads carry counts, readiness and limits — never a prompt, never
+ lyrics, and never an asset, a filename, or a hash derived from one. The
+ capability's input-asset block is limits only.
+- A provider now accepts inbound bytes, which it did not before. The staging
+ area is caller-scoped, size-capped, MIME-allowlisted, content-hash-verified,
+ TTL-swept, excluded from backups, and outside every media root the gallery or
+ the sync layer reads — so an uploaded asset can never be mistaken for local
+ user content or federated onward as a record.
+- "Is this conditioning, a model, or chain state?" is the question any future
+ federated input must answer. The three answers above are the precedent, and
+ the second and third are refusals rather than gaps — a reviewer finding
+ `MEDIA_PROVIDER_INPUT_UNSUPPORTED` on a LoRA is looking at a decision, not a
+ to-do.
+
+## Revisiting
+
+Rules 3 and 4 are refusals with stated reasons; changing either needs a new ADR
+naming what changed about the reason. Rule 1's mechanism may be extended to
+further conditioning *kinds* under the same gate without a new ADR, provided the
+new kind is single-render conditioning rather than a model or chain state, and
+provided it keeps the capability-gated, hash-verified, caller-scoped, TTL-bounded
+transfer described above.
diff --git a/server/lib/federatedMediaWire.js b/server/lib/federatedMediaWire.js
index 6a9026dc85..10465961e2 100644
--- a/server/lib/federatedMediaWire.js
+++ b/server/lib/federatedMediaWire.js
@@ -166,7 +166,20 @@ export const federatedMediaCapabilitySchema = z.object({
minDurationSec: z.number().finite().positive().nullable(),
maxDurationSec: z.number().finite().positive().nullable(),
defaultDurationSec: z.number().finite().positive().nullable(),
+ // Does the MODEL sing? A property of the engine, and true on providers that
+ // predate lyrical federation entirely — which is why it cannot double as the
+ // consumer's permission to send words.
lyrics: z.boolean(),
+ // Does THIS PROVIDER's wire accept lyrics for this capability? Added after
+ // wire v1 shipped (ADR
+ // docs/decisions/2026-08-22-federated-media-input-assets.md rule 2), so it is
+ // optional and **absent must read as false**: a provider built before that
+ // ADR advertises `lyrics: true` for MiniMax Music 3 and then rejects the
+ // lyrics field outright at submission. Treating the older signal as consent
+ // would turn every remote lyrical render into a hard 400 the user cannot act
+ // on. Fail closed here and the consumer degrades to an instrumental render it
+ // can explain instead.
+ acceptsLyrics: z.boolean().optional(),
autoDuration: z.boolean(),
frameStride: z.number().int().min(1).max(64).nullable().optional(),
maxNumFrames: z.number().int().min(1).max(600).nullable().optional(),
diff --git a/server/lib/validation.js b/server/lib/validation.js
index f0e5b6ede1..1016d70bba 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -779,10 +779,17 @@ export const federatedMediaJobRoutingSchema = z.object({
durationMode: z.enum(['auto', 'manual']).optional(),
}).strict();
-// Provider submissions intentionally accept model selection plus only the
-// canonical fixed-vocabulary instrumental prompt. Free-form prompt/lyrics can
-// contain PII and must remain on the consumer; URLs, paths, commands, provider
-// credentials, and unknown fields are excluded by the strict object as before.
+// Provider submissions accept model selection, the canonical fixed-vocabulary
+// instrumental prompt, and — since ADR
+// docs/decisions/2026-08-22-federated-media-input-assets.md rule 2 — free-form
+// lyrics. The asymmetry between the two text fields is deliberate rather than
+// inconsistent: a style/mood/instrument profile renders `prompt` with no
+// expressive loss, so the privacy-safe canonical form is required there; lyrics
+// ARE the words, so no alphabet encodes them without discarding them, and they
+// cross verbatim under the same submission-body rule image/video prompts do.
+// The provider still refuses them for a model whose capability reports
+// `lyrics: false`. URLs, paths, commands, provider credentials, and unknown
+// fields are excluded by the strict object as before.
const federatedMediaAudioJobSubmissionSchema = federatedMediaJobRoutingSchema.extend({
kind: z.literal('audio'),
prompt: z.string().trim().min(1).max(8000),
@@ -795,13 +802,6 @@ const federatedMediaAudioJobSubmissionSchema = federatedMediaJobRoutingSchema.ex
message: 'prompt must be rendered from a privacy-safe federated audio profile',
});
}
- if (value.lyrics) {
- ctx.addIssue({
- code: 'custom',
- path: ['lyrics'],
- message: 'federated audio submissions are instrumental only',
- });
- }
});
// Image/video prompts cross as submitted, with no fixed-vocabulary rendering
diff --git a/server/routes/federatedMedia.test.js b/server/routes/federatedMedia.test.js
index 907e35ad5a..5cc404ed37 100644
--- a/server/routes/federatedMedia.test.js
+++ b/server/routes/federatedMedia.test.js
@@ -98,21 +98,34 @@ describe('federated media routes', () => {
expect(provider.submit).not.toHaveBeenCalled();
});
- it('rejects free-form prompts and lyrics at the provider boundary', async () => {
+ it('rejects a free-form style prompt at the provider boundary', async () => {
const freeform = await request(buildApp()).post('/api/federation/media/v1/jobs')
.set('Idempotency-Key', 'commission-private').send({
engine: 'minimax-music3', modelId: 'minimax-music3', prompt: 'Write about [email protected]',
});
- const lyrics = await request(buildApp()).post('/api/federation/media/v1/jobs')
- .set('Idempotency-Key', 'commission-private-lyrics').send({
- engine: 'minimax-music3', modelId: 'minimax-music3', prompt: safePrompt, lyrics: 'Private words',
- });
expect(freeform.status).toBe(400);
- expect(lyrics.status).toBe(400);
expect(provider.submit).not.toHaveBeenCalled();
});
+ // The style prompt and the lyrics are governed by opposite halves of the same
+ // rule (ADR docs/decisions/2026-08-22-federated-media-input-assets.md rule 2):
+ // a fixed profile renders the prompt at no expressive cost, so it is required
+ // there; lyrics ARE the words, so no alphabet encodes them without discarding
+ // them. Whether the model may sing is the PROVIDER's call at admission, not
+ // this schema's — so the route must hand them through untouched.
+ it('passes lyrics through to the provider for its own capability check', async () => {
+ const response = await request(buildApp()).post('/api/federation/media/v1/jobs')
+ .set('Idempotency-Key', 'commission-lyrics').send({
+ engine: 'minimax-music3', modelId: 'minimax-music3', prompt: safePrompt, lyrics: '[verse]\nPrivate words',
+ });
+
+ expect(response.status).toBe(202);
+ expect(provider.submit).toHaveBeenCalledWith(expect.objectContaining({
+ input: expect.objectContaining({ kind: 'audio', lyrics: '[verse]\nPrivate words' }),
+ }));
+ });
+
it('serves completed bytes with an integrity header and no source path', async () => {
const response = await request(buildApp()).get(`/api/federation/media/v1/jobs/${jobId}/result`);
expect(response.status).toBe(200);
diff --git a/server/routes/music.js b/server/routes/music.js
index bd9f773c05..85513e579f 100644
--- a/server/routes/music.js
+++ b/server/routes/music.js
@@ -383,13 +383,11 @@ const generateSchema = z.object({
if (!value.remoteMusicProfile) {
ctx.addIssue({ code: 'custom', path: ['remoteMusicProfile'], message: 'remoteMusicProfile is required for a remote media provider' });
}
- if (value.lyrics) {
- ctx.addIssue({
- code: 'custom',
- path: ['lyrics'],
- message: 'Remote media generation is instrumental only so personal lyrics stay machine-local',
- });
- }
+ // Lyrics used to be refused outright here. They now cross to an allowlisted
+ // peer (ADR docs/decisions/2026-08-22-federated-media-input-assets.md rule 2),
+ // but only when the resolved capability says the model sings AND the peer's
+ // build accepts them on the wire — neither of which this schema can see.
+ // The check moved into the handler, below the capability resolve.
});
const INSTRUMENTAL_ONLY_GUIDANCE = 'Instrumental only. Do not include sung, spoken, chanted, choir, or background vocals. Carry the lead melody with the described instruments or textures.';
@@ -454,9 +452,27 @@ router.post('/generate', asyncHandler(async (req, res) => {
},
});
}
+ // Two independent facts, and conflating them is how a lyrical render
+ // silently comes back instrumental: `lyrics` says the MODEL sings,
+ // `acceptsLyrics` says this PEER'S BUILD carries the words. A provider
+ // predating lyrical federation reports the first as true and the second not
+ // at all — so absent reads as false, and a caller that actually sent words
+ // is told why rather than getting a plausible render of the wrong thing.
+ if (body.lyrics && !body.instrumentalOnly && capability.acceptsLyrics !== true) {
+ throw new ServerError(
+ capability.lyrics
+ ? 'The selected peer runs a PortOS build that cannot carry lyrics to its provider. Update the peer, or render this track locally.'
+ : 'The selected remote model renders instrumental audio only. Pick a lyric-capable model, or render this track locally.',
+ { status: 400, code: 'MEDIA_PROVIDER_LYRICS_UNSUPPORTED' },
+ );
+ }
engine = {
id: capability.engine,
name: capability.engineName,
+ // The model's own capability, not the wire's: this drives the render
+ // snapshot (`lyricsEnabled`), which records what the engine is, and the
+ // guard above already refused the one combination where the two disagree
+ // in a way that would change the audio.
lyrics: capability.lyrics,
};
remoteMedia = {
@@ -503,6 +519,12 @@ router.post('/generate', asyncHandler(async (req, res) => {
: body.prompt;
const usedLyrics = engine.lyrics && !body.instrumentalOnly ? (body.lyrics ?? '') : '';
if (remoteMedia) {
+ // Lyrics ride the marker, not the top-level params, for the same reason the
+ // profile does: `params.lyrics` stays blank so a build rolled back past
+ // `remoteMedia` fails closed instead of re-rendering locally (#4683).
+ // Omitted when empty so an instrumental remote render submits — and
+ // idempotency-hashes — exactly the body a pre-lyrics build did.
+ if (usedLyrics) remoteMedia.lyrics = usedLyrics;
remoteMedia.request = {
engine: engine.id,
modelId: body.modelId,
diff --git a/server/routes/music.test.js b/server/routes/music.test.js
index dc43a2f8ea..536747ff94 100644
--- a/server/routes/music.test.js
+++ b/server/routes/music.test.js
@@ -651,24 +651,106 @@ describe('music routes', () => {
expect(mediaQueue.enqueue).not.toHaveBeenCalled();
});
- it('POST /generate rejects free-form lyrics before probing a remote provider', async () => {
+ // Lyrics reach an allowlisted peer since ADR
+ // docs/decisions/2026-08-22-federated-media-input-assets.md rule 2 — but only
+ // when the resolved capability advertises BOTH that the model sings and that
+ // the peer's build carries the words. The three cases below are the whole
+ // contract: a peer too old to say so, a model that cannot sing, and the one
+ // combination that ships.
+ const remoteLyricRequest = (peer, overrides = {}) => ({
+ prompt: 'private concept',
+ lyrics: '[verse]\nCall [email protected]',
+ engine: 'remote-audio',
+ modelId: 'example/model',
+ mediaProviderPeerId: peer.id,
+ remoteMusicProfile: { style: 'ambient', mood: 'calm' },
+ ...overrides,
+ });
+ const remoteLyricCapability = (overrides) => ({
+ kind: 'audio',
+ engine: 'remote-audio',
+ engineName: 'Remote Audio',
+ modelId: 'example/model',
+ autoDuration: false,
+ minDurationSec: 10,
+ maxDurationSec: 120,
+ ...overrides,
+ });
+
+ it('POST /generate refuses lyrics when the peer build cannot carry them, rather than rendering instrumental', async () => {
const peer = { id: '00000000-0000-4000-8000-000000000001', enabled: true };
remoteProvider.peers = [peer];
+ // A provider predating lyrical federation: the MODEL sings, so `lyrics` is
+ // true, but it never publishes `acceptsLyrics` and rejects the field on
+ // submit. Absent must read as false or every such render is a hard 400 from
+ // the peer that the user cannot act on.
+ remoteProvider.resolve.mockResolvedValueOnce({
+ peer, capability: remoteLyricCapability({ lyrics: true }),
+ });
- const r = await request(app).post('/api/music/generate').send({
- prompt: 'private concept',
- lyrics: 'Call [email protected]',
- engine: 'remote-audio',
- modelId: 'example/model',
- mediaProviderPeerId: peer.id,
- remoteMusicProfile: { style: 'ambient', mood: 'calm' },
+ const r = await request(app).post('/api/music/generate').send(remoteLyricRequest(peer));
+
+ expect(r.status).toBe(400);
+ expect(r.body.code).toBe('MEDIA_PROVIDER_LYRICS_UNSUPPORTED');
+ expect(r.body.error).toContain('Update the peer');
+ expect(mediaQueue.enqueue).not.toHaveBeenCalled();
+ });
+
+ it('POST /generate refuses lyrics for a remote model that renders instrumental only', async () => {
+ const peer = { id: '00000000-0000-4000-8000-000000000001', enabled: true };
+ remoteProvider.peers = [peer];
+ remoteProvider.resolve.mockResolvedValueOnce({
+ peer, capability: remoteLyricCapability({ lyrics: false, acceptsLyrics: false }),
});
+ const r = await request(app).post('/api/music/generate').send(remoteLyricRequest(peer));
+
expect(r.status).toBe(400);
- expect(remoteProvider.resolve).not.toHaveBeenCalled();
+ expect(r.body.code).toBe('MEDIA_PROVIDER_LYRICS_UNSUPPORTED');
+ expect(r.body.error).toContain('instrumental audio only');
expect(mediaQueue.enqueue).not.toHaveBeenCalled();
});
+ it('POST /generate carries lyrics on the remote marker while the style prompt stays fixed-vocabulary', async () => {
+ const peer = { id: '00000000-0000-4000-8000-000000000001', enabled: true };
+ remoteProvider.peers = [peer];
+ remoteProvider.resolve.mockResolvedValueOnce({
+ peer, capability: remoteLyricCapability({ lyrics: true, acceptsLyrics: true }),
+ });
+
+ const r = await request(app).post('/api/music/generate').send(remoteLyricRequest(peer));
+
+ expect(r.status).toBe(202);
+ const params = mediaQueue.enqueue.mock.calls[0][0].params;
+ expect(params.remoteMedia.lyrics).toContain('Call [email protected]');
+ // The style prompt is still rendered from the fixed profile, so the
+ // free-form concept text never leaves this machine — only the words the
+ // user asked to be sung do.
+ expect(params.remoteMedia.profile).toMatchObject({ style: 'ambient', mood: 'calm' });
+ expect(params.remoteMedia.request.prompt).toBeUndefined();
+ expect(params.prompt).toBe('');
+ expect(params.lyrics).toBe('');
+ expect(JSON.stringify(params.remoteMedia)).not.toContain('private concept');
+ });
+
+ it('POST /generate omits lyrics from the remote marker for an instrumental-only take', async () => {
+ const peer = { id: '00000000-0000-4000-8000-000000000001', enabled: true };
+ remoteProvider.peers = [peer];
+ remoteProvider.resolve.mockResolvedValueOnce({
+ peer, capability: remoteLyricCapability({ lyrics: true, acceptsLyrics: true }),
+ });
+
+ const r = await request(app).post('/api/music/generate')
+ .send(remoteLyricRequest(peer, { instrumentalOnly: true }));
+
+ // `instrumentalOnly` wins over supplied lyrics on every lane. Omitted (not
+ // empty-stringed) so this submits — and idempotency-hashes — exactly the
+ // body a pre-lyrics build sent for the same job.
+ expect(r.status).toBe(202);
+ expect(mediaQueue.enqueue.mock.calls[0][0].params.remoteMedia)
+ .not.toHaveProperty('lyrics');
+ });
+
it('POST /generate forwards MiniMax auto duration mode to the queue', async () => {
const r = await request(app).post('/api/music/generate').send({
prompt: 'warm folk',
diff --git a/server/services/audioGen/remote.js b/server/services/audioGen/remote.js
index df1bdf64e9..f59b97aade 100644
--- a/server/services/audioGen/remote.js
+++ b/server/services/audioGen/remote.js
@@ -28,10 +28,18 @@ const remoteMediaMarkerSchema = z.object({
// absence means "interactive", which is the correct reading of history.
standingRoute: z.boolean().optional(),
profile: federatedMediaAudioProfileSchema,
- // Free-form prompt/lyrics are deliberately absent from persisted routing
- // state. The adapter renders a fixed-vocabulary instrumental prompt from the
+ // The free-form STYLE prompt is deliberately absent from persisted routing
+ // state: the adapter renders a fixed-vocabulary instrumental prompt from the
// profile immediately before submission, so hand-edited queue state cannot
- // smuggle personal text onto the federation wire.
+ // smuggle personal prose into the prompt field.
+ //
+ // Lyrics are the exception, and are stored — they are the conditioning a
+ // lyrical render exists to carry, and no fixed vocabulary encodes them
+ // without discarding them (ADR
+ // docs/decisions/2026-08-22-federated-media-input-assets.md rule 2). Optional
+ // so a marker queued by an older build still validates; absent means the
+ // instrumental render that build was the only one able to route.
+ lyrics: z.string().max(50_000).optional(),
request: federatedMediaJobRoutingSchema,
}).passthrough();
@@ -50,7 +58,17 @@ const executor = createRemoteMediaExecutor({
// No explicit `kind` on the wire: an already-deployed audio-only provider
// validates this body against a strict schema that predates the field and
// would reject it. The provider defaults a kind-less body to 'audio'.
- return { ...marker.request, prompt };
+ //
+ // `lyrics` is omitted entirely when the marker has none, rather than sent
+ // as `''`. An older provider's strict schema knows the field but refuses
+ // any truthy value, so an empty string still validates there — but omitting
+ // it keeps the request hash (and therefore idempotent replay) identical to
+ // what a pre-lyrics build submitted for the same instrumental job.
+ return {
+ ...marker.request,
+ prompt,
+ ...(marker.lyrics ? { lyrics: marker.lyrics } : {}),
+ };
},
// PATHS is read per job (not captured at module load) so a test that swaps
// the music directory still sees its own temp root.
diff --git a/server/services/audioGen/remote.test.js b/server/services/audioGen/remote.test.js
index 1667f42533..dee472d2cd 100644
--- a/server/services/audioGen/remote.test.js
+++ b/server/services/audioGen/remote.test.js
@@ -205,6 +205,38 @@ describe('federated audio consumer adapter', () => {
});
});
+ // ADR docs/decisions/2026-08-22-federated-media-input-assets.md rule 2. The
+ // two text fields travel opposite ways on purpose: `prompt` is re-rendered
+ // from the fixed profile so hand-edited queue state cannot smuggle prose onto
+ // the wire, while `lyrics` are submitted verbatim because they ARE the
+ // conditioning. A marker with no lyrics must omit the field entirely, so an
+ // instrumental job hashes to what a pre-lyrics build submitted.
+ it('submits marker lyrics verbatim while still rendering the prompt from the profile', async () => {
+ transport.fetch.mockImplementation(async (url, options) => {
+ if (url.endsWith('/jobs') && options.method === 'POST') return jsonResponse(providerJob('canceled'), 202);
+ if (url.endsWith(`/jobs/${REMOTE_JOB_ID}`)) return jsonResponse(providerJob('canceled'));
+ throw new Error(`Unexpected test URL: ${url}`);
+ });
+
+ const terminal = captureTerminal(LOCAL_JOB_ID);
+ const base = params();
+ await generateAudio({
+ ...base,
+ remoteMedia: { ...base.remoteMedia, lyrics: '[verse]\nremote words' },
+ }).catch(() => {});
+ await terminal;
+
+ const submission = transport.fetch.mock.calls.find(([url, options]) =>
+ url.endsWith('/jobs') && options.method === 'POST');
+ expect(JSON.parse(submission[1].body)).toEqual({
+ engine: 'remote-audio',
+ modelId: 'example/model',
+ prompt: SAFE_PROMPT,
+ durationSec: 30,
+ lyrics: '[verse]\nremote words',
+ });
+ });
+
it('replays an uncertain submission with the same idempotency key', async () => {
const wav = Buffer.from('RIFF-replayed');
const digest = sha256(wav);
diff --git a/server/services/federatedMediaProvider.js b/server/services/federatedMediaProvider.js
index 4d3d1815e1..5e1b3d45e3 100644
--- a/server/services/federatedMediaProvider.js
+++ b/server/services/federatedMediaProvider.js
@@ -221,6 +221,7 @@ async function configuredAudioCapabilities(config) {
maxDurationSec: engine?.maxDurationSec ?? null,
defaultDurationSec: engine?.defaultDurationSec ?? null,
lyrics: engine?.lyrics === true,
+ acceptsLyrics: engine?.lyrics === true,
autoDuration: engine?.autoDuration === true,
frameStride: null,
maxNumFrames: null,
@@ -310,6 +311,7 @@ async function localGeneratorCapabilities(kind, pythonPath, { models, configured
maxDurationSec: null,
defaultDurationSec: null,
lyrics: false,
+ acceptsLyrics: false,
autoDuration: false,
frameStride,
maxNumFrames: Number.isFinite(maxNumFrames) && maxNumFrames > 0 ? maxNumFrames : null,
@@ -624,6 +626,15 @@ export async function submitFederatedMediaJob({ callerId, config, input, idempot
});
}
validateFederatedVideoControls(input, capability._model);
+ // Lyrics reach a lyric-aware model only. `input.lyrics` is checked for a
+ // non-empty string rather than mere presence: a consumer that renders an
+ // instrumental take on a lyrical engine sends `''`, and refusing that would
+ // break a submission carrying no conditioning at all. Rejecting here rather
+ // than dropping the field is the ADR's own rule — a render that silently
+ // discards the words is a plausible render of the wrong thing.
+ if (input.lyrics && !capability.lyrics) {
+ unavailable('Requested model cannot render lyrics', 'MEDIA_PROVIDER_LYRICS_UNSUPPORTED', 400);
+ }
if (input.durationMode === 'auto' && !capability.autoDuration) {
unavailable('Requested engine does not support automatic duration', 'MEDIA_PROVIDER_AUTO_DURATION_UNSUPPORTED', 400);
}
diff --git a/server/services/federatedMediaProvider.test.js b/server/services/federatedMediaProvider.test.js
index eabd41bb9e..9326af224d 100644
--- a/server/services/federatedMediaProvider.test.js
+++ b/server/services/federatedMediaProvider.test.js
@@ -292,6 +292,45 @@ describe('federated media provider capacity and idempotency', () => {
}));
});
+ // ADR docs/decisions/2026-08-22-federated-media-input-assets.md rule 2: lyrics
+ // cross to an allowlisted peer because no fixed vocabulary encodes them
+ // without discarding them — but only into a model that sings.
+ it('renders lyrics on a lyric-capable model and advertises that its wire accepts them', async () => {
+ await submitFederatedMediaJob({
+ callerId: 'peer-example', config: config(),
+ input: { ...input(), lyrics: '[verse]\nwords' }, idempotencyKey: 'commission-lyrics',
+ });
+ expect(enqueueJob).toHaveBeenCalledWith(expect.objectContaining({
+ params: expect.objectContaining({ lyrics: '[verse]\nwords' }),
+ }));
+
+ const status = await getFederatedMediaProviderStatus(config());
+ expect(status.capabilities[0]).toMatchObject({ lyrics: true, acceptsLyrics: true });
+ });
+
+ it('refuses lyrics for an instrumental-only model rather than dropping them', async () => {
+ state.capabilities.engines = [readyEngine({ lyrics: false })];
+ await expect(submitFederatedMediaJob({
+ callerId: 'peer-example', config: config(),
+ input: { ...input(), lyrics: '[verse]\nwords' }, idempotencyKey: 'commission-lyrics',
+ })).rejects.toMatchObject({ status: 400, code: 'MEDIA_PROVIDER_LYRICS_UNSUPPORTED' });
+ expect(enqueueJob).not.toHaveBeenCalled();
+
+ const status = await getFederatedMediaProviderStatus(config());
+ expect(status.capabilities[0]).toMatchObject({ lyrics: false, acceptsLyrics: false });
+ });
+
+ // An instrumental take on a lyrical engine sends `lyrics: ''`. Gating on
+ // presence rather than content would refuse a submission carrying no
+ // conditioning at all.
+ it('admits an empty lyrics field on an instrumental-only model', async () => {
+ state.capabilities.engines = [readyEngine({ lyrics: false })];
+ await expect(submitFederatedMediaJob({
+ callerId: 'peer-example', config: config(),
+ input: { ...input(), lyrics: '' }, idempotencyKey: 'commission-instrumental',
+ })).resolves.toMatchObject({ replayed: false });
+ });
+
it('replays a matching key and rejects a key reused with different input', async () => {
const first = await submitFederatedMediaJob({
callerId: 'peer-example', config: config(), input: input(), idempotencyKey: 'commission-1',