Is this sentence grammatically correct in terms of the agreement of the subjects of the two parts of the sentence? [closed]

It is a strange sentence, but it could use repetition intentionally. Without more context, we will never know. However, this is what it means:

[He was] a reserved boy in his twenties, [but his] reserve could never have been attributed to lack of confidence.

So although he was reserved, it was never because he had no confidence in himself.