Reject negated goal rationale in final purpose calibration

This commit is contained in:
Dotta committed 2026-10-26 17:44:36 -05:00
1 parent 5f45ed9fd6
commit ad031f1c59
2 files changed
+13 -2

No files matched your search

@@ -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));
}
@@ -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 });