Heat the butter and oil in a large, heavy-based saucepan. When the butter has melted, stir in the onions, cover, and cook slowly until translucent, about 5 minutes.
Add the salt, garlic and sugar, letting the onions catch on the bottom of the pan, stirring frequently until they are golden in colour. Sprinkle the flour and cook slowly, stirring, for another 3 to 4 minutes.
Remove from heat, allow to cool a moment, then whisk in 1 pint of the beef stock, the thyme and the bay leaf.
When well blended, bring to the simmer, adding the rest of the stock, Cognac, Madeira and white wine and simmer very slowly for 1/2 an hour, adding a little water if the liquid reduces too much. Check for seasoning.
Preheat the oven to 400°F Roll out the puff pastry and sprinkle with half the Gruyere cheese, fold into 3 and roll out again until it is half cm thick, then cut out 4-6 lids.
Divide the soup among 4-6 ovenproof soup bowls. Sprinkle the remaining cheese on top of soup and cover with the pastry lids with a little egg wash seal and bake the soup in the oven for 15 minutes or until the cheesy puff pastry is golden in colour and well risen.
Serve immediately by breaking through the pastry which then doubles up as your crouton.