diff --git a/src/shared/validation/settingsSchemas.ts b/src/shared/validation/settingsSchemas.ts index 83d87893f9..7bfc8c031f 100644 --- a/src/shared/validation/settingsSchemas.ts +++ b/src/shared/validation/settingsSchemas.ts @@ -174,6 +174,8 @@ export const updateSettingsSchema = z.object({ ) .optional(), customBannedSignals: z.array(z.string().max(200)).optional(), + customSystemPromptEnabled: z.boolean().optional(), + customSystemPrompt: z.string().max(10000).optional(), // #9817: opt-in (default off) — lets a probe-origin (model test-all) // failure deactivate a connection like real traffic. Off by default: // probe failures are recorded but never mutate routing state. diff --git a/tests/unit/custom-system-prompt-settings-persistence.test.ts b/tests/unit/custom-system-prompt-settings-persistence.test.ts new file mode 100644 index 0000000000..2947c5af90 --- /dev/null +++ b/tests/unit/custom-system-prompt-settings-persistence.test.ts @@ -0,0 +1,15 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { updateSettingsSchema } from "@/shared/validation/settingsSchemas"; + +test("updateSettingsSchema preserves customSystemPromptEnabled and customSystemPrompt fields", () => { + const input = { + customSystemPromptEnabled: true, + customSystemPrompt: "Always respond politely", + }; + + const parsed = updateSettingsSchema.parse(input); + + assert.equal(parsed.customSystemPromptEnabled, true); + assert.equal(parsed.customSystemPrompt, "Always respond politely"); +});