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

carry an init image's strength onto the federated wire instead of dropping it (#4348)

[._.]/ Adam Eivyb84ebc9a7be7
diff --git a/server/lib/federatedMediaRequest.js b/server/lib/federatedMediaRequest.js
index 59dc1f86d1..c72d9a814a 100644
--- a/server/lib/federatedMediaRequest.js
+++ b/server/lib/federatedMediaRequest.js
@@ -16,8 +16,8 @@
*/
import {
- federatedMediaImageJobSubmissionSchema,
- federatedMediaVideoJobSubmissionSchema,
+ federatedMediaImageJobSubmissionBaseSchema,
+ federatedMediaVideoJobSubmissionBaseSchema,
validateRequest,
} from './validation.js';
@@ -34,6 +34,10 @@ const FIELD_MAPS = Object.freeze({
guidance: 'guidance',
guidanceScale: 'guidance',
seed: 'seed',
+ // Rides with the init image it scales (#4348). Dropping it would render at
+ // full denoise — the opposite of what a low strength asked for, and
+ // indistinguishable from a working render until the result comes back.
+ initImageStrength: 'initImageStrength',
}),
video: Object.freeze({
negativePrompt: 'negativePrompt',
@@ -48,9 +52,14 @@ const FIELD_MAPS = Object.freeze({
}),
});
+// The BASE (un-refined) schemas. Conditioning images reach the body as asset ids
+// resolved immediately before submission, so at BUILD time the pairing rules
+// ("a strength needs an image", "an end frame needs a start frame") have nothing
+// to check yet. The generate routes enforce those pairings on the local params
+// they actually hold, and the provider re-checks the fully assembled body.
const SCHEMAS = Object.freeze({
- image: federatedMediaImageJobSubmissionSchema,
- video: federatedMediaVideoJobSubmissionSchema,
+ image: federatedMediaImageJobSubmissionBaseSchema,
+ video: federatedMediaVideoJobSubmissionBaseSchema,
});
/**
diff --git a/server/lib/federatedMediaRequest.test.js b/server/lib/federatedMediaRequest.test.js
index 99ea979d74..3381e81696 100644
--- a/server/lib/federatedMediaRequest.test.js
+++ b/server/lib/federatedMediaRequest.test.js
@@ -12,6 +12,22 @@ describe('buildFederatedMediaRequest', () => {
});
});
+ // The strength scales the init image it travels with (#4348). Dropping it
+ // renders at FULL denoise — the opposite of what a low strength asked for,
+ // and indistinguishable from a working render until the result comes back.
+ // It is projected without its `initImage`, because the image itself reaches
+ // the body as an asset id resolved immediately before submission; the builder
+ // therefore validates against the un-refined base schema.
+ it('projects an init-image strength even though the image itself is added later', () => {
+ expect(buildFederatedMediaRequest({
+ kind: 'image',
+ params: {
+ modelId: 'sdxl-base', prompt: 'a lighthouse', width: 512, height: 512,
+ initImagePath: 'source.png', initImageStrength: 0.35,
+ },
+ })).toMatchObject({ initImageStrength: 0.35 });
+ });
+
it('maps the video route dialect guidanceScale onto the wire guidance field', () => {
const request = buildFederatedMediaRequest({
kind: 'video',
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 7afe040a4b..ee0378e5f5 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -822,7 +822,14 @@ const federatedMediaAudioJobSubmissionSchema = federatedMediaJobRoutingSchema.ex
// by the routes, since neither has a field to name it — is a MODEL (LoRA
// weights, rule 3) and multi-step CHAIN STATE (a video to extend, chained
// chunks, IC-LoRA references, rule 4).
-export const federatedMediaImageJobSubmissionSchema = federatedMediaJobRoutingSchema.omit({
+// Exported UN-REFINED as well, and the split is load-bearing rather than
+// cosmetic. The cross-field rule below pairs `initImageStrength` with
+// `initImage` — but a conditioning image reaches the body as an asset id
+// resolved immediately BEFORE submission, so the persisted marker legitimately
+// carries the strength with no image beside it yet. The marker and the request
+// builder validate against the base; the provider route, which sees the fully
+// assembled body, validates against the refined schema.
+export const federatedMediaImageJobSubmissionBaseSchema = federatedMediaJobRoutingSchema.omit({
durationSec: true, durationMode: true,
}).extend({
kind: z.literal('image'),
@@ -838,7 +845,9 @@ export const federatedMediaImageJobSubmissionSchema = federatedMediaJobRoutingSc
referenceImages: z.array(federatedMediaInputAssetRefSchema)
.max(FEDERATED_MEDIA_ASSET_MAX_COUNT).optional(),
}).strict()
- .refine(refineImagePixelCap, { message: PIXEL_CAP_MESSAGE, path: ['width'] })
+ .refine(refineImagePixelCap, { message: PIXEL_CAP_MESSAGE, path: ['width'] });
+
+export const federatedMediaImageJobSubmissionSchema = federatedMediaImageJobSubmissionBaseSchema
// A strength with nothing to apply it to is a caller bug, not a default to
// guess at: silently ignoring it renders at full denoise, which is the
// opposite of what a low strength asked for.
diff --git a/server/services/imageGen/remote.js b/server/services/imageGen/remote.js
index d8f7f483f2..42ca59a68b 100644
--- a/server/services/imageGen/remote.js
+++ b/server/services/imageGen/remote.js
@@ -16,7 +16,7 @@ import { join } from 'node:path';
import { z } from 'zod';
import { PATHS, atomicWrite } from '../../lib/fileUtils.js';
import { FEDERATED_MEDIA_WIRE_VERSION } from '../../lib/federatedMediaWire.js';
-import { federatedMediaImageJobSubmissionSchema } from '../../lib/validation.js';
+import { federatedMediaImageJobSubmissionBaseSchema } from '../../lib/validation.js';
import { createRemoteMediaExecutor } from '../federatedMedia/remoteExecutor.js';
import { applyRemoteInputAssets, remoteInputAssetsSchema } from '../federatedMedia/inputAssets.js';
import { imageGenEvents } from '../imageGenEvents.js';
@@ -34,7 +34,7 @@ const remoteImageMarkerSchema = z.object({
// replay. Persisted queue state is user-editable, so the body that actually
// leaves this machine is the one this schema accepted — not whatever the file
// happens to contain.
- request: federatedMediaImageJobSubmissionSchema,
+ request: federatedMediaImageJobSubmissionBaseSchema,
// LOCAL paths for this render's conditioning images, resolved to provider
// asset ids immediately before each submission. Ids are NOT persisted here:
// they name slots in the peer's TTL-swept staging area, so a reconcile after a
diff --git a/server/services/videoGen/remote.js b/server/services/videoGen/remote.js
index c3911a3a2b..e7e0e28259 100644
--- a/server/services/videoGen/remote.js
+++ b/server/services/videoGen/remote.js
@@ -17,7 +17,7 @@ import { z } from 'zod';
import { PATHS } from '../../lib/fileUtils.js';
import { generateThumbnail, optimizeForStreaming } from '../../lib/ffmpeg.js';
import { FEDERATED_MEDIA_WIRE_VERSION } from '../../lib/federatedMediaWire.js';
-import { federatedMediaVideoJobSubmissionSchema } from '../../lib/validation.js';
+import { federatedMediaVideoJobSubmissionBaseSchema } from '../../lib/validation.js';
import { createRemoteMediaExecutor } from '../federatedMedia/remoteExecutor.js';
import { applyRemoteInputAssets, remoteInputAssetsSchema } from '../federatedMedia/inputAssets.js';
import { videoGenEvents } from './events.js';
@@ -36,7 +36,7 @@ const remoteVideoMarkerSchema = z.object({
// replay. Persisted queue state is user-editable, so the body that actually
// leaves this machine is the one this schema accepted — not whatever the file
// happens to contain.
- request: federatedMediaVideoJobSubmissionSchema,
+ request: federatedMediaVideoJobSubmissionBaseSchema,
// LOCAL paths for this render's conditioning images, resolved to provider
// asset ids immediately before each submission. Ids are NOT persisted here:
// they name slots in the peer's TTL-swept staging area, so a reconcile after a