How does the human stomach handle a mix of digested and undigested food?
The regulation of emptying of food from the stomach to the duodenum takes place with the help of feedback mechanisms involving the duodenum and stomach.

Nature of the chyme which inhibits stomach emptying by the duodenum:


Excessive acidic chyme.
Chyme contains too much undigested or unprocessed proteins and fats due to which its tonicity and irritability changes.


Regulation by the duodenum:


Nervous regulation:
The enteric nervous system,the vagus and the prevertebral sympathetic ganglia play the key roles in nervous regulation of this feedback mechanism because when food enters the duodenum they provide stimuli that activates them which inturn inhibits pyloric pump.
Hormonal regulation:
Cholecystokinin, secretin and gastric inhibitory peptide inhibits pyloric pump,gastric motility,gastrin effect on stomach emptying respectively.


Thus,when much undigested chyme passes to the duodenum,duodenum regulates if the digestion process should be prolonged or not in the stomach.

Factors promoting emptying of stomach:

Gastric food volume and gastrin hormone promotes emptying by stimulating the enteric nervous system for emptying and enhancing pyloric pump respectively.

Thus, the distinguish between a digested or undigested chyme to be passed to the duodenum or the time for which the food must stay in the stomach for digestion is entirely under the regulation of these factors.

References:

https://www.ncbi.nlm.nih.gov/pubmed/1126597

https://www.ncbi.nlm.nih.gov/pubmed/7943335

https://en.m.wikipedia.org/wiki/Gastrin