As others have already said rights don't just follow from the capability of agents and there are various precedents for that from discrimination among human being (racism, sexism, xenophobia, ...) to speciesism and our disregard for the intelligence of animals. So it's not an automatism that rights do actually apply in legal reality despite it being a straight forward extension of moral arguments used in favor of human rights.
Also "human rights" would likely be a misnomer as that is about rights applying to humans, whereas in that case it's likely more of "android rights" or "conscious agents" rights as has been floated in the comments. Though the concept is clear.
Another thing worth considering though is that a lot of the discussion about AI rights seems to focus on negative freedoms, such as avoidance of "AI cruelty" (analogous to animal cruelty so causing unnecessary harm to animals), but another important aspect of AI rights is their positive freedom, what they are allowed to do, how they express themselves and how and if we are allowed, required or able to restrict that.
The thing is we already had the precedent of artists sending a bot on a shopping spree in the darknet prompting the question of legal culpability of AI. Now currently you could probably file that under the legal principle of "actio libera in causa", which is usually applied when you aren't culpable for the deed itself, but where you were free to choose the cause of that action and are thus this indirectly culpable. Classic example would be heavy drinking. Being blackout drunk makes a person inculpable because they are not in a state of mind where they can rationally reflect upon the wrongness of their action and ought implies can in many legal systems, yet if you deliberately put yourself in that state of mind, that itself could be considered a punishable deed.
So it's something like bringing your pet to a shop with fragile goods, the pet isn't regarded as culpable if something gets broken, you didn't break things yourself and aren't culpable, but you very much could have guessed what happened and prevented it so you're still culpable of being the cause. Or throwing a stone from the top of a mountain, not intending but risking an avalanche or something like arson, where the intent might just have been vandalism, but the effect was a major fire killing people.
So somewhere between the actio libera in cause and malice by negligence. So in that specific case it's still rather simple you brought a random buyer to a auction of partially illegal goods, so there always was the high probability of it buying illegal goods. It's just doing the illegal action with extra steps.
The thing is just so far those examples were not very intelligent or developed, rocks, pets, bots or children where the thing/being committing the deed was incapable of acting different and/or incapable of perceiving the wrongness of their action, while the actual agent was the person setting the scene and making the effect more probable without "doing it themselves".
This is a part that can very much change in the future. Regardless of consciousness of AI, we do already develop algorithms who exhibit behavior that we cannot perfectly predict. If we took the time we can trace every step of the process, but given that we literally base it off randomness we can't effectively predict the start or progress and don't want to as that's the improvement of the concept, that we don't have to do that ourselves.
Also if we have a system with continuous improvement we might enter a stage where past data is overwritten and where the current state is too complex to reliably be parsed in real time, so we might even lose the ability to consider it to be an understandable algorithm. Yet at the same time we might want to improve the complexity of those systems as useful patterns apparently only emerge after some size.
So we might approach a point where our tools don't just do things in ways that we have trouble to comprehend, but also do them for reasons that we can't really comprehend. But unlike with pets or children where we have a similar problem, we might also no longer be the smartest or at least the most powerful person in the room anymore. So regardless of whether they end up achieving consciousness, they might end up being an "entity" (a thing rather than a process) and an "agent" (a thing that does interacts with other things).
So we might want to assign them a personhood status for the sole reason of making the concept of their existence easier to grasp for us.
Which prompts the age old question of "what it actually means to be human in the first place?". Like does this concept make any sense. Is human personhood completely described by our intellect or is our understanding of the world tied to our existence, does our modes of transportation, our spectrum of perception, the awareness of pain, fear and mortality shape who we are and does that apply to a bunch of data as well which can save and load, doesn't need to fear death or destruction, can travel at the speed of light can pause and resume existence. Would our concepts of ethics and morality even apply or make sense to "them". And I mean both ways, would they see human rights as inherently valuable or akin to a roadblock for which you'd need to find a workaround. Would they see them as immutable axioms or as almost inevitably imperfect attempts to account for human nature and prevent harm and suffering. And likewise would pain, death and suffering even be meaningful concepts to them given that they might not even experience anything like that. So would human level protection of rights even do them any good?
However it's very difficult to definitively answer any of these questions without knowing what we are and what our AI is going to be like. Like regardless of their makeup and complexity they might still remain a tool and we might not care about the suffering as we might not care about a hammer breaking from wear and tear or they might end up being androids, that are human like or they might end up being paperclip maximizers that enslave us to fulfill a task that we have given them, but that is more important to them than it ever was to us...