Is it ethical (with a robotic body) to keep such an AI in a locked lab?
Strongly incorrect question. First, a humanoid AI, by definition, is not perfect, but perfect, gets rid of one letter "I", because it becomes just Intellect, in which there is nothing artificial. He does not differ in any way from natural Intelligence, that is, from a person.
Secondly, the very concept of Artificial Intelligence is not perfect, because people still have not figured out natural intelligence. It is useless to tinker with the artificial when it is not completely clear how the natural works.
And thirdly - Artificial, that is, not perfect, that is, similar to natural Intelligence has long been developed. Its various variants exist today in the form of neural networks of varying degrees of depth and architecture. The price of perfection of Artificial Intelligence is 86 billion neurons with 10 thousand connections each. When technologies allow achieving such a density of elements (if it is technically possible at all), then the question of similarity will disappear by itself.
Such a neural network will not differ in any way from natural intelligence, it will have to undergo the same training as a baby, grow up like a person, gain experience, learn, and as a result, where is the artificiality? This will be a full-fledged citizen of the society of the future with all rights.
As for the passport, I strongly suspect that by that time the identification of the person will get rid of any material carrier.
If you look at the history of the development of the concept of animal rights, you will see that this concept develops in parallel with the understanding of how close animals really are to us in their ability to experience suffering. That is, rights derive from empathy for the suffering of others.
It follows from this that a completely humanoid artificial intelligence, if capable of suffering, will receive the right not to suffer.