Skip to content

fix(platform): make image generation follow each image model's limits - #5057

Merged
yannickmonney merged 6 commits into
mainfrom
fix/image-generation
Oct 28, 2026
Merged

yannickmonney merged 6 commits into
mainfrom
fix/image-generation

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Why

A live check of image generation against OpenRouter (~55 image models, all four lanes) found that it worked with the default model but broke in several ways the platform could avoid:

Symptom (live, 2026-10-27) Cause Fix
Every Recraft v3/v4/v4.1 model: landscape and portrait → 400 aspect_ratio: not supported Tale always asks for 3:2 / 2:3 Read each model's aspect ratios from OpenRouter's image listing (/api/v1/images/models) and ask for the closest one it draws (Recraft: 4:3 / 3:4)
openai/gpt-image-1 and openai/gpt-5-image → The model 'gpt-image-1' does not exist OpenAI shut GPT Image 1 down on 2026-10-23 (GPT Image 1 Mini follows on 2026-12-01), yet it was in Tale's recommended list and OpenAI catalog Recommend GPT Image 2.5 Flare (OpenAI's named successor); OpenAI catalog lists GPT Image 2.5 Flare/Sunburst and GPT Image 2; Mini stays behind Flare until its shutdown
Seedream 5.0 (flash, lite, pro) missing from the picker OpenRouter lists them with context_length: 0, and the catalog dropped every model without a window An image generator that writes no text may have a window of 0, like transcription
Vector models (SVG only) offered, every call fails Tale stores no SVG Not offered or picked
Edit models (krea/k3-edit, recraft-v4-styles*) fail every request without a picture, after the admission They need ≥1 reference image Still selectable; a call without a picture is refused before anything is spent, saying why; Automatic never picks one
4 reference images to Gemini 2.5 Flash Image → 400 It takes 3 Refused before any spend with the model's limit, in both tool lanes
GPT Image 1 Mini through OpenRouter cost ~4× its medium price auto quality picked high Ask GPT image models for medium on OpenRouter too, as on OpenAI
Chat: "turn the attached photo into a watercolor" → the model passed image1.jpg An attached image reaches the model as pixels without its name or ref The model-facing turn lists each readable attached image with its ref (CHAT-R31); it names no tool (CHAT-R18)

The facts listing is fetched with the catalog's other OpenRouter listings (now in parallel); when it fails or cannot be read, the last facts keep serving and the catalog is asked again after the failure back-off instead of a day later.

Verification

  • Live, local stack + OpenRouter: chat (default model, collage from 3 of 4 refs after the limit refusal, watercolor and pencil sketch from an attached photo), standard agent task, OpenCode project agent (Recraft pinned, landscape → 1216×896), automation agent step (GPT Image 2.5 Flare pinned, portrait 1024×1536, booked to the automation), Recraft/Seedream through the platform path, picker contents, edit model refused without a picture and working with one. About $3.50 of OpenRouter spend.
  • bun run test (platform server + pii): 1,491 files, 90,431 tests green; shared tests, typecheck (platform, shared), oxlint, knip, docs suite, lint:links, lint:manual, configs:validate.
  • backend:integration lanes checkProviderCredentials, checkTranscription, checkImageGenerationAdmission: 94/94.
  • An independent review of the diff; its findings are fixed in the last commit.

Not covered

  • The OpenAI images API itself (api.openai.com) was not called (no OpenAI key here); GPT Image 2.5 prices are read from OpenAI's model pages.
  • OpenRouter still lists openai/gpt-image-1 and openai/gpt-5-image, which fail upstream.
  • On 2026-12-01, remove gpt-image-1-mini from configs/platform/system/models/openai/models.yml and PREFERRED_IMAGE_MODELS.

OpenRouter publishes the aspect ratios, reference-image range and output
formats of every image model in its image API listing
(`/api/v1/images/models`). The catalog now merges those facts into the
image entries it already lists, so the image lane can ask each model for
what it draws.

An image generator that writes no text may also publish no context
window: OpenRouter lists the Seedream 5.0 family with 0, and the catalog
dropped all three. Such a model is now kept with a window of 0, as pure
transcription already was.
Live against OpenRouter (2026-10-27), image generation failed in ways the
platform could have avoided:

- Every Recraft model refuses the 3:2 and 2:3 a landscape and a portrait
  asked for. A request now asks for the shape the model draws closest to
  the one wanted (4:3 and 3:4 on Recraft), from the facts its catalog
  entry carries.
- Edit models need a reference image in every request, and vector models
  return SVG, which the platform does not store. Neither can serve the
  tool, so neither is offered in the picker or picked automatically.
- More reference images than a model takes (Gemini 2.5 Flash Image takes
  three) are refused before anything is spent, with the model's limit.
- OpenAI shut GPT Image 1 down on 2026-10-23 and shuts GPT Image 1 Mini
  down on 2026-12-01. The recommended list now names GPT Image 2.5 Flare,
  the successor OpenAI names, and the OpenAI catalog lists GPT Image 2.5
  Flare and Sunburst and GPT Image 2 instead of GPT Image 1.
- Through OpenRouter, a GPT image model on `auto` quality cost about four
  times its `medium` price; it is now asked for `medium`, as on OpenAI.
An image attached in chat reaches the model as pixels, which name neither
the file nor its ref, so a request to edit an upload could not hand it to
generate_image: the model guessed "image1.jpg" and the tool found no such
image. The model-facing turn now lists each attached image with its ref,
beside the documents it already listed, for any tool that takes files.
The Models page and the self-hosted provider reference now say what the
image lane does since it follows each model's limits: the closest shape a
model draws, no edit or vector models in the picker, the reference-image
limit refused before anything is billed, GPT Image 2.5 Flare in the
recommended list, and OpenAI's shutdown of GPT Image 1 and GPT Image 1
Mini. The chat guide shows starting a new image from an attached photo.

The chat spec states it as CHAT-R31, held by the attachment boundary
tests, and the manual layer gains GOV-F68 (Recraft's closest shape) and
CHAT-F78 (an image from an attached photo).
The appendix that lists attached images rides every chat turn, also one
offered no tool that takes files, so it names none: a model is never told
about a tool it was not offered (CHAT-R18). A catalog's output formats are
compared case-insensitively.

The integration vendor stub now answers OpenRouter's image model listing,
so the catalog it serves carries the image facts the live one does.
…models

From an independent review of the image changes:

- A failed or unreadable facts listing was cached as a good catalog for a
  day, sending Recraft 3:2 requests and admitting vector models again. The
  last facts now keep serving, and an incomplete catalog is fetched again
  once the failure back-off lapses. The supplements are fetched at once.
- Each image fact is read on its own, a reference minimum without a
  maximum is kept, and the first entry of an id decides it.
- An edit model stays selectable, as it was: a call without the picture it
  needs is refused before anything is spent, saying why. Automatic still
  never picks one; vector models stay out.
- GPT Image 1 Mini stays in the automatic list behind GPT Image 2.5 Flare
  until OpenAI shuts it down, so a credential limited to it keeps working.
- The provider docs no longer promise reference limits for custom
  endpoints, which publish none, nor a window they do not need.
- One tag and one aspect-ratio pattern, shared; an image's name is quoted
  in the appendix; tests for the newest turn's appendix and the request's
  shape.
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 27, 2026
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 27, 2026
@yannickmonney
yannickmonney removed this pull request from the merge queue due to a manual request Oct 27, 2026
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 1ea59ab Oct 28, 2026
63 checks passed
@yannickmonney
yannickmonney deleted the fix/image-generation branch October 28, 2026 00:56
@yannickmonney

yannickmonney commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Release lease: Tale v0.5.93

  • Holder: the release lane on the owner's machine, acting on the owner's request to merge this pull request and release a new version.
  • Candidate: 1ea59abe9fbb3e05618b07b943396891ee3de541 (this pull request's merge), version v0.5.93. Since v0.5.92 (53d1fdb040) it adds fix(deps): take better-auth 1.7.7 for the sign-in advisories #5061 (better-auth 1.7.7), docs: write the v0.5.93 release notes #5058 (the v0.5.93 notes, which validate at the candidate) and this pull request.
  • Acquired 2026-10-28T00:58Z, expires 2026-10-28T03:58Z.
  • Plan:
    • Send one release-candidate dispatch for the candidate, then run the gate.
    • The latest release is v0.5.92 (2026-10-26), so today's admission is free.
    • Before the tag, run the gate again and re-read the holds.
    • The newest Workspace upgrade run on main passed at 53d1fdb040 (run 40450572478, scheduled 2026-10-27 04:35Z).
      Update 2026-10-28 01:40Z: validated and eligible; the tag waits on the Workspace upgrade run.
  • Candidate runs: all seven Release candidate 1ea59abe9f… runs concluded success on attempt 1 (Build 40612052549, Checks 40612052477, CLI 40612052466, Commitlint 40612052620, E2E 40612052605, SAST 40612052431, Security 40612052484).
  • Gate: it answered eligible for v0.5.93 against the latest release v0.5.92 at 53d1fdb040.
  • Workspace upgrade: run 40614220014 at the candidate. The cutover leg (from v0.5.77) passed. The previous leg (from v0.5.91) failed before any of the candidate's code ran. The published v0.5.91 CLI's tale update -v 0.5.92 got unknown certificate verification error from api.github.com, and the CLI built from main got the same error one second later on the same runner. The cutover leg ran the same step 49 seconds later on another runner and passed. The failed leg is being re-run (attempt 2). The tag waits for it to pass.
    Update 2026-10-28 01:54Z: tagged.
  • Workspace upgrade: run 40614220014's previous leg passed on attempt 2 (01:38Z to 01:51Z). Every check passed: tale update from 0.5.91 to 0.5.92, the deploy, the data, sign-in and a second deploy. The newest run on main is now success at the candidate.
  • Gate: at 01:53Z it answered eligible again, with no reasons.
  • Holds: read again just before the tag. None is recorded on GitHub against the candidate.
  • Tag: v0.5.93 was pushed at 01:53:12Z, and Release run 40617676922 is running. The receipt follows once publication is verified.

Update 2026-10-28 02:30Z: published and verified, so the lease is released. The receipt is the next comment.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Release receipt: Tale v0.5.93

  • Candidate: 1ea59abe9fbb3e05618b07b943396891ee3de541 (this pull request's merge), version v0.5.93. Since v0.5.92 (53d1fdb040) it adds fix(deps): take better-auth 1.7.7 for the sign-in advisories #5061 (better-auth 1.7.7), docs: write the v0.5.93 release notes #5058 (the v0.5.93 notes) and this pull request.

  • Candidate runs: Release candidate 1ea59abe9f…, all success on attempt 1, dispatched 2026-10-28 00:57:24Z, after the merge at 00:55:56Z.

    Workflow Run Attempt
    Build 40612052549 1
    Checks 40612052477 1
    CLI 40612052466 1
    Commitlint 40612052620 1
    E2E 40612052605 1
    SAST 40612052431 1
    Security 40612052484 1
  • Main's push runs at the candidate: Build, Checks, CLI, Commitlint and SAST, all success.

  • Gate: at 01:53Z it answered eligible for v0.5.93, with no reasons. The latest release was v0.5.92 at 53d1fdb040, and the arrival was fix(platform): make image generation follow each image model's limits #5057 at 00:55:56Z.

  • Workspace upgrade before the tag: run 40614220014 at the candidate.

    • The cutover leg (from v0.5.77) passed on attempt 1.
    • The previous leg (from v0.5.91) failed on attempt 1 before any of the candidate's code ran. The published v0.5.91 CLI's tale update -v 0.5.92 got unknown certificate verification error from api.github.com, and the CLI built from main got the same error one second later on the same runner. The cutover leg ran the same step 49 seconds later on another runner and passed.
    • The failed leg was re-run, and attempt 2 passed every check: the update from 0.5.91, the deploy, the data, the owner's sign-in and a second deploy.
  • Tag: v0.5.93 → 1ea59abe9f…, pushed 2026-10-28 01:53:12Z.

  • Release run 40617676922: success, 39 of 39 jobs, attempt 1, from 01:53:14Z to 02:03:57Z.

    • The GitHub release was published at 02:03:41Z and is marked latest.
    • It holds Highlights, Upgrade notes, API contract changes and the PR list.
  • CLI publication: run 40618702900, success (Prepare, five builds, Attach to release), from 02:03:49Z to 02:11:28Z. Six assets: tale_linux, tale_linux_arm64, tale_macos, tale_macos_x64, tale_windows.exe, tale_checksums.txt. tale_macos matches its line in tale_checksums.txt and answers --version with 0.5.93.

  • Publish packages: run 40618704461, success. Both tags record from 1ea59abe9fbb3e05618b07b943396891ee3de541:

    • ui-v0.5.93 (f89dff6871);
    • marketing-ui-v0.5.93 (1af9d8f5b2).
  • Image revision: every service's :0.5.93 carries org.opencontainers.image.revision = 1ea59abe9fbb3e05618b07b943396891ee3de541.

    • It is on each OCI index's annotations (11 of 11) and on the linux/amd64 and linux/arm64 config labels (22 of 22), read from GHCR.
    • :latest names the same index for each.
    • The services: db, docs, platform, proxy, sandbox, sandbox-buildkitd, sandbox-egress, sandbox-llm-gateway, sandbox-runtime, ui-docs and web.
    • The documented docker pull check gives the same revision (docker image inspect --platform linux/amd64 on Docker 29).
  • Workspace upgrade after publication: run 40619728929, dispatched on main (the candidate) at 02:14:13Z, success on attempt 1. It upgraded workspaces from v0.5.92 and from v0.5.77 to the published v0.5.93 images, and every check passed, including the refused rollback across the cutover.

  • Holds: none recorded on GitHub against 1ea59abe9f. They were read at 01:41Z and again at 01:53Z, just before the tag.

  • Docs: the pages the Highlights link answer, and the #let-agents-generate-images anchor resolves. docs.tale.dev does not show this release's text yet.

  • Ops: not adopted. The "Adopt Tale release" job is skipped on every schedule (last at 01:56Z) because TALE_RELEASE_ADOPTION_ENABLED is false (since 2026-10-17 04:34Z). Adopting v0.5.93 is the account holder's call: by the adopter, or by hand (tools/release-adoption/README.md in tale-project/ops, "Adopting a release by hand").

  • Lease: released with this receipt.

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