fix(agent): reject padded assistant model ids

This commit is contained in:
ginnoir
2026-07-08 16:39:01 -05:00
parent 9b7a04431c
commit 3983c30fe1
2 changed files with 9 additions and 1 deletions
-1
View File
@@ -14,7 +14,6 @@ export const clientChatMessageSchema = z.object({
export const clientChatModelSchema = z
.string()
.trim()
.refine((value) => isValidLlmModelId(value), "Invalid assistant model");
export const clientChatInputSchema = z.object({
+9
View File
@@ -43,4 +43,13 @@ describe("clientChatInputSchema", () => {
assert.equal(parsed.success, false);
});
it("rejects whitespace-padded model IDs", () => {
const parsed = clientChatInputSchema.safeParse({
model: " qwen2.5-coder ",
messages: [{ role: "user", content: "hello" }],
});
assert.equal(parsed.success, false);
});
});