mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-05 00:56:23 +00:00
The codex image provider's fail-fast gate required an `imagegenext` row in
`codex features list`. Codex CLI 0.145 renamed that flag to `image_generation`
and dropped the old row, so the gate rejected every up-to-date CLI:
media-use: codex image upsell unavailable: codex imagegenext unavailable
(upgrade Codex CLI)
`resolve --type image --provider codex` returned that without ever attempting
a render, on hosts where image generation works fine. Codex itself now warns
`[features].imagegenext is deprecated. Use [features].image_generation`.
Resolve the flag name from the feature list instead of hardcoding it, and pass
whichever name the installed CLI exposes to `--enable`. The old name is
preferred when present, since CLIs that still list it reject the new one.
`codexUnavailableReason()` now returns `{ flag }` / `{ reason }` so the
resolved name reaches the exec.
Verified against codex-cli 0.145.0: `resolve --type image --provider codex`
generates and freezes an image. New unit tests pin both flag layouts so a
future rename fails loudly instead of silently disabling the provider.
35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert";
|
|
import { imageGenFlag } from "./codex-provider.mjs";
|
|
|
|
// Real `codex features list` output is three space-padded columns:
|
|
// <name> <stage> <enabled>
|
|
const OLD_CLI = [
|
|
"image_detail_original removed false",
|
|
"image_generation stable true",
|
|
"imagegenext under development false",
|
|
].join("\n");
|
|
|
|
const NEW_CLI = [
|
|
"image_detail_original removed false",
|
|
"image_generation stable true",
|
|
].join("\n");
|
|
|
|
test("older CLIs keep the old flag — they reject --enable image_generation", () => {
|
|
assert.equal(imageGenFlag(OLD_CLI), "imagegenext");
|
|
});
|
|
|
|
test("Codex CLI >=0.145 dropped the imagegenext row; fall back to its new name", () => {
|
|
// The regression this guards: gating on `imagegenext` alone made the provider
|
|
// report "unavailable" on every up-to-date CLI, without attempting a render.
|
|
assert.equal(imageGenFlag(NEW_CLI), "image_generation");
|
|
});
|
|
|
|
test("no image feature at all is unavailable, not a silent default", () => {
|
|
assert.equal(imageGenFlag("apps stable true\nhooks stable true"), null);
|
|
});
|
|
|
|
test("substring lookalikes do not count as the feature row", () => {
|
|
assert.equal(imageGenFlag("image_generation_v2 stable true"), null);
|
|
});
|