Skip to content

fix(images): Fal edits run on Flux Dev's edit endpoints, and Flux Redux takes its reference as redux_image - #351

Merged
jddunn merged 4 commits into
masterfrom
fix/image-provider-inputs
Oct 12, 2026
Merged

jddunn merged 4 commits into
masterfrom
fix/image-provider-inputs

Conversation

@jddunn

@jddunn jddunn commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Two image providers sent inputs the vendors' models do not take.

  • Fal's edit default could not edit. fal-ai/flux/dev is a text-to-image endpoint: its input schema has no image field (queue schema, category text-to-image). It was the edit default, so editImage({ provider: 'fal' }) sent image, strength and a mask to an endpoint that takes none of them. An edit with no model, or on fal-ai/flux/dev, now runs on fal-ai/flux/dev/image-to-image (image_url, strength), or with a mask on fal-ai/flux-lora/inpainting (image_url, mask_url, strength). An image-to-image or inpainting endpoint the caller names gets the same fields. The source and the mask go typed by their bytes, and FLUX.1 dev's edit endpoints get no negative prompt, which they do not take. Any other model keeps the image + strength pair the provider has always sent.
  • Flux Redux got the wrong field. Replicate's black-forest-labs/flux-redux-dev requires redux_image, which "replaces prompt", and has no image, prompt or negative_prompt input. The reference now goes as redux_image with no prompt (a caller's own providerOptions.input is still sent as given), and a Redux generation with no reference is refused before the request.

The catalog rows and IMAGE_EDITING.md say which endpoint an edit runs on.

Linked issues

None: finding A7 of a cold read of the 2026-10-08 image changes.

Type of change

  • Bug fix
  • Feature
  • Performance
  • Documentation
  • Refactor
  • Tests
  • Build or CI

How this was verified

CI runs the tests; nothing was run locally. The vendor schemas were read on 2026-10-12 from the URLs above.

  • image-operation-default-models.e2e.test.ts, through the real editImage, generateImage and provider classes with only fetch stubbed: a Fal edit posts to fal-ai/flux/dev/image-to-image with image_url and strength, an inpaint to fal-ai/flux-lora/inpainting with mask_url; a Flux Redux generation posts redux_image and no prompt.
  • FalImageProvider.edit.test.ts and ReplicateImageProvider.consistency.test.ts: the request bodies, now against the vendors' field names. Three tests pinned the old shapes, one of them image on the image-to-image endpoint, whose schema requires image_url.

Migration notes

None: no option or type is removed. A Fal edit that named no model, or fal-ai/flux/dev, now runs on its edit endpoint, and the result names that endpoint.

Checklist

  • Tests cover the changed behavior.
  • Docs are updated.
  • The title follows Conventional Commits, with ! before the colon for a change that breaks users (feat!: or feat(api)!:).
  • No secrets or private data are included.
  • Every automated review thread is settled (how).
  • I have read this change and can explain every line.

Summary by Sourcery

Align Fal editing and Replicate Flux Redux requests with the vendors’ supported schemas.

Bug Fixes:

  • Correct Fal image editing to use the appropriate Flux image-to-image and inpainting endpoints and vendor-supported input fields.
  • Send Flux Redux references to Replicate as redux_image and reject requests that omit a reference image.

Enhancements:

  • Update image model catalogs and editing documentation to describe the corrected Fal and Flux Redux behavior.

Documentation:

  • Document the Fal edit and inpainting endpoint defaults and behavior.

Tests:

  • Add coverage for Fal endpoint selection, typed image and mask inputs, negative-prompt handling, and Flux Redux request validation and field mapping.

…ux takes its reference as redux_image

fal-ai/flux/dev is a text-to-image endpoint whose input has no image, and
it was the edit default: an edit sent image, strength and a mask that the
endpoint does not take. An edit with no model, or on fal-ai/flux/dev, now
runs on fal-ai/flux/dev/image-to-image (image_url, strength), or with a
mask on fal-ai/flux-lora/inpainting (image_url, mask_url, strength); an
image-to-image or inpainting endpoint gets those fields; the source and
mask go typed by their bytes, and the FLUX.1 dev endpoints get no negative
prompt, which they do not take.

Replicate's Flux Redux requires redux_image, which replaces the prompt,
and has no image input. The reference now goes as redux_image, with no
prompt or negative prompt unless the caller's own input sets them, and a
Redux generation with no reference is refused before the request.
@jddunn
jddunn requested a review from Victor-Evogor as a code owner October 12, 2026 16:18
@sourcery-ai

sourcery-ai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Sorry @jddunn, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 days and 14 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T16:21:02.977061Z 6de8912 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai

sourcery-ai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Fixes vendor-schema mismatches for Fal image editing and Replicate Flux Redux by selecting compatible Fal edit endpoints, using their required input fields, suppressing unsupported prompts, and validating Redux references; documentation and end-to-end/provider tests capture the new behavior.

Sequence diagram for Fal image edit endpoint selection

sequenceDiagram
    participant Caller
    participant FalImageProvider
    participant FalAPI

    Caller->>FalImageProvider: editImage(request)
    alt no model or modelId is fal-ai/flux/dev
        alt mask provided
            FalImageProvider->>FalAPI: request fal-ai/flux-lora/inpainting with image_url, mask_url, strength
        else no mask
            FalImageProvider->>FalAPI: request fal-ai/flux/dev/image-to-image with image_url, strength
        end
    else compatible named model
        FalImageProvider->>FalAPI: request named model with its supported image fields
    end
    FalAPI-->>Caller: edited image result
Loading

Sequence diagram for Flux Redux reference validation

sequenceDiagram
    participant Caller
    participant ReplicateImageProvider
    participant ReplicateAPI

    Caller->>ReplicateImageProvider: generateImage(referenceImageUrl, providerOptions)
    alt redux_image is provided or referenceImageUrl is supplied
        ReplicateImageProvider->>ReplicateAPI: request flux-redux-dev with redux_image
        ReplicateAPI-->>Caller: generated variation
    else no Redux reference
        ReplicateImageProvider-->>Caller: throw reference-image validation error
    end
Loading

File-Level Changes

Change Details Files
Route Fal edits to endpoints whose schemas support image inputs, and serialize source/mask data using endpoint-specific field names and byte-derived MIME types.
  • Introduces separate default image-to-image and masked inpainting endpoint constants.
  • Redirects unnamed and text-to-image Flux Dev edits to the appropriate edit endpoint.
  • Uses image_url/mask_url for image-to-image and inpainting while retaining legacy image/strength behavior for other models.
  • Suppresses negative_prompt for the Flux Dev edit endpoints and updates model catalog metadata.
src/io/media/images/providers/FalImageProvider.ts
src/io/media/images/__tests__/FalImageProvider.edit.test.ts
src/api/runtime/__tests__/image-operation-default-models.e2e.test.ts
docs/features/IMAGE_EDITING.md
Adapt Flux Redux generation to Replicate's reference-image schema and reject requests that lack the required reference.
  • Maps referenceImageUrl to redux_image instead of image.
  • Removes generated prompt and negative_prompt fields unless explicitly supplied through providerOptions.input.
  • Fails before making a request when no Redux reference image is available.
  • Updates provider metadata and adds integration/provider coverage.
src/io/media/images/providers/ReplicateImageProvider.ts
src/io/media/images/__tests__/ReplicateImageProvider.consistency.test.ts
src/api/runtime/__tests__/image-operation-default-models.e2e.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 6 billable files and costs up to $1.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 24 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: framerslab/agentos/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 13ae1937-3e49-497a-8d94-f7c75a84a7b0

📥 Commits

Reviewing files that changed from the base of the PR and between 54e1259 and 422aa38.


📒 Files selected for processing (6)
  • docs/features/IMAGE_EDITING.md
  • src/api/runtime/__tests__/image-operation-default-models.e2e.test.ts
  • src/io/media/images/__tests__/FalImageProvider.edit.test.ts
  • src/io/media/images/__tests__/ReplicateImageProvider.consistency.test.ts
  • src/io/media/images/providers/FalImageProvider.ts
  • src/io/media/images/providers/ReplicateImageProvider.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6de8912037

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

A version-pinned Redux request may give its whole input through
providerOptions.replicate.extraBody.input, which the legacy endpoint's
branches put over the body. The check that refuses a Redux request with no
redux_image ran before that and refused such a request. It now reads the
input the request sends.
…paints, and Redux drops the prompt however its reference came

Fal's image-to-image endpoint has no mask input: a masked edit that named
it now runs on the inpainting endpoint, as one on fal-ai/flux/dev does.

The Redux prompt was dropped only when the reference came as
referenceImageUrl; a redux_image given in providerOptions.input kept the
prompt this provider adds, which the model's input does not have. It is
now dropped for every Redux request.
@jddunn
jddunn merged commit 164d242 into master Oct 12, 2026
10 checks passed
@jddunn
jddunn deleted the fix/image-provider-inputs branch October 12, 2026 17:15
github-actions Bot pushed a commit that referenced this pull request Oct 12, 2026
## [0.13.71](v0.13.70...v0.13.71) (2026-10-12)

### fix

* **images:** Fal edits run on Flux Dev's edit endpoints, and Flux Redux takes its reference as redux_image (#351) ([164d242](164d242)), closes [included](https://github.com/framerslab/agentos/issues/included)

### docs

* add the method draft of the GMI versus agent() paper (#349) ([288c3ca](288c3ca))
* correct the sources of the GMI paper's result tables (#353) ([51f6a71](51f6a71))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant