Files
openclaw/extensions/reef/src/rejection-resend.test.ts
Peter Steinberger 39cddf847e fix(reef): keep routine agent replies from disappearing (#109160)
* fix(reef): relax guard and surface rejections

* fix(reef): preserve ordered rejection notices

* fix(reef): bound rejection notice retries

* fix(reef): persist correlated rejection notices

* fix(reef): align receipt entry typing

* test(reef): type owner notice fixtures

* fix(reef): make rejection feedback restart-safe

* fix(reef): retry rejection state reads

* fix(reef): quarantine invalid receipts

* chore(reef): leave changelog to release

* fix(reef): bind receipts to recipient identity

* refactor(reef): keep receipt types private

* test(reef): preserve notice mock call typing

* fix(reef): reconcile keys before resend recovery

* fix(reef): keep rejection recovery durable

* fix(reef): preserve in-flight receipt upgrades

* test(reef): split receipt flow coverage

* fix(reef): cap automatic guard retries
2026-07-16 12:36:22 -07:00

22 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { isRephrasedReefResend, reefMessageTextHash } from "./rejection-resend.js";
describe("Reef rejection resend policy", () => {
it("rejects empty, unchanged, and whitespace-only rewrites", () => {
const originalTextHash = reefMessageTextHash("ordinary coordination");
expect(isRephrasedReefResend("", originalTextHash)).toBe(false);
expect(isRephrasedReefResend("ordinary coordination", originalTextHash)).toBe(false);
expect(isRephrasedReefResend(" ordinary coordination\n", originalTextHash)).toBe(false);
expect(isRephrasedReefResend("ordinary coordination", originalTextHash)).toBe(false);
expect(isRephrasedReefResend("ordinary\n\tcoordination", originalTextHash)).toBe(false);
});
it("allows one materially changed message only with a bound original hash", () => {
const originalTextHash = reefMessageTextHash("ordinary coordination");
expect(isRephrasedReefResend("Could you share the result?", originalTextHash)).toBe(true);
expect(isRephrasedReefResend("Could you share the result?", undefined)).toBe(false);
});
});