























@@ -271,6 +271,28 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {
271271});
272272});
273273274+it('skips implicit target resolution for bare delivery.mode "none"', async () => {
275+mockRunCronFallbackPassthrough();
276+resolveCronDeliveryPlanMock.mockReturnValue({
277+requested: false,
278+mode: "none",
279+});
280+281+await runCronIsolatedAgentTurn({
282+ ...makeParams(),
283+job: makeMessageToolPolicyJob({ mode: "none" }),
284+});
285+286+expect(resolveDeliveryTargetMock).not.toHaveBeenCalled();
287+expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);
288+expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]).toMatchObject({
289+disableMessageTool: false,
290+forceMessageTool: true,
291+});
292+expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.messageChannel).toBeUndefined();
293+expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.messageTo).toBeUndefined();
294+});
295+274296it('suppresses automatic exec completion notifications when delivery.mode is "none"', async () => {
275297mockRunCronFallbackPassthrough();
276298resolveCronDeliveryPlanMock.mockReturnValue({
@@ -353,7 +375,7 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {
353375});
354376});
355377356-it("resolves implicit last-target context for bare delivery.mode none", async () => {
378+it('does not resolve implicit "last" context for bare delivery.mode none', async () => {
357379mockRunCronFallbackPassthrough();
358380resolveCronDeliveryPlanMock.mockReturnValue({
359381requested: false,
@@ -373,19 +395,14 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {
373395} as never,
374396});
375397376-expect(resolveDeliveryTargetMock).toHaveBeenCalledTimes(1);
377-expect(resolveDeliveryTargetMock.mock.calls[0]?.[2]).toMatchObject({
378-channel: "last",
379-sessionKey: undefined,
380-});
398+expect(resolveDeliveryTargetMock).not.toHaveBeenCalled();
381399expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);
382400expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]).toMatchObject({
383401disableMessageTool: false,
384402forceMessageTool: true,
385-messageChannel: "messagechat",
386-messageTo: "123",
387-currentChannelId: "123",
388403});
404+expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.messageChannel).toBeUndefined();
405+expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.messageTo).toBeUndefined();
389406});
390407391408it("resolves implicit last-target context for delivery.mode none with only accountId", async () => {
@@ -690,7 +707,7 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {
690707);
691708});
692709693-it("marks no-deliver runs delivered when the message tool sends to the current target", async () => {
710+it("does not mark bare no-deliver runs delivered when the current target is unresolved", async () => {
694711mockRunCronFallbackPassthrough();
695712resolveCronDeliveryPlanMock.mockReturnValue({
696713requested: false,
@@ -707,11 +724,12 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {
707724expect(dispatchCronDeliveryMock.mock.calls[0]?.[0]).toEqual(
708725expect.objectContaining({
709726deliveryRequested: false,
710-skipMessagingToolDelivery: true,
727+skipMessagingToolDelivery: false,
728+unverifiedMessagingToolDelivery: true,
711729}),
712730);
713-expect(result.delivered).toBe(true);
714-expect(result.deliveryAttempted).toBe(true);
731+expect(result.delivered).toBe(false);
732+expect(result.deliveryAttempted).toBe(false);
715733});
716734});
717735此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。