@@ -971,6 +971,61 @@ describe("setupChannels workspace shadow exclusion", () => {
971971 } ) ;
972972 } ) ;
973973
974+ it ( "keeps completed setup when the follow-up status refresh fails" , async ( ) => {
975+ const getStatus = vi
976+ . fn ( )
977+ . mockResolvedValueOnce ( {
978+ channel : "external-chat" ,
979+ configured : false ,
980+ statusLines : [ ] ,
981+ } )
982+ . mockRejectedValueOnce ( new Error ( "controlled status failure" ) ) ;
983+ const externalChatPlugin = makeSetupPlugin ( {
984+ id : "external-chat" ,
985+ label : "External Chat" ,
986+ setupWizard : {
987+ channel : "external-chat" ,
988+ getStatus,
989+ configure : vi . fn ( async ( { cfg } ) => ( {
990+ cfg : {
991+ ...cfg ,
992+ channels : { ...cfg . channels , "external-chat" : { token : "configured" } } ,
993+ } ,
994+ accountId : "external-account" ,
995+ } ) ) ,
996+ } as ChannelSetupPlugin [ "setupWizard" ] ,
997+ } ) ;
998+ resolveChannelSetupEntries . mockReturnValue ( externalChatSetupEntries ( ) ) ;
999+ listActiveChannelSetupPlugins . mockReturnValue ( [ externalChatPlugin ] ) ;
1000+ const note = vi . fn ( async ( ) => undefined ) ;
1001+
1002+ const result = await setupChannels (
1003+ { } as OpenClawConfig ,
1004+ { } as never ,
1005+ {
1006+ confirm : vi . fn ( async ( ) => true ) ,
1007+ note,
1008+ select : vi . fn ( async ( ) => "__done__" ) ,
1009+ } as never ,
1010+ {
1011+ initialSelection : [ "external-chat" ] ,
1012+ finishAfterInitialSelection : true ,
1013+ deferStatusUntilSelection : true ,
1014+ skipDmPolicyPrompt : true ,
1015+ } ,
1016+ ) ;
1017+
1018+ expect ( result ) . toMatchObject ( {
1019+ channels : { "external-chat" : { token : "configured" } } ,
1020+ } ) ;
1021+ expect ( getStatus ) . toHaveBeenCalledTimes ( 2 ) ;
1022+ expect ( note ) . toHaveBeenCalledWith (
1023+ "Status unavailable (controlled status failure).\n" +
1024+ "Retry: openclaw channels status --channel external-chat" ,
1025+ "Channel status" ,
1026+ ) ;
1027+ } ) ;
1028+
9741029 it ( "returns targeted channel setup Back navigation to the channel picker" , async ( ) => {
9751030 const promptOrder : string [ ] = [ ] ;
9761031 const configureInteractive = vi . fn ( async ( { prompter } ) => {
0 commit comments