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

docs: document video constraint negotiation and refine remote job submission (#4681)

[._.]/ Adam Eivyfc4655f34017
diff --git a/docs/FEDERATED_MEDIA_PROVIDERS.md b/docs/FEDERATED_MEDIA_PROVIDERS.md
index ab90588006..990d6a8c46 100644
--- a/docs/FEDERATED_MEDIA_PROVIDERS.md
+++ b/docs/FEDERATED_MEDIA_PROVIDERS.md
@@ -121,11 +121,18 @@ go. That is deliberate: silently dropping the source image a user pinned would
return a plausible render of the wrong thing. Input-asset transfer is a later
slice.
-Unlike audio, image and video prompts cross as submitted rather than being
-re-rendered from a fixed vocabulary. Why that is not a hole in the "no PII on
-federation" rule, what stays absolutely prompt-free, and what a future standing
-(unattended) route may not do are all decided in ADR
-[federated visual prompts](./decisions/2026-08-20-federated-visual-prompts.md).
+### Video frame and canvas constraint negotiation
+
+Providers advertise their model geometry and frame constraints in their capability status:
+- `frameStride`: Stride multiplier for continuous frame models (e.g. Wan 2.2 uses stride 4, legal counts `4n + 1`).
+- `maxNumFrames`: Maximum allowed frame count for the model.
+- `frameOptions`: Discrete allowed frame counts for fixed-cadence models (e.g. MiniMax H3 `17n + 5` grid).
+- `resolutionOptions`: Allowed canvas presets (`w`, `h`, `label`).
+
+When preparing a remote video job, the consumer negotiates requested parameters against the provider's advertised constraints:
+- Frame count snaps down to the nearest legal discrete option or `n * stride + 1` (never up, to avoid spending unbudgeted GPU compute), bounded by `maxNumFrames`.
+- Canvas dimensions snap to the closest aspect ratio and area preset in `resolutionOptions`.
+- Adjustments are logged (`🌐 Federated render: adjusted ...`), and the negotiated parameters are persisted inside `remoteMedia.request` so reconciles replay the exact negotiated job. Requests that cannot be made legal fail closed with `400 MEDIA_PROVIDER_INPUT_UNSUPPORTED`.
### Unattended renders (Creative Director / Creative Commission)
diff --git a/server/routes/videoGen.js b/server/routes/videoGen.js
index 079da20385..8d5d54ba41 100644
--- a/server/routes/videoGen.js
+++ b/server/routes/videoGen.js
@@ -1055,7 +1055,7 @@ router.post('/', frameImageUpload, asyncHandler(async (req, res) => {
// schema's overlap with it: this object is persisted and replayed on every
// reconcile, so it must already be a body the provider accepts.
const request = buildFederatedMediaRequest({ kind: 'video', params: body });
- const { peer, request: negotiatedRequest, remoteMedia } = await prepareRemoteMediaJob({
+ const { peer, remoteMedia } = await prepareRemoteMediaJob({
peerId: body.mediaProviderPeerId,
kind: 'video',
request,
diff --git a/server/services/federatedMedia/defaultRouting.js b/server/services/federatedMedia/defaultRouting.js
index 284f2099f6..068f35f895 100644
--- a/server/services/federatedMedia/defaultRouting.js
+++ b/server/services/federatedMedia/defaultRouting.js
@@ -245,9 +245,9 @@ export async function resolveDefaultMediaRoute({ kind, params }) {
);
}
const finalRequest = negotiatedRequest || request;
- // NOTE: Frame count and frame rate are negotiated in prepareRemoteMediaJob
+ // NOTE: Frame and canvas constraints are negotiated in prepareRemoteMediaJob
// against the peer's advertised capability (frameStride, maxNumFrames,
- // frameOptions, fpsOptions). Model-specific prompt constraints (e.g. MiniMax
+ // frameOptions, resolutionOptions). Model-specific prompt constraints (e.g. MiniMax
// H3 rejecting negative prompts) remain provider-enforced.
//
// Stamp the marker so the boundary survives the job, not just the enqueue.