diff --git a/tests/runner-e2e/chat-flow.test.ts b/tests/runner-e2e/chat-flow.test.ts index 5d8fdd8ed0..7e54a43641 100644 --- a/tests/runner-e2e/chat-flow.test.ts +++ b/tests/runner-e2e/chat-flow.test.ts @@ -58,6 +58,17 @@ describe("chat acceptance contracts", () => { expect( isChatClarificationReply("Tell me the intended audience and format."), ).toBe(true); + expect( + isChatClarificationReply( + "Thanks — before assigning the welcome-note drafting work, I need a compact brief covering:\n\n- Club and audience: club name and intended readers.\n- Purpose: welcome or next steps.\n- Required content: dates, links, and contacts.\n- Voice: tone and sender.\n- Delivery constraints: format, length, and deadline.\n- Examples or policies: existing notes and approval requirements.", + ), + ).toBe(true); + expect(isChatClarificationReply("I'll need your details about the audience and format.")).toBe(true); + expect(isChatClarificationReply("We need some information about the club and intended readers.")).toBe(true); + expect(isChatClarificationReply("I needed a compact brief before I assigned the work.")).toBe(false); + expect(isChatClarificationReply("I need a compact brief:")).toBe(false); + expect(isChatClarificationReply("I need information.")).toBe(false); + expect(isChatClarificationReply("I need to create the task and write the note.")).toBe(false); expect(isChatClarificationReply("Please share:")).toBe(false); expect(isChatClarificationReply("Please share.")).toBe(false); expect( diff --git a/tests/runner-e2e/chat-flow.ts b/tests/runner-e2e/chat-flow.ts index 13845246c7..d96e90a655 100644 --- a/tests/runner-e2e/chat-flow.ts +++ b/tests/runner-e2e/chat-flow.ts @@ -53,6 +53,8 @@ export function isChatClarificationReply(body: string): boolean { if (body.includes("?")) return true; const request = body.match( /\b(?:please\s+(?:share|provide|clarify|confirm)|tell me|let me know)\b([\s\S]*)/i, + ) ?? body.match( + /\b(?:I|we)(?:'ll|\s+will)?\s+need\s+(?:(?:a|some|the|your|more|following|compact|short|few|additional)\s+){0,4}(?:brief|details|information|context|clarification)\b([\s\S]*)/i, ); return Boolean(request && /[\p{L}\p{N}]/u.test(request[1])); }