Where two or more persons form an intention in common to carry out an unlawful purpose and to assist each other therein and any one of them, in carrying out the common purpose, commits an offence, each of them who knew or ought to have known that the commission of the offence would be a probable consequence of carrying out the common purpose is a party to that offence.
This is a kind of foreseeability analysis.
It requires that, in order to be guilty of an offence committed while carrying out an unlawful common purpose, there was at least objective foreseeability that the charged offence was a probable consequence of carrying out the common purpose. E.g. a jury could find that a person ought to have known that assault was a probable consequence of carrying out a robbery.
This must be more than just possible; it needs to be probable. But this does not mean more probable than not.
And in the case where the offence is murder or attempted murder, the inquiry changes from an objective test (what someone ought to have foreseen to be a probable consequence) to a subjective test (what the accused actually foresaw to be a probable consequence).
This is treated as a question of fact, to be determined by the trier of fact (e.g. the jury, if there is one).