i think it could of been an interesting situation where Codsworth is "hostile" but only after you enter into a conversation with him, to show how his parts have deteriorated at the very least over the years and how he can't even recognize his master from a regular person trespassing on private...