Revert "fix(coding-agent): prevented WebP encoding for Codex-bound images"

This reverts commit 2e6e0ea3b3.
This commit is contained in:
can1357
2026-06-21 23:28:23 +02:00
parent bcdd37260e
commit 7315059812
2 changed files with 3 additions and 23 deletions
@@ -9,10 +9,9 @@ export const SUPPORTED_INPUT_IMAGE_MIME_TYPES = SUPPORTED_IMAGE_MIME_TYPES;
/**
* Ollama and its local-backend family decode image input through llama.cpp /
* `stb_image`, which is compiled without WebP support. The first-party Codex
* Responses backend also rejects WebP `input_image.image_url` data URLs. Detect
* those models so the resize pipeline encodes to PNG/JPEG instead — the
* automatic equivalent of `OMP_NO_WEBP=1`.
* `stb_image`, which is compiled without WebP support, so a WebP upload fails
* with an opaque HTTP 400. Detect those models so the resize pipeline encodes
* to PNG/JPEG instead — the automatic equivalent of `OMP_NO_WEBP=1`.
*/
export function modelLacksWebpSupport(
model: Pick<Model, "provider" | "api" | "imageInputDecoder"> | undefined,
@@ -20,8 +19,6 @@ export function modelLacksWebpSupport(
if (!model) return false;
return (
model.imageInputDecoder === "stb" ||
model.api === "openai-codex-responses" ||
model.provider === "openai-codex" ||
model.provider === "ollama" ||
model.provider === "ollama-cloud" ||
model.provider === "llama.cpp" ||
@@ -55,10 +55,6 @@ describe("modelLacksWebpSupport", () => {
expect(modelLacksWebpSupport({ provider: "my-local-ollama", api: "ollama-chat" })).toBe(true);
});
test("flags the Codex Responses backend", () => {
expect(modelLacksWebpSupport({ provider: "openai-codex", api: "openai-codex-responses" })).toBe(true);
});
test("flags local model provider ids", () => {
for (const provider of ["llama.cpp", "lm-studio", "local-server"]) {
expect(modelLacksWebpSupport({ provider, api: "openai-completions" })).toBe(true);
@@ -140,19 +136,6 @@ describe("normalizeModelContextImages model-aware WebP exclusion", () => {
expect(["image/png", "image/jpeg"]).toContain(mime);
});
test("re-encodes a WebP image out of WebP for the Codex Responses backend", async () => {
const webp = { type: "image" as const, data: await makeRedWebP(200, 200), mimeType: "image/webp" };
const result = await normalizeModelContextImages([webp], {
model: buildLocalVisionModel("openai-codex", "openai-codex-responses"),
});
expect(result).toHaveLength(1);
const mime = result![0]!.mimeType;
expect(mime).not.toBe("image/webp");
expect(["image/png", "image/jpeg"]).toContain(mime);
});
test("keeps WebP for a WebP-capable model when OMP_NO_WEBP is unset", async () => {
const [anthropic] = getBundledModels("anthropic");
expect(anthropic).toBeDefined();