Repository navigation
fix(fal): route grok-imagine and nano-banana-2-lite edits to correct endpoints - #98688
Conversation
|
Codex review: needs changes before merge. Reviewed July 1, 2026, 11:39 PM ET / 03:39 UTC. Summary PR surface: Source +269, Tests +974. Total +1243 across 12 files. Reproducibility: yes. from source inspection. Current main sends unlisted Fal reference-image models through the generic /image-to-image suffix, while the PR discussion and Fal endpoint metadata support /edit routes for the affected model paths. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the Fal-owned endpoint schema and shared per-model limit helper, update the image-generation docs for model-dependent 14-reference behavior, and land once maintainers accept the additive provider metadata contract. Do we have a high-confidence way to reproduce the issue? Yes from source inspection. Current main sends unlisted Fal reference-image models through the generic /image-to-image suffix, while the PR discussion and Fal endpoint metadata support /edit routes for the affected model paths. Is this the best way to solve the issue? Yes, with the docs follow-up and maintainer API-contract acceptance. Keeping vendor endpoint rules in the Fal schema and using a shared per-model limit helper is more maintainable than hardcoding these model IDs in tool preflight. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6a96bbc7ad77. Label changesLabel justifications:
Evidence reviewedPR surface: Source +269, Tests +974. Total +1243 across 12 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
1b54bc2 to
056484a
Compare
|
Thanks for the review. I dug into the What I found by hitting
So the field exists but is a Force-pushed The public schema doc page at fal.ai/models/google/nano-banana-2-lite/edit/api?input does not list
|
056484a to
cc3aacc
Compare
|
Fixed the stale comment (P3 finding). The comment at
Force-pushed Note on the failed OpenGrep check: transient install failure —
|
|
Maintainer repair pushed in
The PR description has been updated to match the repaired behavior. Exact-head CI is the remaining gate. |
|
Maintainer repair is now pushed at Besides preserving the requested
Fresh local proof on the exact repair:
Fresh exact-head GitHub CI and hosted |
|
Land-ready on exact head Final proof:
No known proof gaps remain. |
63ae14d to
3347c5e
Compare
|
The accepted review finding about provider-wide reference limits is fixed at The final repair adds a model-specific image edit limit overlay, then uses it in both places that matter:
Coverage includes Nano 14-image edits, explicit GPT Image Fresh focused proof is 134/134 passed. Final local structured autoreview is clean with no accepted/actionable findings at confidence 0.88. Exact-head whole-PR review, hosted |
8b3280a to
a012792
Compare
16bbbde to
a3aeb01
Compare
…endpoints
The fal image-generation provider appends '/image-to-image' to any model
that isn't 'openai/gpt-image-*' or 'fal-ai/nano-banana-*' when reference
images are supplied. That's wrong for two models fal serves:
- `xai/grok-imagine-image`: fal 404s on '/image-to-image'. The real edit
endpoint is '/quality/edit'. The endpoint also expects lowercase
resolution values ('1k'/'2k' only) and a distinct aspect_ratio enum.
- `google/nano-banana-2-lite`: fal 404s on '/image-to-image'. The real
edit endpoint is '/edit'. The endpoint does not accept a 'resolution'
parameter.
Add schema entries for both models so ensureFalModelPath and
applyFalImageGeometry pick the right suffix and body shape. Introduce
resolution allowlist support ('resolutions: readonly string[]') and
lowercase transform ('resolutionCase: "lower"') on the schema; existing
schemas keep their behaviour (nb2 still forwards uppercase resolution
unchanged; flux/gpt-image/nb2/krea untouched). Refactor
ensureFalModelPath to consult schema.appendEditPath instead of hardcoded
prefix checks so future models only need a schema entry.
Tested:
- Existing 49 fal unit tests still pass; added 9 new tests covering the
two new endpoints and their guard conditions (32 -> 34 tests in the
image-generation-provider suite).
- Live fal.ai calls confirm both endpoints return 200 with real
reference images; the buggy old URLs still return 404.
fa58f66 to
89bbe6d
Compare
|
Land-ready on exact head
The current-main iOS fixture regression was repaired in the same branch with focused secret-scrubbing coverage. |
|
Merged via squash.
|
What Problem This Solves
Reference-image calls for these Fal-hosted models fell through to
/image-to-image, which Fal does not expose:xai/grok-imagine-imagegoogle/nano-banana-2-liteBoth models expose standard edits at
/edit. Grok also has a separate, explicitly selectable/quality/edittier.The original fix exposed two shared-runtime gaps: inferred resolution was applied before fallback selection, and reference-image limits were represented only at provider level even though Fal models accept between 1 and 14 inputs.
Why This Change Was Made
The Fal plugin keeps endpoint and request-shape behavior in its existing model schema:
/edit; explicit/qualityand/quality/editmodel paths retain the quality tier./edit.1k/2kwire values, and three-reference-image limit.resolutionfield.The shared runtime now carries inferred resolution separately and applies it only after selecting each candidate model. A fallback that does not support resolution receives no stale override, while a capable fallback still receives the inferred default.
Image edit capabilities now support model-specific reference limits, matching the existing video-generation capability pattern. Tool preflight accepts the highest limit among reachable fallback candidates, while runtime skips candidates whose concrete model limit is too low before provider or network work. Provider listings report the maximum and mark it as model-dependent.
The generic endpoint fallback remains
/image-to-image, while existing GPT Image, Nano Banana 2, Flux, and Krea routing is unchanged.User Impact
Reference-image calls for the affected model IDs now reach their valid Fal edit endpoints instead of failing with a 404. Mixed-capability fallback chains no longer leak resolution overrides or reject a valid higher-capacity fallback. Invalid direct Grok, Flux, GPT Image, or Krea reference counts fail before input loading or detached-task start.
Evidence
/image-to-imageroutes and 200 responses from valid Fal routes.xai/grok-imagine-image/editandxai/grok-imagine-image/quality/editendpoints.google/nano-banana-2-lite/editand omitsresolutionfrom both Nano Banana 2 Lite base and edit input schemas.node scripts/run-vitest.mjs src/image-generation/capabilities.test.ts extensions/fal/image-generation-provider.test.ts extensions/fal/music-generation-provider.test.ts extensions/fal/video-generation-provider.test.ts src/agents/tools/image-generate-tool.test.ts src/image-generation/runtime.test.ts test/scripts/render-maturity-docs.test.ts test/scripts/ios-run.test.ts- 146/146 passed.git diff --check- passed.tbx_01kwgc9dg5fnmwfatayh3n58es:check:changedpassed on the exact rebased head.Fixes the broken edit routing described in this PR.