




















@@ -16,8 +16,8 @@ vi.mock("../infra/outbound/message.js", () => ({
1616import fs from "node:fs";
1717import os from "node:os";
1818import path from "node:path";
19-import { writeSessionStoreForTest } from "../config/sessions/test-helpers.js";
2019import { clearSessionStoreCacheForTest } from "../config/sessions/store.js";
20+import { writeSessionStoreForTest } from "../config/sessions/test-helpers.js";
2121import { sendMessage } from "../infra/outbound/message.js";
2222import {
2323buildExecApprovalFollowupPrompt,
@@ -298,6 +298,30 @@ describe("exec approval followup", () => {
298298expect(sendMessage).not.toHaveBeenCalled();
299299});
300300301+it("preserves the originating routing target for non-built-in plugin channels", async () => {
302+await sendExecApprovalFollowup({
303+approvalId: "req-plugin",
304+sessionKey: "agent:main:lansenger:dm:U1",
305+turnSourceChannel: "lansenger",
306+turnSourceTo: "dm:U1",
307+turnSourceAccountId: "acct-1",
308+turnSourceThreadId: 42,
309+resultText: "Exec finished (gateway id=req-plugin, code 0)\nhello",
310+});
311+312+const agentArgs = expectGatewayAgentFollowup({
313+sessionKey: "agent:main:lansenger:dm:U1",
314+deliver: false,
315+channel: "lansenger",
316+to: "dm:U1",
317+accountId: "acct-1",
318+threadId: "42",
319+idempotencyKey: "exec-approval-followup:req-plugin",
320+});
321+expect(agentArgs.message).toContain("already approved has completed");
322+expect(sendMessage).not.toHaveBeenCalled();
323+});
324+301325it("waits for accepted agent followups without direct fallback", async () => {
302326vi.mocked(callGatewayTool)
303327.mockResolvedValueOnce({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。