test: expand codex image fallback coverage (#65061) (thanks @zhulijin1991)

This commit is contained in:
Peter Steinberger
2026-04-21 03:46:26 +01:00
parent 92e864a521
commit 201bf85ce9
3 changed files with 44 additions and 7 deletions

View File

@@ -4,17 +4,31 @@ import { __testing } from "./run-attempt.js";
describe("Codex dynamic tool filtering", () => {
it("drops the image tool when the model already has inbound vision input", () => {
const toolNames = __testing
.filterToolsForVisionInputs(
[{ name: "image" }, { name: "read" }, { name: "write" }],
{
modelHasVision: true,
hasInboundImages: true,
},
)
.filterToolsForVisionInputs([{ name: "image" }, { name: "read" }, { name: "write" }], {
modelHasVision: true,
hasInboundImages: true,
})
.map((tool) => tool.name);
expect(toolNames).toContain("read");
expect(toolNames).toContain("write");
expect(toolNames).not.toContain("image");
});
it("keeps the image tool unless both model vision and inbound images are present", () => {
const tools = [{ name: "image" }, { name: "read" }];
expect(
__testing.filterToolsForVisionInputs(tools, {
modelHasVision: false,
hasInboundImages: true,
}),
).toBe(tools);
expect(
__testing.filterToolsForVisionInputs(tools, {
modelHasVision: true,
hasInboundImages: false,
}),
).toBe(tools);
});
});