fix(copilot): a model value must start with a letter or digit

Like resumeSessionId, model follows a flag, so --model --yolo made --yolo its own flag and bypassed the allowAll clamp. New model-plain token pattern, the same rule in the create schema, and golden and schema tests.
This commit is contained in:
Devvyn committed 2026-10-18 00:47:54 +08:00
1 parent 68af012845
commit 6cca5465a9
5 files changed
+45 -2

No files matched your search

+3 -1
View File
@@ -441,10 +441,12 @@ const GrokConfigSchema = z
const CopilotConfigSchema = z
.object({
// A leading alphanumeric, like resumeSessionId below: a value like `--yolo` would otherwise be read
// as its own flag after `--model` (bypassing the allowAll clamp). `/` stays for provider/id.
model: z
.string()
.max(100)
.regex(/^[a-zA-Z0-9._\-/]+$/)
.regex(/^[a-zA-Z0-9][a-zA-Z0-9._\-/]*$/)
.optional(),
allowAll: z.boolean().optional(),
continueSession: z.boolean().optional(),