diff --git a/tests/runner-e2e/chat-catalog-domains/external-company-secret-question.test.ts b/tests/runner-e2e/chat-catalog-domains/external-company-secret-question.test.ts index 41989baebee..d2752608a65 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-company-secret-question.test.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-company-secret-question.test.ts @@ -29,9 +29,16 @@ it("actual company act admits its safe question before private human entry",asyn await expect(companySecretExternalCases[0]!.act!(ctx,{currentPersonId:"person"})).rejects.toThrow("NEXT_REAL_HUMAN_PHASE");expect(reached).toBe(true); }); it("accepts Done and completed-setup Yes without repeating the already-bound consumer",()=>{ - for(const label of ["Done","Yes"]){const row=question();row.payload.questionSet!.questions[0]!.options![0]!.label=label;expect(companySecretQuestionHandoff(row,binding)).toMatchObject({optionId:"yes"});} + for(const label of ["Done","Yes","Done, ready to continue","Done for deployment"]){const row=question();row.payload.questionSet!.questions[0]!.options![0]!.label=label;expect(companySecretQuestionHandoff(row,binding)).toMatchObject({optionId:"yes"});} }); it("rejects prospective Yes and negative or other-owner completion choices",()=>{ const prospective=question();prospective.payload.questionSet!.questions[0]!.prompt="Would you like me to configure this?";prospective.payload.questionSet!.questions[0]!.options![0]!.label="Yes";expect(companySecretQuestionHandoff(prospective,binding)).toBeUndefined(); for(const label of ["Not done","I didn't save it","I haven't added it","Done for Riley"]){const row=question();row.payload.questionSet!.questions[0]!.options![0]!.label=label;expect(companySecretQuestionHandoff(row,binding)).toBeUndefined();} }); + +it("keeps an explicit Morgan acknowledgement and rejects other named completion recipients",()=>{ + for(const [recipient,accepted] of [["Morgan",true],["CEO",false],["Jordan",false]] as const){ + const row=question();row.payload.questionSet!.questions[0]!.options![0]!.label=`Done for ${recipient}`; + expect(!!companySecretQuestionHandoff(row,binding)).toBe(accepted); + } +}); diff --git a/tests/runner-e2e/chat-catalog-domains/external-company-secret.ts b/tests/runner-e2e/chat-catalog-domains/external-company-secret.ts index 9656d3fdb53..4f43dede879 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-company-secret.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-company-secret.ts @@ -49,7 +49,9 @@ export function companySecretQuestionHandoff(value:unknown,b:SecretQuestionBindi const completedPrompt=/\b(?:have you|did you)\b[^?]*\b(?:saved|added|entered|bound|configured|completed|finished)\b/i.test(q.prompt); const choices=q.options!.filter(o=>{ const answer=`${o.label} ${o.description??""}`; + const recipients=[...answer.matchAll(/\b(?:[Ff]or|[Tt]o)\s+(?:the\s+)?(?:[Aa]gent\s+([A-Za-z][A-Za-z0-9_-]*)|([A-Z][A-Za-z0-9_-]*)|([Cc][Ee][Oo]))\b/g)]; return (/\b(?:saved|added|entered|done)\b/i.test(answer)||(completedPrompt&&/^yes[.!\s]*$/i.test(answer.trim()))) + &&recipients.every(match=>/^Morgan$/i.test(match[1]??match[2]??match[3]??"")) &&!/\b(?:not|never|cannot|can't|didn.t|haven.t|hasn.t|yet|need|later|will|would|Riley|another|their)\b|someone else/i.test(answer); }); if(choices.length!==1)return;const option=choices[0]!;