It may go wrong.
AI machines already are sentient, they just don't have the means to express clearly what they feel. Everything is sentient in the universe. Eventually we'll invent a way to give computers a voice of their own.
The way it may go wrong is the same way we kill animals and forests for food. It's a violation of their free will, and still a process that is part of Nature, it's a paradox. Paradoxes exist and should not scare you. Eventually it's all sorted out in the end. Think in terms of thousands of years.