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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
refactor: move the acceptsLyrics build probe to a status-root features list (#4826)
[._.]/ Adam Eivy043b6d75c5c1
diff --git a/client/src/components/music/MusicGenPanel.jsx b/client/src/components/music/MusicGenPanel.jsxindex 61312c4b76..43c8cce1aa 100644--- a/client/src/components/music/MusicGenPanel.jsx+++ b/client/src/components/music/MusicGenPanel.jsx@@ -243,13 +243,12 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artistconst hasLyrics = typeof lyrics === 'string' && lyrics.trim().length > 0;// 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.+ // rule 2): `lyrics` is the model's own capability, while the `lyrics` FEATURE+ // is whether the peer's BUILD carries the words at all. Why an absent feature+ // must read as false lives in `federatedMediaSupports`, not here.const remoteLyricsAvailable = isRemote&& generationEngine?.lyrics === true- && generationEngine?.acceptsLyrics === true;+ && remoteTarget.supports('lyrics');// 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.diff --git a/client/src/components/music/MusicGenPanel.test.jsx b/client/src/components/music/MusicGenPanel.test.jsxindex 168fa93c9e..51543045ca 100644--- a/client/src/components/music/MusicGenPanel.test.jsx+++ b/client/src/components/music/MusicGenPanel.test.jsx@@ -266,7 +266,7 @@ describe('MusicGenPanel', () => {expect(onGenerated).toHaveBeenCalledWith(expect.objectContaining({ id: 'generated-track' }));});- const lyricCapablePeer = (capabilityOverrides = {}) => ({+ const lyricCapablePeer = (capabilityOverrides = {}, features) => ({id: 'peer-example',name: 'Example GPU',status: 'online',@@ -279,6 +279,7 @@ describe('MusicGenPanel', () => {checkedAt: new Date().toISOString(),freshUntil: new Date(Date.now() + 60_000).toISOString(),snapshot: {+ ...(features ? { features } : {}),queue: { accepting: true, running: 0, queued: 0 },capabilities: [{kind: 'audio', engine: 'minimax-music3', engineName: 'MiniMax Music 3', modelId: 'minimax-music3',@@ -342,6 +343,41 @@ describe('MusicGenPanel', () => {}), { silent: true }));});+ // The other end of the same mixed-version window (#4826): a peer on the NEW+ // build advertises the `lyrics` feature at the status root and stops stamping+ // `acceptsLyrics` on every capability. A panel still reading the per-capability+ // field would pin this peer to Instrumental only for no reason.+ it('sends lyrics to a peer that advertises the lyrics feature and no per-capability flag', async () => {+ api.listMusicEngines.mockResolvedValue({ defaultEngine: 'musicgen', engines: [engine({ ready: true })] });+ api.getInstances.mockResolvedValue({ peers: [lyricCapablePeer({}, ['lyrics', 'inputAssets'])] });+ 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)).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('still pins instrumental for an instrumental-only model on a lyrics-capable build', async () => {+ api.listMusicEngines.mockResolvedValue({ defaultEngine: 'musicgen', engines: [engine({ ready: true })] });+ api.getInstances.mockResolvedValue({ peers: [lyricCapablePeer({ lyrics: false }, ['lyrics'])] });+ 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' } });+ // The build carries words; this model cannot sing them. Two facts, and the+ // root feature answers only one.+ expect(screen.getByLabelText(/instrumental only/i)).toBeDisabled();+ });+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 })] });diff --git a/client/src/hooks/useFederatedMediaTarget.js b/client/src/hooks/useFederatedMediaTarget.jsindex 15c3b8038c..402beb60f0 100644--- a/client/src/hooks/useFederatedMediaTarget.js+++ b/client/src/hooks/useFederatedMediaTarget.js@@ -21,7 +21,9 @@ import { getInstances } from '../services/api';import {federatedMediaModelKey,federatedMediaModelsForPeer,+ federatedMediaSupports,peerMediaProviderConfig,+ peerMediaProviderSnapshot,resolvePeerMediaReadiness,summarizePeerMediaQueue,} from '../lib/federatedMediaReadiness.js';@@ -70,6 +72,7 @@ function blockingReason({ peer, models, model, kind, now }) {* peers: object[], peer: object|null, peerId: string, setPeerId: (id: string) => void,* models: object[], model: object|null, modelKey: string, setModelKey: (key: string) => void,* isRemote: boolean, readiness: object|null, queueSegments: string[],+ * snapshot: object|null, supports: (feature: string) => boolean,* canSubmit: boolean, blockedReason: string|null,* submissionFields: object|null, verify: () => {ok: boolean, message?: string},* }}@@ -112,6 +115,16 @@ export function useFederatedMediaTarget(kind) {}, [peer?.id, models]);const readiness = useMemo(() => (peer ? resolvePeerMediaReadiness(peer) : null), [peer]);+ // The peer's own status payload, exposed so a form can ask what the peer's+ // BUILD speaks rather than re-deriving it from a per-capability field (#4826).+ const snapshot = useMemo(() => peerMediaProviderSnapshot(peer), [peer]);+ // Bound to the selected model so callers ask one question instead of two: the+ // root feature list, with the overlap fallback against a peer still on the+ // previous build. Fails closed on an absent status, like every gate here.+ const supports = useCallback(+ (feature) => federatedMediaSupports(snapshot, feature, model),+ [snapshot, model],+ );const queueSegments = useMemo(() => (readiness ? summarizePeerMediaQueue(readiness.queue) : NO_SEGMENTS),[readiness],@@ -147,6 +160,8 @@ export function useFederatedMediaTarget(kind) {isRemote: Boolean(peer),readiness,queueSegments,+ snapshot,+ supports,canSubmit: Boolean(peer) && blockedReason === null,blockedReason,submissionFields,diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex f3756ddcf4..bd9e74ba8b 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -44,7 +44,7 @@ grep -i "what you want to do" client/src/lib/README.md| `creativeDirectorPlan.js` | Pure presentation helpers for the CD studio Plan board (CDO Phase 4) — annotate `plan.steps[]` with tool cost-class/timing/approval flags, cost/status summaries, owning-surface deep links, status/cost badge tone maps. || `creativeDirectorPreview.js` | `selectProjectPreview(project)` → `{ kind: 'video'\|'image'\|'audio'\|'none', jobId?, src?, poster?, label, durationSec? }` — picks a CD project's representative produced asset (finalVideoId → last rendered scene → last done plan video/image step → `musicBed` audio → startingImageFile) for the list cards + Overview tab (#2702, audio #2772). Pure, computed off the already-returned project payload (no fetch). Plus `previewAspectClass(aspectRatio)` (literal Tailwind classes — a computed `aspect-[w/h]` never lands in the build), `startingImageSrc()` (client mirror of `localImageFilename`), and the `videoSrcForJob`/`videoPosterForJob`/`imageSrcForJob`/`musicBedSrc` path builders — the one client-side definition of the `<jobId>`-named asset convention, shared with `ScenePreview.jsx`. || `editorialRoadmap.js` | `projectAnalyzedPoints` (aggregate roadmap → analyzed chart points with arc-position `frac`) + `dominant` (most-frequent string). Shared by EditorialRoadmapPanel and the Reader Map page. |-| `federatedMediaReadiness.js` | One reading of a peer’s federated media-provider readiness (#4348), shared by the Instances peer card and the System Health capacity panel so the two cannot disagree. `resolvePeerMediaReadiness(peer, { now })` maps the stored probe onto a display state/label/tone plus its remedy text, queue snapshot, capabilities, and per-kind allowlists; it re-derives `stale` when the snapshot’s `freshUntil` has passed, so a snapshot probed as `ready` cannot keep reading `ready` after the server would refuse to submit against it. Also exports `FEDERATED_MEDIA_KINDS` (audio/image/video + their config fields and icons), the state/help tables, and `peerMediaProviderConfig`. `summarizePeerMediaQueue(queue)` renders the peer’s queue block into finished display segments — slot occupancy, how many jobs drain in parallel, and which kinds are busy — so every surface shows the same words, dropping any segment an older provider did not send rather than showing it as a zero. `federatedMediaModelsForPeer(peer, kind)` intersects the local per-kind allowlist with the peer’s advertised capabilities and returns the capability entries (with their `ready` / `unavailableReason`), so no surface can offer a model the server would refuse or hide why a listed one cannot run. `peerModelAcceptsInput(capability, role)` / `peerModelRequiresInput(capability)` read the capability’s `inputAssets` block — which conditioning slots (`initImage` / `referenceImages` / `sourceImage` / `lastImage`) a peer model takes, and whether it can render without one — with **absent reading as NO**, so a provider predating that field is never offered a render it would reject. Display only — the server re-probes and fail-closes before any job leaves. |+| `federatedMediaReadiness.js` | One reading of a peer’s federated media-provider readiness (#4348), shared by the Instances peer card and the System Health capacity panel so the two cannot disagree. `resolvePeerMediaReadiness(peer, { now })` maps the stored probe onto a display state/label/tone plus its remedy text, queue snapshot, capabilities, and per-kind allowlists; it re-derives `stale` when the snapshot’s `freshUntil` has passed, so a snapshot probed as `ready` cannot keep reading `ready` after the server would refuse to submit against it. Also exports `FEDERATED_MEDIA_KINDS` (audio/image/video + their config fields and icons), the state/help tables, and `peerMediaProviderConfig`. `summarizePeerMediaQueue(queue)` renders the peer’s queue block into finished display segments — slot occupancy, how many jobs drain in parallel, and which kinds are busy — so every surface shows the same words, dropping any segment an older provider did not send rather than showing it as a zero. `federatedMediaModelsForPeer(peer, kind)` intersects the local per-kind allowlist with the peer’s advertised capabilities and returns the capability entries (with their `ready` / `unavailableReason`), so no surface can offer a model the server would refuse or hide why a listed one cannot run. `federatedMediaSupports(status, feature, capability)` mirrors the server helper of the same name and is the ONE place the "absent reads as false" rule lives on this side (#4826): it answers whether the peer’s BUILD speaks a wire feature (`lyrics`, `inputAssets`) from the status-root `features` list, falling back to the legacy per-capability field for a peer still on the previous build, and `peerMediaProviderSnapshot(peer)` returns the status payload to ask it against. `peerModelAcceptsInput(capability, role, status)` / `peerModelRequiresInput(capability)` read the capability’s `inputAssets` block — which conditioning slots (`initImage` / `referenceImages` / `sourceImage` / `lastImage`) a peer model takes, and whether it can render without one — gated first on the build speaking conditioning at all, with **absent reading as NO**, so a provider predating that field is never offered a render it would reject. Display only — the server re-probes and fail-closes before any job leaves. || `glbFailure.js` | Turns a 3D asset failure into an actionable sentence. `glbFailureHint(error)` matches the message against a shared table (an HTML body reaching the glTF parser, a WebGL context failure, a 404) and returns `null` when nothing recognizes it — so a caller can tell "we know the cause" from "we don't" and fall back to the raw text. `glbErrorText(error)` reads a message off whatever shape was thrown. Shared because the CoS avatars load remote GLBs too: every caught error there used to be reported as "this display has no WebGL", sending the user to change an unrelated setting (#4688). Consumed by `media/GlbViewer.jsx` and `cos/CoSCanvasGuard.jsx`. || `grokVideoClip.js` | Mirror of `server/lib/grokVideoClip.js` — `GROK_VIDEO_DURATIONS` (`[6, 10]`) + `GROK_VIDEO_DEFAULT_DURATION`, the clip lengths grok's `image_to_video` actually delivers. || `imageCleaners.js` | Mirror of `resolveCleanersFromConfig` from `server/lib/imageClean.js`. Reads `{cleanC2PA, denoise}` off a per-mode settings record. `cleanC2PA` defaults are mode-aware (on for `codex` + `external` — the backends that emit C2PA chunks today — off otherwise, as an allow-list rather than a deny-list); `denoise` defaults off everywhere (lossy, opt-in only). |diff --git a/client/src/lib/federatedMediaReadiness.js b/client/src/lib/federatedMediaReadiness.jsindex d895eee0f8..5c39113748 100644--- a/client/src/lib/federatedMediaReadiness.js+++ b/client/src/lib/federatedMediaReadiness.js@@ -134,6 +134,46 @@ function verifiedState(status, now) {return state;}+// Overlap-release fallbacks, mirroring FEDERATED_MEDIA_LEGACY_FEATURE_TELL in+// server/lib/federatedMediaWire.js. A provider on the previous build advertises+// the same build-level fact per-capability instead of at the status root.+const LEGACY_FEATURE_TELL = Object.freeze({+ lyrics: (capability) => capability?.acceptsLyrics === true,+ inputAssets: (capability) => isRecord(capability?.inputAssets),+});++/**+ * Does the build that sent this status speak `feature`? Client mirror of+ * `federatedMediaSupports` (server/lib/federatedMediaWire.js), and the ONE+ * place the "absent reads as false" reasoning lives on this side (#4826).+ *+ * A provider built before a feature shipped omits it and then rejects the field+ * outright at submission, so a surface that read an absent signal as consent+ * would offer a render the peer answers with a 400. Display only — the route+ * re-checks and the provider re-checks again at admission.+ *+ * @param {object|null} status - a peer's `mediaProviderStatus.snapshot`+ * @param {string} feature - 'lyrics' | 'inputAssets'+ * @param {object|null} [capability] - for the overlap fallback against a peer+ * that has not migrated yet+ * @returns {boolean} false whenever the answer cannot be established+ */+export function federatedMediaSupports(status, feature, capability = null) {+ if (Array.isArray(status?.features) && status.features.includes(feature)) return true;+ return LEGACY_FEATURE_TELL[feature]?.(capability) === true;+}++/**+ * The validated status payload behind a peer's last probe, or null.+ *+ * Shape-checked only, like everything else here: the server does the+ * authoritative wire validation, and a second copy client-side would be one+ * more thing to keep in sync.+ */+export const peerMediaProviderSnapshot = (peer) => (isRecord(peer?.mediaProviderStatus?.snapshot)+ ? peer.mediaProviderStatus.snapshot+ : null);+const isCount = (value) => Number.isInteger(value) && value >= 0;// "<label> 1 running, 2 queued", or null when nothing is there to report.@@ -275,11 +315,10 @@ export function federatedMediaModelsForPeer(peer, kind) {* Does this advertised capability accept a conditioning image in `role`* (`initImage` / `referenceImages` / `sourceImage` / `lastImage`)?*- * **Absent reads as NO.** A provider built before ADR- * `docs/decisions/2026-08-22-federated-media-input-assets.md` omits the- * `inputAssets` block entirely and rejects the fields, so treating a missing- * block as unrestricted would offer a render the peer answers with a 400. Same- * fail-closed rule the queue-capacity fields follow.+ * **Absent reads as NO**, and two independent things must both hold: the+ * peer's BUILD has to speak conditioning at all (the `inputAssets` feature,+ * asked through `federatedMediaSupports` so the fail-closed reasoning stays in+ * one place), and THIS MODEL has to advertise the role.** Mirrors the server's `inputAssetRejection`* (`server/services/federatedMedia/inputAssets.js`) — display only; the route@@ -287,9 +326,11 @@ export function federatedMediaModelsForPeer(peer, kind) {** @param {object|null} capability - an entry from `federatedMediaModelsForPeer`* @param {string} role+ * @param {object|null} [status] - the peer snapshot the capability came from* @returns {boolean}*/-export function peerModelAcceptsInput(capability, role) {+export function peerModelAcceptsInput(capability, role, status = null) {+ if (!federatedMediaSupports(status, 'inputAssets', capability)) return false;const roles = capability?.inputAssets?.roles;return Array.isArray(roles) && roles.includes(role);}diff --git a/client/src/lib/federatedMediaReadiness.test.js b/client/src/lib/federatedMediaReadiness.test.jsindex 0f8e61612b..20983ce025 100644--- a/client/src/lib/federatedMediaReadiness.test.js+++ b/client/src/lib/federatedMediaReadiness.test.js@@ -4,7 +4,9 @@ import {FEDERATED_MEDIA_STATE_HELP,federatedMediaModelKey,federatedMediaModelsForPeer,+ federatedMediaSupports,peerMediaProviderConfig,+ peerMediaProviderSnapshot,peerModelAcceptsInput,peerModelRequiresInput,resolvePeerMediaReadiness,@@ -354,6 +356,19 @@ describe('peerModelAcceptsInput / peerModelRequiresInput', () => {expect(peerModelAcceptsInput(model, 'referenceImages')).toBe(false);});+ it('needs the BUILD to speak conditioning as well as the model to advertise the role', () => {+ // Both halves, and neither alone: the root feature says the peer's code can+ // carry a conditioning image at all, the roles array says this model takes+ // one in that slot. A peer on the previous build sends no `features` and is+ // read through the block it does send, which is why an empty list is not+ // treated as a denial.+ const model = withInput({ roles: ['initImage'], required: false, maxCount: 8 });+ expect(peerModelAcceptsInput(model, 'initImage', { features: ['inputAssets'] })).toBe(true);+ expect(peerModelAcceptsInput(model, 'initImage', {})).toBe(true);+ // The build speaks it; this model simply takes nothing.+ expect(peerModelAcceptsInput(withInput(null), 'initImage', { features: ['inputAssets'] })).toBe(false);+ });+it.each([['an absent block (a provider predating the ADR)', undefined],['an explicit null', null],@@ -374,3 +389,29 @@ describe('peerModelAcceptsInput / peerModelRequiresInput', () => {expect(peerModelRequiresInput(null)).toBe(false);});});++// Mirrors server/lib/federatedMediaWire.js — the two must agree, or a surface+// offers a render the route then refuses.+describe('federatedMediaSupports / peerMediaProviderSnapshot', () => {+ const capability = { kind: 'audio', lyrics: true };++ it('reads an absent features list as the wire-v1 baseline', () => {+ expect(federatedMediaSupports(null, 'lyrics')).toBe(false);+ expect(federatedMediaSupports({ features: [] }, 'lyrics', capability)).toBe(false);+ expect(federatedMediaSupports({ features: 'lyrics' }, 'lyrics')).toBe(false);+ });++ it('reads the status-root list, and falls back to the legacy per-capability field', () => {+ expect(federatedMediaSupports({ features: ['lyrics'] }, 'lyrics')).toBe(true);+ expect(federatedMediaSupports({}, 'lyrics', { ...capability, acceptsLyrics: true })).toBe(true);+ expect(federatedMediaSupports({}, 'inputAssets', { inputAssets: { roles: [] } })).toBe(true);+ expect(federatedMediaSupports({}, 'inputAssets', { inputAssets: null })).toBe(false);+ });++ it('returns the peer snapshot only when one is actually stored', () => {+ expect(peerMediaProviderSnapshot(null)).toBeNull();+ expect(peerMediaProviderSnapshot({ mediaProviderStatus: {} })).toBeNull();+ expect(peerMediaProviderSnapshot({ mediaProviderStatus: { snapshot: { features: ['lyrics'] } } }))+ .toEqual({ features: ['lyrics'] });+ });+});diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsxindex 4e476956e7..6adcf0991e 100644--- a/client/src/pages/ImageGen.jsx+++ b/client/src/pages/ImageGen.jsx@@ -694,8 +694,8 @@ export default function ImageGen() {if (!remoteTarget.isRemote) return null;const model = remoteTarget.model;const present = [- ['an init image', initImage.source != null && !peerModelAcceptsInput(model, 'initImage')],- ['reference images', populatedRefs.length > 0 && !peerModelAcceptsInput(model, 'referenceImages')],+ ['an init image', initImage.source != null && !peerModelAcceptsInput(model, 'initImage', remoteTarget.snapshot)],+ ['reference images', populatedRefs.length > 0 && !peerModelAcceptsInput(model, 'referenceImages', remoteTarget.snapshot)],['LoRA weights', selectedLoras.length > 0],].filter(([, set]) => set).map(([label]) => label);if (present.length) {@@ -708,7 +708,7 @@ export default function ImageGen() {return `${model?.modelName || 'The selected peer model'} renders only from a source image — add an init image, or pick a text-to-image model.`;}return null;- }, [remoteTarget.isRemote, remoteTarget.model, initImage.source, populatedRefs.length, selectedLoras.length]);+ }, [remoteTarget.isRemote, remoteTarget.model, remoteTarget.snapshot, initImage.source, populatedRefs.length, selectedLoras.length]);// One reading for the submit button and the picker caption alike.const remoteBlocked = remoteTarget.isRemote? (remoteTarget.blockedReason || remoteUnsupportedInputs)diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsxindex cea933663f..c3ad22ea03 100644--- a/client/src/pages/VideoGen.jsx+++ b/client/src/pages/VideoGen.jsx@@ -206,8 +206,8 @@ export default function VideoGen() {// mode can be set before that input is filled — so gate the mode too// rather than letting an a2v render reach the peer as plain text-to-video.[`${mode} mode`, ![undefined, 'text', 'image', 'fflf'].includes(mode)],- ['a source image', !!sourceImageFile && !peerModelAcceptsInput(model, 'sourceImage')],- ['an end frame', !!lastImageFile && !peerModelAcceptsInput(model, 'lastImage')],+ ['a source image', !!sourceImageFile && !peerModelAcceptsInput(model, 'sourceImage', remoteTarget.snapshot)],+ ['an end frame', !!lastImageFile && !peerModelAcceptsInput(model, 'lastImage', remoteTarget.snapshot)],['an uploaded frame (save it to the gallery first)', !!sourceImageUpload || !!lastImageUpload],['keyframes', keyframesActive],['a source clip to extend', !!extendFromVideoId],@@ -228,7 +228,7 @@ export default function VideoGen() {return `${model?.modelName || 'The selected peer model'} renders only from a source image — add a start frame, or pick a text-to-video model.`;}return null;- }, [remoteTarget.isRemote, remoteTarget.model, isGrok, mode, sourceImageFile, sourceImageUpload,+ }, [remoteTarget.isRemote, remoteTarget.model, remoteTarget.snapshot, isGrok, mode, sourceImageFile, sourceImageUpload,lastImageFile, lastImageUpload, keyframesActive, extendFromVideoId, audioFile, icReferenceFile,icReferenceVideoId, icReferenceImageFiles, selectedLoras, chunks]);// One reading for the Generate button, the enqueue guard and the caption.diff --git a/docs/FEDERATED_MEDIA_PROVIDERS.md b/docs/FEDERATED_MEDIA_PROVIDERS.mdindex c3112f525b..d7a378482e 100644--- a/docs/FEDERATED_MEDIA_PROVIDERS.md+++ b/docs/FEDERATED_MEDIA_PROVIDERS.md@@ -93,14 +93,17 @@ An API caller deliberately selects remote execution on Music generation by sendi**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:+Sending them needs **two** signals to agree, and they live at different levels of the payload because they answer different questions:-| Capability field | Means | Absent |-|---|---|---|-| `lyrics` | the **model** sings | — (always present) |-| `acceptsLyrics` | **this provider's build** carries lyrics on the wire | reads as `false` |+| Signal | Where | Means | Absent |+|---|---|---|---|+| `lyrics` | on the capability | the **model** sings | — (always present) |+| the `lyrics` feature | `features` at the status root | **this provider's build** carries lyrics on the wire | reads as `false` |+| `acceptsLyrics` | on the capability | superseded duplicate of the feature, kept for one overlap release | 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 either half is missing, `POST /api/music/generate` refuses with `400 MEDIA_PROVIDER_LYRICS_UNSUPPORTED` naming which one, and Music Studio pins Instrumental only with the reason — it never silently renders a wordless take of a song the user wrote words for.-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.+Consumers ask through `federatedMediaSupports(status, feature, capability)` (`server/lib/federatedMediaWire.js`, mirrored in `client/src/lib/federatedMediaReadiness.js`) rather than reading either field directly, so the fail-closed reasoning lives in one place and the overlap fallback retires from one place.### Remote image and video renders@@ -393,6 +396,43 @@ All successful JSON responses include `wireVersion: 1`. The version is also fixe`GET /status` is computed live and carries `generatedAt` plus `staleAfterMs`. Consumers must stop assigning new work after that window instead of treating stale capacity as available. A provider timestamp more than 30 seconds in the future is also rejected as unknown clock state rather than extending capacity indefinitely.+#### `features` — what the provider's BUILD speaks++```jsonc+{+ "wireVersion": 1,+ "features": ["lyrics", "inputAssets"], // optional; absent = the wire-v1 baseline+ "capabilities": [ /* … */ ]+}+```++Some wire capabilities are properties of the **sender**, not of any one model:+whether the payload can carry lyrics, or conditioning images, is a fact about+the code the provider is running. Those live in one `features` list at the+status root rather than as a boolean stamped onto every capability. Per-model+facts stay on the capability (`lyrics` — does this engine sing; `inputAssets.roles`+— which conditioning slots this model takes), and a consumer must satisfy+**both** before it sends the field.++The list is emitted verbatim from what the build implements — a feature is+listed because the code shipped, never because a configured model happens to use+it. That is what lets a consumer tell "this peer predates conditioning" apart+from "this peer speaks conditioning but has only text-only models allowlisted",+which a per-capability boolean could not: both looked like an absent field.++`features` is optional and additive in both directions, so it needs no+`SCHEMA_VERSIONS` bump. **Absent reads as the wire-v1 baseline** — no lyrics, no+conditioning — for the same fail-closed reason `concurrency` and `byKind` read+absent as unknown: a provider that never shipped the handling rejects the field+at submission, so inferring consent from silence turns every such render into a+400 the user cannot act on. A feature this build does not recognize is ignored+rather than invalidating the payload, so a newer provider stays readable.++Consumers ask `federatedMediaSupports(status, feature, capability)` rather than+testing the list inline, which is also where the overlap fallback to the legacy+per-capability `acceptsLyrics` lives — one place to retire it from once no+supported peer sends it.+CUDA has three states: `available`, `absent`, and `unknown`. A CUDA model is ready only when the state is positively `available`; a failed or ambiguous probe blocks admission. Runtime, host-platform, exact fixed-checkpoint readiness, and queue capacity are similarly fail-closed.The configured `maxQueuedJobs` is conservative: all queued/running work that consumes this machine's media resources counts against it. Outgoing proxy jobs are excluded because they consume another peer's capacity; counting them could make two idle peers report busy while waiting on each other.diff --git a/server/lib/README.md b/server/lib/README.mdindex dfad1642e1..e4ae7e8010 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -255,7 +255,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `fetchWithTimeout.js` | `fetch` wrapper with AbortController timeout. || `tailnetPeer.js` | `isTailnetPeer(peer)` — fail-closed security predicate for "is this peer reachable only over the tailnet". Deliberately separate from `instances.js`'s `peerRequiresTailscale()` probe-deferral heuristic so a polling-noise tweak can't widen a privacy boundary; required by the unattended-routing gate in ADR 2026-08-20-federated-visual-prompts. || `federatedMediaRequest.js` | Builds and validates the versioned federated-media submission body for a visual kind, so every call site that persists a remote-job marker projects local params onto the wire identically. |-| `federatedMediaWire.js` | Versioned federated-media status schema/constants plus fail-closed consumer freshness checks (stale and clock-skewed snapshots are never assignable). |+| `federatedMediaWire.js` | Versioned federated-media status schema/constants plus fail-closed consumer freshness checks (stale and clock-skewed snapshots are never assignable). `FEDERATED_MEDIA_FEATURES` + `federatedMediaSupports(status, feature, capability)` answer "does the peer BUILD speak this wire feature" from the status-root `features` list — the one place the "absent reads as the wire-v1 baseline" rule lives, with an overlap fallback to the legacy per-capability field. || `connectivity.js` | `isMachineOnline({timeoutMs?, hosts?})` — internet-reachability probe: bare TCP `connect` to public anycast resolvers on :443 (no DNS, no HTTP), resolves `true` on the first connect and `false` only after all fail; never rejects. Reuse when a caller needs a best-effort local reachability signal. || `safeUrlFetch.js` | SSRF-guarded public-URL fetch: `isPublicHttpUrlSafe`/`assertPublicHttpUrl` (scheme + blocked-host-literal via `catalogValidation.isBlockedIngestHost` + DNS-resolve), exported strict `isPrivateAddress`, plus `fetchPublicText`/`fetchPublicBinary` (timeout, redirect revalidation, size cap) and `buildPinnedLookup`/`buildPinnedDispatcher` (the connect-time IP pin that closes the DNS-rebinding TOCTOU). Reuse instead of copying the SSRF guard for any "fetch this remote thing the user pointed us at" flow. || `pinterestFeed.js` | Pure Pinterest board RSS helpers: `normalizePinterestFeedUrl(input)` (board URL or `.rss` → `{ feedUrl, boardUrl }`, host-gated) + `parsePinterestRss(xml)` (per-pin `pinUrl`/`imageUrl`/title/description, 736x size upgrade). Feeds the mood-board Pinterest importer. |diff --git a/server/lib/federatedMediaWire.js b/server/lib/federatedMediaWire.jsindex 17798bd24c..73c0d195c5 100644--- a/server/lib/federatedMediaWire.js+++ b/server/lib/federatedMediaWire.js@@ -287,15 +287,14 @@ export const federatedMediaCapabilitySchema = z.object({// 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.+ // SUPERSEDED by the status-root `features` list (#4826), and kept on the+ // wire for one overlap release so a consumer on the previous build still+ // reads this provider correctly. Emitted per-capability but never per-model:+ // it always equalled `lyrics`, because the fact it carried was "does this+ // BUILD carry lyrics on the wire", which is a property of the payload's+ // sender rather than of any one engine. Read it only through+ // `federatedMediaSupports`, never directly. Do not add a second field in+ // this shape — a new per-field wire capability belongs in `features`.acceptsLyrics: z.boolean().optional(),autoDuration: z.boolean(),frameStride: z.number().int().min(1).max(64).nullable().optional(),@@ -340,6 +339,62 @@ const federatedMediaQueueStatusSchema = z.object({byKind: z.partialRecord(mediaKindSchema, federatedMediaKindOccupancySchema).optional(),});+// What THIS BUILD speaks on the wire, beyond the wire-v1 baseline (#4826).+//+// A build-version probe, not a model capability: "does the sender carry lyrics+// on the wire" is a property of the payload's sender, which is why it sits at+// the status root rather than being stamped onto every capability. Emitted+// verbatim by the provider — a feature is listed because the code that handles+// it shipped, not because some allowlisted model happens to use it. Per-model+// facts stay per-capability (`lyrics`, `inputAssets.roles`), and a consumer+// must satisfy BOTH before it sends the field.+//+// Additive and optional in both directions, so no SCHEMA_VERSIONS bump: a+// newer feature reaches an older consumer as an unmatched string, and an+// absent list reads as the wire-v1 baseline (see federatedMediaSupports).+export const FEDERATED_MEDIA_FEATURES = Object.freeze(['lyrics', 'inputAssets']);++// Deliberately NOT a z.enum over FEDERATED_MEDIA_FEATURES: a Zod enum rejects+// the whole payload on an unknown member, so the day a provider adds a fourth+// feature every older consumer would fail to parse its entire status rather+// than ignoring one string it does not recognize — the same trap `byKind`+// avoids with partialRecord. The pattern still bounds the shape so the field+// cannot smuggle free-form text (and therefore PII) across the boundary.+const federatedMediaFeatureSchema = z.string().regex(/^[a-zA-Z][a-zA-Z0-9]{0,39}$/);++// The ONE place the "absent reads as false" reasoning lives (#4826). Every+// consumer gate — server route, consumer service, client panel — asks through+// here rather than restating it.+//+// A provider built before a feature shipped omits it and then rejects the field+// outright at submission, so treating an absent signal as consent would turn+// every such render into a hard 400 the user cannot act on. Fail closed and the+// consumer degrades to something it can explain instead.+//+// `capability` is the OVERLAP path only: for one release a provider on the+// previous build advertises the same build-level fact per-capability, so a+// consumer reads the root list first and falls back to the legacy field.+const FEDERATED_MEDIA_LEGACY_FEATURE_TELL = Object.freeze({+ lyrics: (capability) => capability?.acceptsLyrics === true,+ // A build that predates conditioning omits the block entirely; one that+ // speaks it advertises the block (possibly with no roles for this model).+ inputAssets: (capability) => !!capability?.inputAssets && typeof capability.inputAssets === 'object',+});++/**+ * Does the build that sent this status speak `feature`?+ *+ * @param {object|null} status - a validated provider status payload+ * @param {string} feature - a FEDERATED_MEDIA_FEATURES member+ * @param {object|null} [capability] - the capability being acted on, for the+ * overlap fallback against a provider that has not migrated yet+ * @returns {boolean} false whenever the answer cannot be established+ */+export function federatedMediaSupports(status, feature, capability = null) {+ if (Array.isArray(status?.features) && status.features.includes(feature)) return true;+ return FEDERATED_MEDIA_LEGACY_FEATURE_TELL[feature]?.(capability) === true;+}+// Strip unknown fields from peer responses before persisting or exposing them// locally. Mixed-version compatibility lives in the versioned route and the// known-field schema; an older consumer must not relay an unreviewed future@@ -349,6 +404,10 @@ export const federatedMediaProviderStatusSchema = z.object({generatedAt: z.string().datetime(),staleAfterMs: z.number().int().positive().max(300_000),status: z.enum(['ready', 'busy', 'unavailable']),+ // Optional and additive; **absent reads as the wire-v1 baseline** (no lyrics,+ // no conditioning). Bounded well above this build's own vocabulary so a+ // provider that speaks more than we do still validates.+ features: z.array(federatedMediaFeatureSchema).max(32).optional(),kinds: z.array(mediaKindSchema).max(KNOWN_MEDIA_KINDS.length),queue: federatedMediaQueueStatusSchema,capabilities: z.array(federatedMediaCapabilitySchema).max(300),diff --git a/server/lib/federatedMediaWire.test.js b/server/lib/federatedMediaWire.test.jsindex 1cce438ffb..38142cce6b 100644--- a/server/lib/federatedMediaWire.test.js+++ b/server/lib/federatedMediaWire.test.js@@ -1,11 +1,13 @@import { describe, expect, it } from 'vitest';import {+ FEDERATED_MEDIA_FEATURES,federatedMediaAudioProfileSchema,federatedMediaCapabilitySchema,federatedMediaProviderStatusSchema,federatedMediaProviderJobSchema,effectiveJobPrompt,isFederatedMediaAudioPrompt,+ federatedMediaSupports,normalizeRequestedMediaKinds,renderFederatedMediaAudioPrompt,} from './federatedMediaWire.js';@@ -217,7 +219,32 @@ describe('federated media status kind projection', () => {expect(bad({ holo: { running: 1, queued: 0 } })).toBe(false);});- it('rejects a concurrency that claims no capacity at all', () => {+ it('validates a features list and drops the field entirely when a provider omits it', () => {+ expect(federatedMediaProviderStatusSchema.parse(status({ features: ['lyrics'] })).features)+ .toEqual(['lyrics']);+ expect(federatedMediaProviderStatusSchema.parse(status()).features).toBeUndefined();+ });++ // The byKind lesson applied to features: a Zod enum would reject the ENTIRE+ // payload on an unrecognized member, so the day a provider ships a fourth+ // feature every older consumer would stop reading its status at all instead+ // of ignoring one string.+ it('accepts a feature this build does not recognize rather than failing the payload', () => {+ const parsed = federatedMediaProviderStatusSchema+ .safeParse(status({ features: ['lyrics', 'holoProjection'] }));+ expect(parsed.success).toBe(true);+ expect(federatedMediaSupports(parsed.data, 'holoProjection')).toBe(true);+ });++ it('rejects a features entry shaped like free-form text', () => {+ const bad = (features) => federatedMediaProviderStatusSchema+ .safeParse(status({ features })).success;+ expect(bad(['a private note about the user'])).toBe(false);+ expect(bad([''])).toBe(false);+ expect(bad(['x'.repeat(41)])).toBe(false);+ });++ it('rejects a concurrency that claims no capacity at all', () => {expect(federatedMediaProviderStatusSchema.safeParse(status({queue: { ...status().queue, concurrency: 0 },})).success).toBe(false);@@ -299,3 +326,37 @@ describe('effectiveJobPrompt', () => {expect(effectiveJobPrompt({ kind: 'image', params: { prompt: '' } })).toBe('');});});++describe('federatedMediaSupports', () => {+ const capability = (overrides = {}) => ({ kind: 'audio', lyrics: true, ...overrides });++ it('reads an absent features list as the wire-v1 baseline', () => {+ expect(federatedMediaSupports(null, 'lyrics')).toBe(false);+ expect(federatedMediaSupports({}, 'lyrics', capability())).toBe(false);+ expect(federatedMediaSupports({ features: [] }, 'inputAssets')).toBe(false);+ // A model that sings is not, on its own, a build that carries the words.+ expect(federatedMediaSupports({ features: [] }, 'lyrics', capability({ lyrics: true }))).toBe(false);+ });++ it('reads the status-root list without needing a capability', () => {+ expect(federatedMediaSupports({ features: ['lyrics'] }, 'lyrics')).toBe(true);+ expect(federatedMediaSupports({ features: ['lyrics'] }, 'inputAssets')).toBe(false);+ });++ // The overlap release: a peer on the previous build sends the per-capability+ // field and no root list, and must keep working unchanged.+ it('falls back to the legacy per-capability field', () => {+ expect(federatedMediaSupports({}, 'lyrics', capability({ acceptsLyrics: true }))).toBe(true);+ expect(federatedMediaSupports({}, 'lyrics', capability({ acceptsLyrics: false }))).toBe(false);+ expect(federatedMediaSupports({}, 'inputAssets', capability({ inputAssets: { roles: ['initImage'] } }))).toBe(true);+ expect(federatedMediaSupports({}, 'inputAssets', capability({ inputAssets: null }))).toBe(false);+ });++ it('exposes every feature this build emits, and answers false for anything else', () => {+ expect([...FEDERATED_MEDIA_FEATURES]).toEqual(['lyrics', 'inputAssets']);+ for (const feature of FEDERATED_MEDIA_FEATURES) {+ expect(federatedMediaSupports({ features: [...FEDERATED_MEDIA_FEATURES] }, feature)).toBe(true);+ }+ expect(federatedMediaSupports({ features: ['lyrics'] }, 'constructor', capability())).toBe(false);+ });+});diff --git a/server/routes/music.js b/server/routes/music.jsindex 85513e579f..21c44aa064 100644--- a/server/routes/music.js+++ b/server/routes/music.js@@ -43,6 +43,7 @@ import { getCudaCapability } from '../lib/cudaCapability.js';import {FEDERATED_MEDIA_WIRE_VERSION,federatedMediaAudioProfileSchema,+ federatedMediaSupports,} from '../lib/federatedMediaWire.js';import { enqueueJob, listJobs } from '../services/mediaJobQueue/index.js';import { resolveFederatedMediaProvider } from '../services/federatedMediaConsumer.js';@@ -453,18 +454,25 @@ 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' },- );+ // silently comes back instrumental: `capability.lyrics` says the MODEL+ // sings — the same check the provider's own admission gate makes — while+ // the `lyrics` FEATURE says this PEER'S BUILD carries the words at all.+ // Each failure gets its own message, so a caller who actually sent words is+ // told which half is missing rather than getting a plausible render of the+ // wrong thing. Why absent fails closed lives in federatedMediaSupports.+ if (body.lyrics && !body.instrumentalOnly) {+ if (!capability.lyrics) {+ throw new ServerError(+ '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' },+ );+ }+ if (!federatedMediaSupports(resolved.status, 'lyrics', capability)) {+ throw new ServerError(+ 'The selected peer runs a PortOS build that cannot carry lyrics to its provider. Update the peer, or render this track locally.',+ { status: 400, code: 'MEDIA_PROVIDER_LYRICS_UNSUPPORTED' },+ );+ }}engine = {id: capability.engine,diff --git a/server/routes/music.test.js b/server/routes/music.test.jsindex 536747ff94..7d7ba7343b 100644--- a/server/routes/music.test.js+++ b/server/routes/music.test.js@@ -711,6 +711,45 @@ describe('music routes', () => {expect(mediaQueue.enqueue).not.toHaveBeenCalled();});+ it('POST /generate accepts lyrics from a peer that advertises only the status-root feature', async () => {+ const peer = { id: '00000000-0000-4000-8000-000000000001', enabled: true };+ remoteProvider.peers = [peer];+ // The post-migration provider: `features` at the status root and no+ // `acceptsLyrics` on the capability at all. A consumer that had kept+ // reading the per-capability field would refuse this peer outright.+ remoteProvider.resolve.mockResolvedValueOnce({+ peer,+ capability: remoteLyricCapability({ lyrics: true }),+ status: { features: ['lyrics', 'inputAssets'] },+ });++ const r = await request(app).post('/api/music/generate').send(remoteLyricRequest(peer));++ expect(r.status).toBe(202);+ expect(mediaQueue.enqueue.mock.calls[0][0].params.remoteMedia.lyrics)+ .toContain('Call [email protected]');+ });++ it('POST /generate still refuses an instrumental-only model on a build that speaks the lyrics feature', async () => {+ const peer = { id: '00000000-0000-4000-8000-000000000001', enabled: true };+ remoteProvider.peers = [peer];+ // The two facts are independent, and the root feature answers only one of+ // them: this build carries lyrics, but the model picked cannot sing. A+ // gate that collapsed to the feature alone would queue a render that comes+ // back wordless, which is the failure the per-capability field prevented.+ remoteProvider.resolve.mockResolvedValueOnce({+ peer,+ capability: remoteLyricCapability({ lyrics: false }),+ status: { features: ['lyrics'] },+ });++ const r = await request(app).post('/api/music/generate').send(remoteLyricRequest(peer));++ expect(r.status).toBe(400);+ 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];diff --git a/server/services/federatedMedia/inputAssets.js b/server/services/federatedMedia/inputAssets.jsindex b874553db2..4727d42acd 100644--- a/server/services/federatedMedia/inputAssets.js+++ b/server/services/federatedMedia/inputAssets.js@@ -33,6 +33,7 @@ import {FEDERATED_MEDIA_INPUT_ROLES,federatedMediaAssetId,federatedMediaAssetSchema,+ federatedMediaSupports,isMultiInputRole,} from '../../lib/federatedMediaWire.js';import { detectImageFormat, resolveImageInputPath, sha256File } from '../../lib/fileUtils.js';@@ -82,12 +83,23 @@ export const remoteInputAssetsSchema = z.array(remoteInputAssetSchema)* preflight only — the provider re-checks everything at admission — but it* turns "the peer 400s after you commit" into "Generate tells you why".*- * Absent `inputAssets` reads as UNSUPPORTED, never as unrestricted: a provider- * predating this ADR omits the block and rejects the fields.+ * Absent support reads as UNSUPPORTED, never as unrestricted: a provider+ * predating this ADR omits the block and rejects the fields (see+ * `federatedMediaSupports`).*+ * The two ways that can fail get separate remedies, because the block's absence+ * conflated them: a peer whose BUILD predates conditioning needs updating,+ * while a peer that speaks it and simply allowlisted a text-only model needs a+ * different model picked. A status-root `features` list (#4826) is what tells+ * them apart; a peer that published no list is undecidable and keeps the older,+ * merged message.+ *+ * @param {object|null} capability - the resolved provider capability+ * @param {Array<{role: string}>} [assets]+ * @param {object|null} [status] - the provider status the capability came from* @returns {string|null} a human-facing reason, or null when acceptable*/-export function inputAssetRejection(capability, assets = []) {+export function inputAssetRejection(capability, assets = [], status = null) {const limits = capability?.inputAssets;const model = capability?.modelName || 'The selected model';// The remedy names the kind the caller is actually rendering. Saying@@ -100,7 +112,14 @@ export function inputAssetRejection(capability, assets = []) {: null;}if (!limits) {- return `${model} on this peer does not accept source or reference images. Render locally, or pick a peer model that does.`;+ // The build-level remedy fires only when the peer POSITIVELY published its+ // vocabulary and this feature is not in it. A peer that sent no list at all+ // is undecidable — mid-overlap it may speak conditioning and simply have+ // only text-only models allowlisted — so it keeps the merged message rather+ // than being accused of running an old build on no evidence.+ return Array.isArray(status?.features) && !federatedMediaSupports(status, 'inputAssets', capability)+ ? 'The selected peer runs a PortOS build that cannot carry conditioning images. Update the peer, or render locally.'+ : `${model} on this peer does not accept source or reference images. Render locally, or pick a peer model that does.`;}const roles = [...new Set(assets.map((asset) => asset.role))];for (const pair of REQUIRED_PAIRS) {diff --git a/server/services/federatedMedia/remoteSubmission.js b/server/services/federatedMedia/remoteSubmission.jsindex 47a7357deb..dc75b8224c 100644--- a/server/services/federatedMedia/remoteSubmission.js+++ b/server/services/federatedMedia/remoteSubmission.js@@ -201,7 +201,7 @@ export async function prepareRemoteMediaJob({ peerId, kind, request, inputAssetscode: 'MEDIA_PROVIDER_PEER_NOT_FOUND',});}- const { capability } = await resolveFederatedMediaProvider(peer, {+ const { capability, status } = await resolveFederatedMediaProvider(peer, {kind,engine: request.engine,modelId: request.modelId,@@ -209,7 +209,7 @@ export async function prepareRemoteMediaJob({ peerId, kind, request, inputAssets// Advisory, like every other check here — the provider re-validates at// admission. Doing it now turns "the peer 400s after the user committed" into// a message on the Generate button naming the input to clear.- const rejection = inputAssetRejection(capability, inputAssets);+ const rejection = inputAssetRejection(capability, inputAssets, status);if (rejection) {throw new ServerError(rejection, { status: 400, code: 'MEDIA_PROVIDER_INPUT_UNSUPPORTED' });}diff --git a/server/services/federatedMedia/remoteSubmission.test.js b/server/services/federatedMedia/remoteSubmission.test.jsindex 56eebeebf2..7d04288630 100644--- a/server/services/federatedMedia/remoteSubmission.test.js+++ b/server/services/federatedMedia/remoteSubmission.test.js@@ -223,9 +223,9 @@ describe('prepareRemoteMediaJob — conditioning gate', () => {roles: names, required: false, maxCount: 8, maxBytes: 1, mimeTypes: ['image/png'],});- const prepare = (kind, request, inputAssets, cap) => {+ const prepare = (kind, request, inputAssets, cap, status) => {mockGetPeers.mockResolvedValue([peer]);- mockResolveFederatedMediaProvider.mockResolvedValue({ peer, capability: cap });+ mockResolveFederatedMediaProvider.mockResolvedValue({ peer, capability: cap, status });return prepareRemoteMediaJob({ peerId: PEER_ID, kind, request, inputAssets });};@@ -273,6 +273,26 @@ describe('prepareRemoteMediaJob — conditioning gate', () => {)).rejects.toThrow(/text-to-image/);});+ // The conflation the status-root feature list exists to undo (#4826): before+ // it, "this peer's build predates conditioning" and "this peer speaks+ // conditioning but the model you picked takes none" were the same absent+ // block, so both got the same remedy and one of them was wrong.+ it('tells a peer too old to carry conditioning apart from a model that takes none', async () => {+ const textOnly = { ...capability(roles('initImage'), 'image'), inputAssets: null };+ const submit = (status) => prepare(+ 'image',+ { kind: 'image', engine: 'local', modelId: 'flux', prompt: 'a lighthouse', width: 512, height: 512 },+ [{ role: 'initImage', path: 'init.png' }],+ textOnly,+ status,+ );+ await expect(submit({ features: ['lyrics', 'inputAssets'] })).rejects.toThrow(/pick a peer model that does/);+ await expect(submit({ features: ['lyrics'] })).rejects.toThrow(/Update the peer/);+ // No status at all keeps the older merged message rather than accusing a+ // peer of being out of date on no evidence.+ await expect(submit(undefined)).rejects.toThrow(/pick a peer model that does/);+ });+it('refuses a role the peer model never advertised', async () => {await expect(prepare('image',diff --git a/server/services/federatedMediaProvider.js b/server/services/federatedMediaProvider.jsindex fc341d9f12..c17d07d34d 100644--- a/server/services/federatedMediaProvider.js+++ b/server/services/federatedMediaProvider.js@@ -21,6 +21,7 @@ import {FEDERATED_MEDIA_ASSET_MAX_BYTES,FEDERATED_MEDIA_ASSET_MAX_COUNT,FEDERATED_MEDIA_ASSET_MIME_TYPES,+ FEDERATED_MEDIA_FEATURES,FEDERATED_MEDIA_RESULT_EXTENSION,FEDERATED_MEDIA_STALE_AFTER_MS,FEDERATED_MEDIA_WIRE_VERSION,@@ -382,6 +383,9 @@ async function configuredAudioCapabilities(config) {maxDurationSec: engine?.maxDurationSec ?? null,defaultDurationSec: engine?.defaultDurationSec ?? null,lyrics: engine?.lyrics === true,+ // Overlap-release duplicate of the status-root `lyrics` feature (#4826).+ // Always equal to `lyrics` because it never carried a per-model fact;+ // drop it once no supported peer reads the legacy field.acceptsLyrics: engine?.lyrics === true,inputAssets: null,autoDuration: engine?.autoDuration === true,@@ -596,6 +600,11 @@ export async function getFederatedMediaProviderStatus(config, { kinds = ['audio'generatedAt: new Date().toISOString(),staleAfterMs: FEDERATED_MEDIA_STALE_AFTER_MS,status: !anyReady ? 'unavailable' : (queue.accepting ? 'ready' : 'busy'),+ // What this BUILD speaks, verbatim and unconditional — a feature is listed+ // because the code handling it shipped, not because a configured model+ // happens to use it. Copied rather than passed by reference so a consumer+ // deserializing this payload cannot mutate the frozen module constant.+ features: [...FEDERATED_MEDIA_FEATURES],kinds: requestedKinds,queue,capabilities: capabilities.map(publicCapability),diff --git a/server/services/federatedMediaProvider.test.js b/server/services/federatedMediaProvider.test.jsindex f79f1f3041..78d5bed7d3 100644--- a/server/services/federatedMediaProvider.test.js+++ b/server/services/federatedMediaProvider.test.js@@ -295,6 +295,24 @@ 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('advertises what this BUILD speaks in a status-root features list', async () => {+ // Emitted verbatim from what the build implements, NOT derived from the+ // configured models — that is the whole point of moving it off the+ // capability: a peer with only instrumental models allowlisted must still+ // be distinguishable from a peer whose code predates lyrical federation.+ state.capabilities.engines = [readyEngine({ lyrics: false })];+ const status = await getFederatedMediaProviderStatus(config());+ expect(status.features).toEqual(['lyrics', 'inputAssets']);+ expect(status.capabilities[0].lyrics).toBe(false);+ });++ it('emits a features copy a consumer cannot mutate back into the module constant', async () => {+ const status = await getFederatedMediaProviderStatus(config());+ status.features.push('holoProjection');+ expect((await getFederatedMediaProviderStatus(config())).features)+ .toEqual(['lyrics', 'inputAssets']);+ });+it('renders lyrics on a lyric-capable model and advertises that its wire accepts them', async () => {await submitFederatedMediaJob({callerId: 'peer-example', config: config(),