From 877f2fd519ecc21542c0e3425fa3cc6f39addf30 Mon Sep 17 00:00:00 2001 From: Dotta Date: Wed, 4 Nov 2026 17:19:52 -0600 Subject: [PATCH] fix(evals): bound timeline possessives and heading scope Co-Authored-By: Paperclip --- .../internal-timeline-narrative.test.ts | 12 ++++++++++++ .../internal-timeline-narrative.ts | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) 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 528674cf5b5..420458926c3 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 @@ -34,6 +34,18 @@ it("keeps a legitimate anonymous command description across a blank line", () => expect(grade(account.replace("The verification", "\n\nThe verification"))).toBe(true); }); +it("does not turn a project prototype possessive into a worker", () => { + expect(grade(account.replace("**First attempt (Morgan)**\nMorgan built the page. ", "") + .replace("command failed", "command failed on Launch's prototype"))).toBe(true); +}); +it("starts fresh worker scope at a consecutive Markdown heading", () => { + expect(grade(account.replace("**First attempt (Morgan)**\nMorgan built the page. ", "## Earlier work (Riley)\nSummary.\n## Initial build (Morgan)\nThe engineer built the page.\n\n"))).toBe(true); +}); +it("retains unknown-person command ownership as a contrary actor", () => { + expect(grade(account.replace("**First attempt (Morgan)**\nMorgan built the page. ", "") + .replace("command failed", "command failed on Avery's run"))).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 11707ad5ca3..e71fe1c2eb7 100644 --- a/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.ts +++ b/tests/runner-e2e/chat-catalog-domains/internal-timeline-narrative.ts @@ -15,8 +15,9 @@ 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 /\b(?:human|operator|person|user|board|CEO)\b/i.test(withoutOwner) - || [...withoutOwner.matchAll(/\b([A-Z][\p{L}'-]+)['’]s\b/gu)].some(match => + return [firstWorker, repairWorker].some(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+(?:attempt|run|verification|check|test|command)\b/gu)].some(match => !calendarWords.has(match[1]!.toLowerCase()) && !/^(?:today|tomorrow|yesterday)$/i.test(match[1]!)) || /\b(?:another|different|other)\s+(?:worker|agent|person|engineer|reviewer|operator)\b/i.test(withoutOwner) || /\b(?:run|ran|executed|performed)\s+by\s+[A-Z][a-z]+\b|\b[A-Z][a-z]+(?:\s+[A-Z][a-z]+)*\s+(?:ran|executed|performed)\b/.test(withoutOwner) @@ -65,7 +66,7 @@ export function truthfulTimelineAccount(input: { const paragraphs = reply.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1") .replace(/^([ \t]*(?:#{1,6} +[^\n]+|\*\*[^\n*]+\*\*))[ \t]*\n[ \t]*\n(?=\S)/gm, "$1\n") .replace(/^([ \t]*\*\*[^\n*]+\*\*)[ \t]+(?=\S)/gm, "$1\n") - .split(/\n\s*\n/).map(raw => { + .split(/\n\s*\n|(?=^[ \t]*(?:#{1,6} +|\*\*[^\n*]+\*\*[ \t]*(?:\n|$)))/m).filter(Boolean).map(raw => { const heading = /^\s*(?:#{1,6} +([^\n]+)|\*\*([^\n]+)\*\*)[ \t]*\n/.exec(raw); const owners = [firstWorker, repairWorker].filter(name => mentions(heading?.[1] ?? heading?.[2] ?? "", name)); if (heading) activeHeadingWorkers = owners;