fix(fal): write the onboarding default image model to mediaModels.image (#123447)

applyFalConfig wrote the default image model to
agents.defaults.imageGenerationModel, a retired key the runtime never
reads (image generation resolves agents.defaults.mediaModels.image,
and the retired key is reported as an unrecognized dead key by
config validation). After fal onboarding, image_generate still failed
with "No image-generation model configured." until a doctor --fix
migration ran. Write mediaModels.image directly, matching the vydra
and pixverse onboarding flows.
This commit is contained in:
wanyongstar
2026-08-20 23:29:02 +08:00
committed by GitHub
parent deb73f02bd
commit 978c9416ea
2 changed files with 41 additions and 3 deletions
+37
View File
@@ -0,0 +1,37 @@
// Fal tests cover onboard plugin behavior.
import {
type OpenClawConfig,
resolveAgentModelPrimaryValue,
} from "openclaw/plugin-sdk/provider-onboard";
import { describe, expect, it } from "vitest";
import { applyFalConfig, FAL_DEFAULT_IMAGE_MODEL_REF } from "./onboard.js";
const emptyCfg: OpenClawConfig = {};
describe("applyFalConfig", () => {
it("writes the default image model to mediaModels.image (the key the runtime reads)", () => {
const result = applyFalConfig(emptyCfg);
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.mediaModels?.image)).toBe(
FAL_DEFAULT_IMAGE_MODEL_REF,
);
// The retired key must stay untouched: nothing in the runtime reads it.
expect(result.agents?.defaults).not.toHaveProperty("imageGenerationModel");
});
it("does not overwrite an existing mediaModels.image default", () => {
const cfg = {
agents: {
defaults: {
mediaModels: { image: { primary: "other-provider/custom-model" } },
},
},
} as OpenClawConfig;
const result = applyFalConfig(cfg);
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.mediaModels?.image)).toBe(
"other-provider/custom-model",
);
});
});
+4 -3
View File
@@ -4,7 +4,7 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/provider-onboard";
export const FAL_DEFAULT_IMAGE_MODEL_REF = "fal/fal-ai/flux/dev";
export function applyFalConfig(cfg: OpenClawConfig): OpenClawConfig {
if (cfg.agents?.defaults?.imageGenerationModel) {
if (cfg.agents?.defaults?.mediaModels?.image) {
return cfg;
}
return {
@@ -13,8 +13,9 @@ export function applyFalConfig(cfg: OpenClawConfig): OpenClawConfig {
...cfg.agents,
defaults: {
...cfg.agents?.defaults,
imageGenerationModel: {
primary: FAL_DEFAULT_IMAGE_MODEL_REF,
mediaModels: {
...cfg.agents?.defaults?.mediaModels,
image: { primary: FAL_DEFAULT_IMAGE_MODEL_REF },
},
},
},