Skip to content

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

Merged
steipete merged 1 commit into
openclaw:mainfrom
wanyongstar:fix/fal-onboard-media-models-key
Aug 20, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
wanyongstar:fix/fal-onboard-media-models-key

Conversation

@wanyongstar

@wanyongstar wanyongstar commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

fix(fal): write the onboarding default image model to agents.defaults.mediaModels.image — the key the runtime actually reads — instead of the retired imageGenerationModel key

What Problem This Solves

After completing fal onboarding (auth wizard / --fal-api-key), the generated config sets the default image model so image_generate works out of the box. But applyFalConfig writes it to a retired key:

// extensions/fal/onboard.ts
defaults: { ...cfg.agents?.defaults, imageGenerationModel: { primary: FAL_DEFAULT_IMAGE_MODEL_REF } },

The runtime never reads that key — image generation resolves agents.defaults.mediaModels.image (src/image-generation/runtime.ts:71 via resolveCapabilityModelCandidates). Three independent confirmations that the written key is dead:

  • src/config/dead-config-keys.test.ts:53 asserts agents.defaults.imageGenerationModel is reported as an unrecognized dead key by config validation.
  • The only migration from the retired key to mediaModels.image runs in doctor (legacy-config-migrations.runtime.retired.ts), i.e. the user must run openclaw doctor --fix before the onboarding result takes effect.
  • The sibling providers do it right: vydra/onboard.ts and pixverse/onboard.ts both write mediaModels.image|video.

代码证据: extensions/fal/onboard.ts:6-22 (writes imageGenerationModel); src/image-generation/runtime.ts:71 (reads mediaModels.image).

Trigger condition: any fresh fal onboarding.

User symptom: right after onboarding, image_generate still throws No image-generation model configured. — the onboarding result is a no-op until the user happens to run doctor --fix.

Root Cause

  • The fal onboarding flow was added in commit bca2501c7f7 (2026-05-27) writing the then-current key; when the config schema moved image models to mediaModels.image, this call site was missed (vydra/pixverse onboardings were written later against the new key).
  • Violated invariant: onboarding must write configuration the runtime actually consumes; writing to a retired key produces a config that validation itself flags as dead.

Why This Fix

  • Option A (chosen): write mediaModels.image directly, mirroring vydra/onboard.ts exactly (same guard: don't overwrite an existing mediaModels.image default). Minimal, consistent with sibling providers.
  • Option B: keep writing the dead key and rely on the doctor migration. Rejected: requires every onboarded user to run doctor --fix before the feature works — that is the bug, not a fix.
  • Not chosen: writing both keys — the retired key is explicitly flagged by validation; writing it spreads the dead config further.

User Impact

  • Affected scenarios: fresh fal onboarding via the auth wizard or --fal-api-key.
  • Before: default image model silently configured into a dead key; image_generate fails with "No image-generation model configured." until openclaw doctor --fix.
  • After: the default is resolvable immediately after onboarding; existing mediaModels.image settings are preserved.
  • Behavior change: onboarding now produces a working config on first use.

Evidence

Real Behavior Proof

Real stack, no mocks: the proof runs the real applyFalConfig and then asks the real runtime resolver (resolveCapabilityModelCandidates from src/media-generation/runtime-shared.ts, the same call src/image-generation/runtime.ts:69 makes) to resolve the image model from the produced config.

Before (on main)

$ node node_modules/tsx/dist/cli.mjs proof-fal-onboard-model-key.mjs
[proof] mediaModels.image after onboarding: null
[proof] legacy imageGenerationModel after onboarding: {"primary":"fal/fal-ai/flux/dev"}
[proof] runtime-resolved candidates: []
[proof] RESULT: FAIL - runtime resolves no image model after onboarding (expected fal/fal-ai/flux/dev); image_generate would throw "No image-generation model configured."

After (with fix)

$ node node_modules/tsx/dist/cli.mjs proof-fal-onboard-model-key.mjs
[proof] mediaModels.image after onboarding: {"primary":"fal/fal-ai/flux/dev"}
[proof] legacy imageGenerationModel after onboarding: null
[proof] runtime-resolved candidates: [{"provider":"fal","model":"fal-ai/flux/dev"}]
[proof] RESULT: PASS - onboarding default fal/fal-ai/flux/dev is resolvable by the runtime

What was not tested: a live image generation call against fal's API (requires credentials); the proof covers the full config-write → runtime-resolve path that was broken.

Tests and Validation

  • New extensions/fal/onboard.test.ts — 2/2 passed: onboarding writes mediaModels.image (and never the retired key), and an existing mediaModels.image default is preserved.
  • npx oxlint --deny=warn on both files — 0 warnings, 0 errors.
  • Before/after real-behavior proof logs are embedded above.
  • Maintainer live follow-up identified a separate existing CLI auth-choice scope-filter defect affecting media-only providers; that independent entry-point bug will be fixed separately and does not change this config-writer owner repair.
  • Exact-head maintainer verification confirms the runtime reads only mediaModels.image and the contributor patch matches the existing Vydra provider ownership pattern.

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.
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added extensions: fal size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 14, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 10:39 AM ET / 14:39 UTC.

ClawSweeper review

What this changes

The PR changes Fal API-key onboarding to save its default image model in agents.defaults.mediaModels.image and adds regression tests for the canonical output.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still writes Fal onboarding’s image default to the retired key, while the image runtime reads only the canonical media-model setting. The patch repairs that producer boundary without altering existing user-selected media defaults.

Priority: P2
Reviewed head: 79a2628b3e7d2aad3fcb4f681e45b5a86c767395

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused owner-boundary repair with credible real-path terminal evidence and relevant regression coverage.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides before-and-after terminal output through the real Fal config writer and shared runtime resolver, showing the canonical model becomes resolvable after the fix.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides before-and-after terminal output through the real Fal config writer and shared runtime resolver, showing the canonical model becomes resolvable after the fix.
Evidence reviewed 6 items Current producer defect: Current main’s Fal onboarding checks and writes imageGenerationModel, a retired configuration field.
Runtime contract: The image-generation runtime passes only agents.defaults.mediaModels.image to capability-model resolution.
Canonical config validation: Current main’s dead-key contract explicitly rejects agents.defaults.imageGenerationModel.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/fal/onboard.test.ts

Result: PASS (completed)

node scripts/run-vitest.mjs extensions/fal/onboard.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-123447-WyLD0c/target$ node scripts/run-vitest.mjs extensions/fal/onboard.test.ts
node scripts/run-vitest.mjs extensions/fal/onboard.test.ts
[test] starting test/vitest/vitest.extension-media.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-123447-WyLD0c/target

 ✓  extension-media  extensions/fal/onboard.test.ts (2 tests) 61ms

 Test Files  1 passed (1)
      Tests  2 passed (2)
   Start at  14:40:28
   Duration  1.49s (transform 1.13s, setup 1.02s, import 52ms, tests 61ms, environment 0ms)

[test] passed 1 Vitest shard in 7.14s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-123447-WyLD0c/target$ node scripts/run-vitest.mjs extensions/fal/onboard.test.ts



































Assertions:

  • PASS expect_output: 2 passed

How this fits together

Fal onboarding persists provider defaults after API-key setup. Image generation later resolves that default into the provider/model used for image_generate.

flowchart LR
  A[Fal API-key onboarding] --> B[Fal config writer]
  B --> C[Agent media-model defaults]
  C --> D[Image model resolver]
  D --> E[Image generation request]
Loading

Before merge

  • Resolve merge risk (P1) - This forward-only writer repair does not rewrite existing configurations that already contain the retired key; those configurations remain a separate doctor/repair concern.
  • Complete next step (P2) - No mechanical repair remains; this PR is ready for normal maintainer merge gating.
Agent review details

Security

None.

PR surface

Source +1, Tests +37. Total +38 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 3 +1
Tests 1 37 0 +37
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 41 3 +38

Review metrics

Metric Value Why it matters
Configuration default surface 1 changed default write: retired field removed, canonical mediaModels.image added Provider onboarding writes user configuration, so the canonical field and upgrade scope need explicit review.
Production versus test LOC production +4/-3 (net +1); tests +37/-0 The one-line production increase is the necessary nested canonical write that preserves other media defaults; the regression coverage is test-only.

Merge-risk options

Maintainer options:

  1. Land with forward-only upgrade scope (recommended)
    Accept this producer repair for future onboarding while retaining the existing configuration-repair path for files already written with the retired key.

Technical review

Best possible solution:

Land the owner-plugin change for future Fal onboarding while keeping any pre-existing retired configuration on the canonical repair path.

Do we have a high-confidence way to reproduce the issue?

Yes—source inspection gives a high-confidence path: current Fal onboarding writes only the retired field, while the image runtime resolves only mediaModels.image; the PR body also supplies matching before/after resolver output.

Is this the best way to solve the issue?

Yes—the producer-owned Fal onboarding writer is the narrowest maintainable repair, and its canonical merge pattern matches the Vydra provider rather than adding a runtime compatibility path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8458777e6a75.

Labels

Label justifications:

  • P2: Fal onboarding can currently leave a newly configured image provider unusable until configuration repair, but the blast radius is limited to that provider’s setup flow.
  • merge-risk: 🚨 compatibility: The PR changes the persisted onboarding default from a retired key to the current canonical configuration shape.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides before-and-after terminal output through the real Fal config writer and shared runtime resolver, showing the canonical model becomes resolvable after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides before-and-after terminal output through the real Fal config writer and shared runtime resolver, showing the canonical model becomes resolvable after the fix.

Evidence

What I checked:

Likely related people:

  • Alix-007: The available shallow-history blame attributes the current Fal onboarding implementation to this commit boundary; deeper introduction provenance was unavailable locally. (role: recent current-main line attribution; confidence: low; commits: 607eb2efbf49; files: extensions/fal/onboard.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-14T03:22:17.149Z sha 79a2628 :: needs maintainer review before merge. :: none
  • reviewed August 16, 2026, 2:03 AM ET / 06:03 UTC sha unknown :: needs maintainer review before merge. :: none
  • reviewed 2026-08-16T07:20:47.561Z sha 79a2628 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T03:43:14.228Z sha 79a2628 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 16, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 20, 2026
@steipete
steipete merged commit 978c941 into openclaw:main Aug 20, 2026
164 of 166 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 21, 2026
…ge (openclaw#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: fal merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants