@@ -46,6 +46,8 @@ vi.mock("../../gateway/mcp-http.loopback-runtime.js", async (importOriginal) =>
4646type ProcessSupervisor = ReturnType < typeof getProcessSupervisor > ;
4747type SupervisorSpawnInput = Parameters < ProcessSupervisor [ "spawn" ] > [ 0 ] ;
4848
49+ const TEST_MESSAGE_CHANNEL = "test-channel" ;
50+
4951function recordMcpLoopbackToolCallResult ( params : {
5052 captureKey : string ;
5153 toolName : string ;
@@ -1680,7 +1682,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
16801682 name : "mcp__openclaw__message" ,
16811683 input : {
16821684 action : "send" ,
1683- channel : "telegram" ,
1685+ channel : TEST_MESSAGE_CHANNEL ,
16841686 target : "chat123" ,
16851687 message : "done" ,
16861688 } ,
@@ -1702,7 +1704,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
17021704 toolName : "message" ,
17031705 args : {
17041706 action : "send" ,
1705- channel : "telegram" ,
1707+ channel : TEST_MESSAGE_CHANNEL ,
17061708 target : "chat123" ,
17071709 message : "done" ,
17081710 } ,
@@ -1732,7 +1734,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
17321734 expect ( result . messagingToolSentTargets ) . toEqual ( [
17331735 expect . objectContaining ( {
17341736 tool : "message" ,
1735- provider : "telegram" ,
1737+ provider : TEST_MESSAGE_CHANNEL ,
17361738 to : "chat123" ,
17371739 text : "done" ,
17381740 } ) ,
@@ -1752,7 +1754,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
17521754 name : "mcp__openclaw__message" ,
17531755 input : {
17541756 action : "send" ,
1755- channel : "telegram" ,
1757+ channel : TEST_MESSAGE_CHANNEL ,
17561758 target : "chat123" ,
17571759 text : "done" ,
17581760 } ,
@@ -1792,7 +1794,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
17921794 expect ( result . messagingToolSentTargets ) . toEqual ( [
17931795 expect . objectContaining ( {
17941796 tool : "message" ,
1795- provider : "telegram" ,
1797+ provider : TEST_MESSAGE_CHANNEL ,
17961798 to : "chat123" ,
17971799 text : "done" ,
17981800 } ) ,
@@ -1806,7 +1808,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
18061808 name : "mcp__openclaw__message" ,
18071809 input : {
18081810 action : "send" ,
1809- channel : "telegram" ,
1811+ channel : TEST_MESSAGE_CHANNEL ,
18101812 target : `chat${ index } ` ,
18111813 message : "done" ,
18121814 } ,
@@ -1856,7 +1858,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
18561858 name : "mcp__openclaw__message" ,
18571859 input : {
18581860 action : "send" ,
1859- channel : "telegram" ,
1861+ channel : TEST_MESSAGE_CHANNEL ,
18601862 target : `chat${ index } ` ,
18611863 message : "done" ,
18621864 } ,
@@ -1918,7 +1920,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
19181920 name : "mcp__openclaw__message" ,
19191921 input : {
19201922 action : "send" ,
1921- channel : "telegram" ,
1923+ channel : TEST_MESSAGE_CHANNEL ,
19221924 target : "chat123" ,
19231925 message : "done" ,
19241926 } ,
@@ -1965,7 +1967,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
19651967 name : "mcp__openclaw__message" ,
19661968 input : {
19671969 action : "send" ,
1968- channel : "telegram" ,
1970+ channel : TEST_MESSAGE_CHANNEL ,
19691971 target : "chat123" ,
19701972 message : "done" ,
19711973 dryRun : true ,
@@ -2011,7 +2013,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
20112013 toolName : "message" ,
20122014 args : {
20132015 action : "send" ,
2014- channel : "telegram" ,
2016+ channel : TEST_MESSAGE_CHANNEL ,
20152017 target : "chat123" ,
20162018 message : "done" ,
20172019 } ,
@@ -2073,7 +2075,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
20732075 toolName : "message" ,
20742076 args : {
20752077 action : "edit" ,
2076- channel : "telegram" ,
2078+ channel : TEST_MESSAGE_CHANNEL ,
20772079 target : "chat123" ,
20782080 message : "done" ,
20792081 } ,
@@ -2103,7 +2105,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21032105 it ( "preserves the current provider for implicit message send targets" , async ( ) => {
21042106 const context = buildPreparedCliRunContext ( { output : "text" , provider : "google-gemini-cli" } ) ;
21052107 context . mcpDeliveryCapture = true ;
2106- context . params . messageChannel = "slack" ;
2108+ context . params . messageChannel = TEST_MESSAGE_CHANNEL ;
21072109 context . params . currentChannelId = "C123" ;
21082110 context . params . currentThreadTs = "1700000000.000100" ;
21092111 supervisorSpawnMock . mockImplementationOnce ( async ( ...args : unknown [ ] ) => {
@@ -2136,7 +2138,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21362138
21372139 expect ( result . messagingToolSentTargets ) . toEqual ( [
21382140 expect . objectContaining ( {
2139- provider : "slack" ,
2141+ provider : TEST_MESSAGE_CHANNEL ,
21402142 to : "C123" ,
21412143 } ) ,
21422144 ] ) ;
@@ -2152,7 +2154,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21522154 toolName : "message" ,
21532155 args : {
21542156 action : "send" ,
2155- channel : "telegram" ,
2157+ channel : TEST_MESSAGE_CHANNEL ,
21562158 target : "chat123" ,
21572159 message : "done" ,
21582160 mediaUrl : "https://example.com/photo.png" ,
@@ -2180,7 +2182,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21802182 expect ( result . messagingToolSentTargets ) . toEqual ( [
21812183 expect . objectContaining ( {
21822184 tool : "message" ,
2183- provider : "telegram" ,
2185+ provider : TEST_MESSAGE_CHANNEL ,
21842186 to : "chat123" ,
21852187 text : "done" ,
21862188 mediaUrls : [ "https://example.com/photo.png" ] ,
@@ -2198,7 +2200,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
21982200 toolName : "message" ,
21992201 args : {
22002202 action : "send" ,
2201- channel : "telegram" ,
2203+ channel : TEST_MESSAGE_CHANNEL ,
22022204 target : "chat123" ,
22032205 message : "done" ,
22042206 } ,
@@ -2224,7 +2226,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22242226 expect ( result . messagingToolSentTargets ) . toEqual ( [
22252227 expect . objectContaining ( {
22262228 tool : "message" ,
2227- provider : "telegram" ,
2229+ provider : TEST_MESSAGE_CHANNEL ,
22282230 to : "chat123" ,
22292231 text : "done" ,
22302232 } ) ,
@@ -2241,7 +2243,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22412243 toolName : "message" ,
22422244 args : {
22432245 action : "poll" ,
2244- channel : "telegram" ,
2246+ channel : TEST_MESSAGE_CHANNEL ,
22452247 target : "chat123" ,
22462248 pollQuestion : "Lunch?" ,
22472249 pollOption : [ "Pizza" , "Sushi" ] ,
@@ -2268,7 +2270,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22682270 expect ( result . messagingToolSentTargets ) . toEqual ( [
22692271 expect . objectContaining ( {
22702272 tool : "message" ,
2271- provider : "telegram" ,
2273+ provider : TEST_MESSAGE_CHANNEL ,
22722274 to : "chat123" ,
22732275 } ) ,
22742276 ] ) ;
@@ -2279,7 +2281,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22792281 action : "reply" ,
22802282 args : {
22812283 action : "reply" ,
2282- channel : "telegram" ,
2284+ channel : TEST_MESSAGE_CHANNEL ,
22832285 target : "chat123" ,
22842286 message : "done" ,
22852287 } ,
@@ -2288,7 +2290,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
22882290 action : "sticker" ,
22892291 args : {
22902292 action : "sticker" ,
2291- channel : "telegram" ,
2293+ channel : TEST_MESSAGE_CHANNEL ,
22922294 target : "chat123" ,
22932295 stickerId : "sticker-1" ,
22942296 } ,
@@ -2326,7 +2328,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
23262328 expect ( result . messagingToolSentTargets ) . toEqual ( [
23272329 expect . objectContaining ( {
23282330 tool : "message" ,
2329- provider : "telegram" ,
2331+ provider : TEST_MESSAGE_CHANNEL ,
23302332 to : "chat123" ,
23312333 } ) ,
23322334 ] ) ;
@@ -2342,7 +2344,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
23422344 toolName : "message" ,
23432345 args : {
23442346 action : "thread-create" ,
2345- channel : "telegram" ,
2347+ channel : TEST_MESSAGE_CHANNEL ,
23462348 target : "chat123" ,
23472349 message : "new thread" ,
23482350 } ,
@@ -2368,7 +2370,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
23682370 expect ( result . messagingToolSentTargets ) . toEqual ( [
23692371 expect . objectContaining ( {
23702372 tool : "message" ,
2371- provider : "telegram" ,
2373+ provider : TEST_MESSAGE_CHANNEL ,
23722374 to : "chat123" ,
23732375 } ) ,
23742376 ] ) ;
@@ -2377,7 +2379,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
23772379 it ( "records current-target evidence for confirmed implicit reply delivery" , async ( ) => {
23782380 const context = buildPreparedCliRunContext ( { output : "text" , provider : "google-gemini-cli" } ) ;
23792381 context . mcpDeliveryCapture = true ;
2380- context . params . messageChannel = "telegram" ;
2382+ context . params . messageChannel = TEST_MESSAGE_CHANNEL ;
23812383 context . params . currentChannelId = "chat123" ;
23822384 supervisorSpawnMock . mockImplementationOnce ( async ( ...spawnArgs : unknown [ ] ) => {
23832385 const input = spawnArgs [ 0 ] as SupervisorSpawnInput ;
@@ -2410,7 +2412,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
24102412 expect ( result . messagingToolSentTargets ) . toEqual ( [
24112413 expect . objectContaining ( {
24122414 tool : "message" ,
2413- provider : "telegram" ,
2415+ provider : TEST_MESSAGE_CHANNEL ,
24142416 to : "chat123" ,
24152417 } ) ,
24162418 ] ) ;
@@ -2508,7 +2510,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
25082510 toolName : "message" ,
25092511 args : {
25102512 action : "send" ,
2511- channel : "telegram" ,
2513+ channel : TEST_MESSAGE_CHANNEL ,
25122514 target : "chat123" ,
25132515 message : "x" . repeat ( 20 * 1024 ) ,
25142516 } ,
@@ -2532,7 +2534,11 @@ describe("executePreparedCliRun supervisor output capture", () => {
25322534
25332535 expect ( result . didSendViaMessagingTool ) . toBe ( true ) ;
25342536 expect ( result . messagingToolSentTargets ) . toEqual ( [
2535- expect . objectContaining ( { tool : "message" , provider : "telegram" , to : "chat123" } ) ,
2537+ expect . objectContaining ( {
2538+ tool : "message" ,
2539+ provider : TEST_MESSAGE_CHANNEL ,
2540+ to : "chat123" ,
2541+ } ) ,
25362542 ] ) ;
25372543 } ) ;
25382544
@@ -2583,7 +2589,7 @@ describe("executePreparedCliRun supervisor output capture", () => {
25832589 toolName : "message" ,
25842590 args : {
25852591 action : "send" ,
2586- channel : "telegram" ,
2592+ channel : TEST_MESSAGE_CHANNEL ,
25872593 target : "chat123" ,
25882594 message : "done" ,
25892595 } ,
0 commit comments