Heat 2 tablespoons of olive oil and 2 tablespoons of unsalted butter in a large Dutch oven over medium heat. Add 1360g of thinly sliced yellow onions and ½ teaspoon of sugar.
Cook, stirring often, for about 40 minutes, until deep golden and caramelized. Stir in 2 minced garlic cloves, then ½ cup of dry sherry, scraping up the browned bits.
Add 8 cups of beef stock, 1 bay leaf, 3 thyme sprigs, 1 teaspoon of salt, and ½ teaspoon of black pepper. Simmer, partially covered, for 30 minutes.
Meanwhile, preheat the oven to 400°F / 205°C. Brush 12 baguette slices, cut ½in / 1cm thick, with olive oil and bake for 6-8 minutes, until golden at the edges.
Remove the bay leaf and thyme and stir in ½ teaspoon of salt. Ladle into ovenproof bowls, top with the toasts and 225g of shredded Gruyère, and broil for 2-3 minutes, until melted and golden in spots.