Skip to content

Commit 79a2628

Browse files
committed
fix(fal): write the onboarding default image model to mediaModels.image
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.
1 parent fdd5fa9 commit 79a2628

2 files changed

Lines changed: 41 additions & 3 deletions

File tree

‎extensions/fal/onboard.test.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Fal tests cover onboard plugin behavior.
2+
import {
3+
type OpenClawConfig,
4+
resolveAgentModelPrimaryValue,
5+
} from "openclaw/plugin-sdk/provider-onboard";
6+
import { describe, expect, it } from "vitest";
7+
import { applyFalConfig, FAL_DEFAULT_IMAGE_MODEL_REF } from "./onboard.js";
8+
9+
const emptyCfg: OpenClawConfig = {};
10+
11+
describe("applyFalConfig", () => {
12+
it("writes the default image model to mediaModels.image (the key the runtime reads)", () => {
13+
const result = applyFalConfig(emptyCfg);
14+
15+
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.mediaModels?.image)).toBe(
16+
FAL_DEFAULT_IMAGE_MODEL_REF,
17+
);
18+
// The retired key must stay untouched: nothing in the runtime reads it.
19+
expect(result.agents?.defaults).not.toHaveProperty("imageGenerationModel");
20+
});
21+
22+
it("does not overwrite an existing mediaModels.image default", () => {
23+
const cfg = {
24+
agents: {
25+
defaults: {
26+
mediaModels: { image: { primary: "other-provider/custom-model" } },
27+
},
28+
},
29+
} as OpenClawConfig;
30+
31+
const result = applyFalConfig(cfg);
32+
33+
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.mediaModels?.image)).toBe(
34+
"other-provider/custom-model",
35+
);
36+
});
37+
});

‎extensions/fal/onboard.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/provider-onboard";
44
export const FAL_DEFAULT_IMAGE_MODEL_REF = "fal/fal-ai/flux/dev";
55

66
export function applyFalConfig(cfg: OpenClawConfig): OpenClawConfig {
7-
if (cfg.agents?.defaults?.imageGenerationModel) {
7+
if (cfg.agents?.defaults?.mediaModels?.image) {
88
return cfg;
99
}
1010
return {
@@ -13,8 +13,9 @@ export function applyFalConfig(cfg: OpenClawConfig): OpenClawConfig {
1313
...cfg.agents,
1414
defaults: {
1515
...cfg.agents?.defaults,
16-
imageGenerationModel: {
17-
primary: FAL_DEFAULT_IMAGE_MODEL_REF,
16+
mediaModels: {
17+
...cfg.agents?.defaults?.mediaModels,
18+
image: { primary: FAL_DEFAULT_IMAGE_MODEL_REF },
1819
},
1920
},
2021
},

0 commit comments

Comments
 (0)