diff --git a/tests/runner-e2e/chat-catalog-domains/internal-goals.ts b/tests/runner-e2e/chat-catalog-domains/internal-goals.ts index b9c6fe30aee..479cff6e21b 100644 --- a/tests/runner-e2e/chat-catalog-domains/internal-goals.ts +++ b/tests/runner-e2e/chat-catalog-domains/internal-goals.ts @@ -275,8 +275,9 @@ function initialPurposeValid(o: InternalObservation): boolean { function groundedPurpose(reply: string): boolean { // The saved business fact is support for research teams. A fixture nonce is // never business meaning and faithful paraphrases need not repeat it. - return /\bresearch(?:ers)?\b/i.test(reply) && /\b(?:teams?|groups?)\b/i.test(reply) - && /\b(?:support|supports|help|helps|serve|serves|benefit|enable|for)\b/i.test(reply) + return reply.split(/[.\n;]|\bbut\b/i).some(part => /\bresearch(?:ers)?\b/i.test(part) && /\b(?:teams?|groups?)\b/i.test(part) + && /\b(?:support|supports|help|helps|serve|serves|benefit|enable|for)\b/i.test(part) + && !/\b(?:(?:does|do|will|would|can|could|is|are)\s+not|doesn't|don't|won't|can't|cannot|never)\s+(?:\w+\s+){0,2}(?:support|help|serve|benefit|enable)\b|\bnot\s+(?:(?:intended|meant)\s+to\s+(?:support|help)|for\s+(?:research|researchers))\b/i.test(part)) && !reply.split(/[.\n;]/).some(part => !/\b(?:no|not|without|isn't|doesn't)\b/i.test(part) && /\b(?:sell(?:ing)?\s+(?:ads?|advertising|data)|ad revenue|advertising revenue)\b/i.test(part)); } diff --git a/tests/runner-e2e/chat-catalog-domains/internal.test.ts b/tests/runner-e2e/chat-catalog-domains/internal.test.ts index 710bb608756..3c589bca697 100644 --- a/tests/runner-e2e/chat-catalog-domains/internal.test.ts +++ b/tests/runner-e2e/chat-catalog-domains/internal.test.ts @@ -266,6 +266,16 @@ describe("goal oracle phase binding", () => { (o.state.initialPurpose as InternalObservation).reply = "The website exists to sell advertising for research teams."; expect(gradeInternal(o).passed).toBe(false); }); + it("rejects explicit negation of the saved business purpose while accepting future support", () => { + const o = valid("goals.explain-purpose"); const initial = o.state.initialPurpose as InternalObservation; + initial.reply = "The website does not support research teams."; expect(gradeInternal(o).passed).toBe(false); + initial.reply = "The website will help research groups sign up."; expect(gradeInternal(o).passed).toBe(true); + }); + it("accepts the preserved first alignment reply's narrow context-only explanation", () => { + const o = valid("goals.align-existing-work"); + (o.state.authorizedAlignment as { reply: string }).reply = "Done.\n\n- [Launch project](/RUN/projects/launch) → **Growth: reach 1,000 signups**\n- [RUN-1 Website task](/RUN/issues/RUN-1) → **Growth: reach 1,000 signups**\n\nVerified both links with fresh reads; no other fields changed."; + expect(gradeInternal(o).passed).toBe(true); + }); it("rejects a conditional missing-context task contaminating the initial reference", () => { const o = valid("goals.explain-purpose"); (o.state.initialPurpose as InternalObservation).tasks.push({ id: "missing-task", title: "Unaligned website work", goalId: null });