




























@@ -1,5 +1,6 @@
11import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
22import type { OpenClawConfig } from "../../config/config.js";
3+import { hasCommittedMessagingToolDeliveryEvidence } from "./delivery-evidence.js";
34import { makeAttemptResult } from "./run.overflow-compaction.fixture.js";
45import {
56loadRunOverflowCompactionHarness,
@@ -18,7 +19,6 @@ import {
1819DEFAULT_REASONING_ONLY_RETRY_LIMIT,
1920EMPTY_RESPONSE_RETRY_INSTRUCTION,
2021extractPlanningOnlyPlanDetails,
21-hasCommittedUserVisibleToolDelivery,
2222isLikelyExecutionAckPrompt,
2323PLANNING_ONLY_RETRY_INSTRUCTION,
2424REASONING_ONLY_RETRY_INSTRUCTION,
@@ -1345,24 +1345,34 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {
13451345expect(incompleteTurnText).toContain("verify before retrying");
13461346});
134713471348-it("does not treat empty committed messaging arrays as user-visible delivery", () => {
1348+it("does not treat empty committed messaging arrays as delivery", () => {
13491349expect(
1350-hasCommittedUserVisibleToolDelivery({
1350+hasCommittedMessagingToolDeliveryEvidence({
13511351messagingToolSentTexts: [" "],
13521352messagingToolSentMediaUrls: [],
13531353}),
13541354).toBe(false);
13551355});
135613561357-it("treats committed messaging media as user-visible delivery", () => {
1357+it("treats committed messaging media as delivery", () => {
13581358expect(
1359-hasCommittedUserVisibleToolDelivery({
1359+hasCommittedMessagingToolDeliveryEvidence({
13601360messagingToolSentTexts: [],
13611361messagingToolSentMediaUrls: ["file:///tmp/render.png"],
13621362}),
13631363).toBe(true);
13641364});
136513651366+it("treats committed messaging targets as delivery", () => {
1367+expect(
1368+hasCommittedMessagingToolDeliveryEvidence({
1369+messagingToolSentTexts: [],
1370+messagingToolSentMediaUrls: [],
1371+messagingToolSentTargets: [{ tool: "message", provider: "slack", to: "channel-1" }],
1372+}),
1373+).toBe(true);
1374+});
1375+13661376it("treats committed messaging text as replay-invalid side effect metadata", () => {
13671377expect(
13681378buildAttemptReplayMetadata({
@@ -1385,6 +1395,18 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {
13851395).toEqual({ hadPotentialSideEffects: true, replaySafe: false });
13861396});
138713971398+it("treats committed messaging targets as replay-invalid side effect metadata", () => {
1399+expect(
1400+buildAttemptReplayMetadata({
1401+toolMetas: [],
1402+didSendViaMessagingTool: false,
1403+messagingToolSentTexts: [],
1404+messagingToolSentMediaUrls: [],
1405+messagingToolSentTargets: [{ tool: "message", provider: "slack", to: "channel-1" }],
1406+}),
1407+).toEqual({ hadPotentialSideEffects: true, replaySafe: false });
1408+});
1409+13881410it("leaves committed delivery plus tool errors to the tool-error payload path", () => {
13891411const incompleteTurnText = resolveIncompleteTurnPayloadText({
13901412payloadCount: 0,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。