Heat the oil in a large lidded pan over a medium heat and brown the meat well all over (you may need to do this in batches). This will take 20-25 mins. Remove to a plate and set aside.
STEP 2
Fry the onions in the pan for 3-4 mins until starting to brown, then return the meat to the pan and add the bay leaves and thyme or rosemary. Pour in the stock and bring to a simmer. Cook for 1 hr 30 mins-2 hrs, checking every 30 mins until the meat is tender.
STEP 3
Tip in the potatoes and cook for 10-12 mins more until the potatoes are just cooked through. Remove 2 tbsp liquid from the pan and combine with the cornflour to make a paste, then pour this back into the mixture, stir and simmer until thickened. Remove from the heat and tip the filling into a large ovenproof dish.
STEP 4
Heat the oven to 200C/180C fan/gas 6. Roll the pastry out on a lightly floured surface into a rectangle the thickness of a 50p piece large enough to cover the dish. Lay the pastry rectangle over the dish and crimp it around the rim of the dish to seal, trimming any excess. Cut two holes in the top of the pastry to allow any steam to escape, then brush over the beaten egg. Bake for 20-30 mins until the pastry is golden. Leave to rest for a few minutes, then serve hot.