In my experience it is the airline asking based on TIMATIC.
I have never had an immigration officer ask, but had a CX agent in HK ask me when I was flying HKG to Manila. He was not going to check me in. Negotiated around this by saying I would get a ticket purchased when I am in the lounge and surely at boarding I was asked to show proof of an onwards flight.
Currently I live in Singapore, every time I check in I am asked for my residency card or an onward flight confirmation.
As we all know, once the airline asks and you cant prove, there is no point to argue.
Globalist