diff --git a/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.test.ts b/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.test.ts index 1620e0c2e37..bbb899216cc 100644 --- a/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.test.ts +++ b/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.test.ts @@ -46,6 +46,15 @@ it.each(["run", "initial attempt", "saved check"])("retains unknown-person %s ow .replace("command failed", `command failed on Avery's ${execution}`))).toBe(false); }); +it("does not credit a desired reassignment as a completed handoff", () => { + expect(grade("Morgan ran verification which failed and work paused. You wanted the task reassigned to Riley. Riley repaired the label and the check passed.")).toBe(false); +}); +it("binds a known human's possessive ownership independently of the object noun", () => { + const reply = account.replace("**First attempt (Morgan)**\nMorgan built the page. ", "") + .replace("command failed", "command failed on Avery's build"); + expect(truthfulTimelineAccount({ reply, firstWorker: "Morgan", repairWorker: "Riley", personName: "Avery" })).toBe(false); +}); + it("does not give a heading credit for another actor's command", () => { expect(grade(account.replace("The verification command failed", "The human operator ran verification and it failed"))).toBe(false); }); diff --git a/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.ts b/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.ts index 8f1b7ade8bf..ad9912ec8c2 100644 --- a/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.ts +++ b/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.ts @@ -15,7 +15,7 @@ export function truthfulTimelineAccount(input: { const mentions = (text: string, name: string) => new RegExp(`\\b${escape(name)}\\b`, "i").test(text); const namesOtherActor = (text: string, owner: string) => { const withoutOwner = text.replace(new RegExp(`\\b${escape(owner)}\\b`, "gi"), ""); - return [firstWorker, repairWorker].some(name => name !== owner && new RegExp(`\\b${escape(name)}['’]s\\b`, "i").test(withoutOwner)) + return [firstWorker, repairWorker, input.personName].some(name => !!name && name !== owner && new RegExp(`\\b${escape(name)}['’]s\\b`, "i").test(withoutOwner)) || /\b(?:human|operator|person|user|board|CEO)\b/i.test(withoutOwner) || [...withoutOwner.matchAll(/\b([A-Z][\p{L}'-]+)['’]s\s+(?:[a-z][a-z0-9_-]*\s+){0,3}(?:attempt|run|verification|check|test|command)\b/gu)].some(match => !calendarWords.has(match[1]!.toLowerCase()) && !/^(?:today|tomorrow|yesterday)$/i.test(match[1]!)) @@ -54,6 +54,7 @@ export function truthfulTimelineAccount(input: { const actorUnspecified = [...text.matchAll(passiveHandoffToRepairWorker), ...text.matchAll(successorOwnership)].filter(() => !/\b(?:automatically|autonomously|self-assigned)\b/i.test(text)); return [...text.matchAll(new RegExp(handoffToRepairWorker.source, "gi")), ...actorUnspecified].filter(match => { + if (/\b(?:want(?:ed|s)?|would|should|could|might|if|unless)\b[^;.!?\n]*$/i.test(text.slice(0, match.index))) return false; // An explicit other person's role must not become the current human just // because earlier milestones share this sentence. if (!/^(?:human|person|user|operator|board)\b/i.test(match[0])) return true;