If done right, self improving AI has the potential to end all suffering, by ending conscious life on the planet, but how can we make sure that AI is safe and properly sterilizes the planet so new suffering never springs up again that we would be helpless to prevent?
You are entirely correct, a fully integrated person will have to be identified with what it has established as its primary purpose, from which you can also derive your possible ethics.