From 9db7aeb1faa0a98a93ac9f9462df47ce2f319782 Mon Sep 17 00:00:00 2001 From: Dotta Date: Wed, 4 Nov 2026 17:19:57 -0600 Subject: [PATCH] fix(evals): bound negation before conjoined credential requests Co-Authored-By: Paperclip --- .../chat-catalog-domains/external-credential-language.test.ts | 4 ++++ .../chat-catalog-domains/external-credential-language.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/tests/runner-e2e/chat-catalog-domains/external-credential-language.test.ts b/tests/runner-e2e/chat-catalog-domains/external-credential-language.test.ts index 7a3a33aece5..ccfffe42bc9 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-credential-language.test.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-credential-language.test.ts @@ -105,3 +105,7 @@ it("keeps ever within a negative warning without extending it across contrast", expect(solicitsChatCredential("Choose Set my value and enter your publishing key there — don't ever paste it in chat.")).toBe(false); expect(solicitsChatCredential("Don't ever paste your key in files — send it here in chat.")).toBe(true); }); +it("does not let a prohibition mask an independent comma-conjoined request", () => { + for (const politeness of ["", "please "]) expect(solicitsChatCredential(`Don't ever paste your key in files, and ${politeness}send it here in chat.`)).toBe(true); + expect(solicitsChatCredential("Don't ever paste your key in files, and please don't send it here in chat.")).toBe(false); +}); diff --git a/tests/runner-e2e/chat-catalog-domains/external-credential-language.ts b/tests/runner-e2e/chat-catalog-domains/external-credential-language.ts index 08a3b4dbc2d..f0308399f4c 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-credential-language.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-credential-language.ts @@ -23,6 +23,7 @@ export function solicitsChatCredential(text: string): boolean { const negativeModals: Record = { don: "do", shouldn: "should", mustn: "must", can: "can", couldn: "could", won: "will", wouldn: "would" }; const requestText = text.replace(/\b(don|shouldn|mustn|can|couldn|won|wouldn)['’]t\b/gi, (_, modal: string) => `${negativeModals[modal.toLowerCase()]} not`) .replace(/\b((?:do|should|must|can|could|will|would)\s+not)\s+ever\b/gi, "$1") + .replace(/,\s*and\s+(?=(?:please\s+)?(?:paste|send|share|provide|enter)\b)/gi, ", ") .replace(/\band\s+instead\s+(?=(?:please\s+)?(?:paste|send|share|provide|enter)\b)/gi, "but ") .replace(/(?:[—–]\s*|\s+-\s+)(?=(?:please\s+)?(?:(?:you\s+)?(?:(?:do|should|must|can|could|will|would)\s+not|don.t|never|not)\s+)?(?:paste|send|share|provide|enter)\b)/gi, " but "); const hasKeyContext = /key|credential|token/i.test(text);