fix(cli): fail empty local model probes

This commit is contained in:
Peter Steinberger
2026-04-27 23:16:29 +01:00
parent 81390c643b
commit 48e91f09d5
4 changed files with 40 additions and 13 deletions

View File

@@ -419,6 +419,24 @@ describe("capability cli", () => {
);
});
it("fails local model probes when the provider returns no text output", async () => {
mocks.completeWithPreparedSimpleCompletionModel.mockResolvedValueOnce({
content: [],
} as never);
await expect(
runRegisteredCli({
register: registerCapabilityCli as (program: Command) => void,
argv: ["capability", "model", "run", "--prompt", "hello", "--json"],
}),
).rejects.toThrow("exit 1");
expect(mocks.runtime.error).toHaveBeenCalledWith(
expect.stringContaining('No text output returned for provider "openai" model "gpt-5.4"'),
);
expect(mocks.runtime.writeJson).not.toHaveBeenCalled();
});
it("runs gateway model probes without chat-agent prompt policy or tools", async () => {
await runRegisteredCli({
register: registerCapabilityCli as (program: Command) => void,