I have to question if Castro would ever have allowed Oswald to defect to Cuba , given the probability that the KGB suspected Oswald as just one more of several so called defectors from USA, hence a suspected CIA spy.
Surely the Kremlin would have kept their puppet Communist Castro informed of potential CIA spy and or potential assassin ?
If you read the KGB documents that Yeltsin gave to Clinton, the Nosenko testimony, and Norman Mailer's book on Oswald ("Oswald's Tale") you can see that the KGB did suspect Oswald was some sort of intelligence operative
when he first arrived. But they said (to Mailer) they suspected every American of being a threat since that's what they were trained to believe. And that's why, in part, they sent Oswald to an isolated area (Minsk in Belarussia) to monitor 24/7. They were also afraid that some sort of international incident might happen particularly since Oswald tried to kill himself (apparently) before. The very day Oswald defected Khrushchev was in Washington meeting with Ike in an attempt to normalize relations between the two rivals.
Mailer (and his associates) interviewed over two dozen Belarus KGB agents ordered to monitor Oswald. After watching him closely they dismissed him as a nobody, as not having the aptitude or makeup to be an agent. In fact several were glad to let him return to the US. For more details read Nosenko's testimony or the documents that Yeltsin gave to Clinton. Read KGB agent Oleg Nechiporenko's book "Passport to Assassination." He interviewed Oswald when Oswald went to Mexico City and visited the Soviet Embassy. After the assassination Nechiporenko said he studied the KGB file on Oswald very closely and talked to other agents to determine who Oswald really was. He said their conclusion - and his -was that Oswald was a nobody and no threat to the USSR. So they let him go, he was too much of a nuisance.
If they thought he was a CIA spy
they certainly wouldn't have let I doubt that they would have let him return to the US with whatever intelligence/information he had acquired. This was the post-Stalin era and Khrushchev was trying to open things up somewhat; but it was still a closed brutal state run by murderers (Khrushchev did Stalin's "dirty work" for him in the Ukraine).