Skip to content

Commit 6483c49

Browse files
committed
fix: cover compound post-tool acknowledgements
1 parent 986b74c commit 6483c49

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/agents/embedded-agent-helpers/messaging-dedupe.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const MIN_DUPLICATE_TEXT_LENGTH = 10;
77
const MIN_REVERSE_SUBSTRING_DUPLICATE_RATIO = 0.5;
88
const MAX_POST_TOOL_SEND_META_ACK_LENGTH = 80;
99
const POST_TOOL_SEND_META_ACK_PATTERNS: readonly RegExp[] = [
10-
/^(?:(?:||)?|(?:|)?||(?:|)?)(?:[\s,.!:-]*(?:[#][\p{L}\p{N}_-]+|\d+))?[\s.!]*$/iu,
11-
/^(?:|||(?:|)?)[\s.!:]*$/u,
12-
/^(?:sent(?:\s+(?:above|already|[#][\p{L}\p{N}_-]+))?|posted|done|ok(?:ay)?|roger|got\s+it|ack(?:nowledged)?|replied\s+above)[\s.!]*$/iu,
10+
/^(?:(?:||)?|(?:|)?||(?:|)?)(?:[\s,.!:-]*(?:[#][\p{L}\p{N}_-]+|\d+|\((?:[#][\p{L}\p{N}_-]+|\d+)\)|(?:||)?))?[\s.!]*$/iu,
11+
/^(?:|||(?:||)?)[\s.!:]*$/u,
12+
/^(?:sent(?:\s+(?:above|already|[#][\p{L}\p{N}_-]+))?|posted|done|ok(?:ay)?|roger|got\s+it|ack(?:nowledged)?|replied\s+above)(?:[\s,.!:-]*(?:replied\s+(?:above|in\s+thread)|that's\s+the\s+fix|no\s+more\s+content))?[\s.!]*$/iu,
1313
];
1414

1515
/**

src/auto-reply/reply/followup-delivery.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,30 @@ describe("resolveFollowupDeliveryPayloads", () => {
345345
).toStrictEqual([]);
346346
});
347347

348+
it("drops compound meta acknowledgements without dropping substantive short replies", () => {
349+
expect(
350+
resolveFollowupDeliveryPayloads({
351+
cfg: baseConfig,
352+
payloads: [
353+
{ text: "已发, 不再追加总结" },
354+
{ text: "Sent. Replied in thread." },
355+
{ text: "OK, that's the fix." },
356+
{ text: "OK, here is the actual answer." },
357+
],
358+
messageProvider: "telegram",
359+
originatingTo: "telegram:123",
360+
sentTargets: [
361+
{
362+
tool: "message",
363+
provider: "telegram",
364+
to: "telegram:123",
365+
text: "完整主回复内容已经通过 message tool 发出",
366+
},
367+
],
368+
}),
369+
).toEqual([{ text: "OK, here is the actual answer." }]);
370+
});
371+
348372
it("dedupes duplicate replies when a messaging tool already sent to the same provider and target", () => {
349373
expect(
350374
resolveFollowupDeliveryPayloads({

0 commit comments

Comments
 (0)