  We develop a robust and self-consistent framework to extract and classify
gravitational wave candidates from noisy data, for the purpose of assisting in
real-time multi-messenger follow-ups during LIGO-Virgo-KAGRA's fourth observing
run~(O4). Our formalism implements several improvements to the low latency
calculation of the probability of astrophysical origin~(\PASTRO{}), so as to
correctly account for various factors such as the sensitivity change between
observing runs, and the deviation of the recovered template waveform from the
true gravitational wave signal that can strongly bias said calculation. We
demonstrate the high accuracy with which our new formalism recovers and
classifies gravitational wave triggers, by analyzing replay data from previous
observing runs injected with simulated sources of different categories. We show
that these improvements enable the correct identification of the majority of
simulated sources, many of which would have otherwise been misclassified. We
carry out the aforementioned analysis by implementing our formalism through the
\GSTLAL{} search pipeline even though it can be used in conjunction with
potentially any matched filtering pipeline. Armed with robust and
self-consistent \PASTRO{} values, the \GSTLAL{} pipeline can be expected to
provide accurate source classification information for assisting in
multi-messenger follow-up observations to gravitational wave alerts sent out
during O4.
