Special equipment: A 9-by-13-inch baking pan
For the bread pudding: In a bowl whisk together the heavy cream, salt and eggs. Place the bagels in a 9-by-13-inch baking pan. Pour the cream mixture over the top and set aside to soak for 2 hours.
Preheat the oven to 375 degrees F. Cover the baking pan with foil and bake for 30 minutes. Remove the foil from the pan and continue cooking for 15 minutes. Cool the bread pudding completely.
Preheat the oven to 450 degrees F. Separate the bagel pieces and place on a baking sheet. Toast until the edges turn golden brown, 5 minutes.
For the onions: In a 14-inch skillet or a medium high-sided saute pan, heat the oil over high heat and pour in the sliced onions. Do NOT stir the onions or shake the pan. When the pan gets hot again and the onions begin to sizzle, add the salt and stir. The onions at the bottom of the pan should be brown. Reduce the heat to medium and continue stirring. The onions will begin to soften and release their juices (the natural sugars in the juices will caramelize the onions). Cook for 15 minutes, and then reduce the heat to low. Continue cooking, stirring the onions periodically to make sure they don't stick to the pan, until completely soft and a rich dark brown color, 30 minutes.
For the soup: In a large saucepot set over medium heat, melt the butter until it starts to bubble. Add in the caramelized onions, then add the sherry and cook at a low simmer until the alcohol cooks out, 5 minutes. Add the bay leaf and stock, and cook for 30 minutes. Season with salt as the soup cooks. Portion the soup into serving bowls and top with some toasted bagel bread pudding croutons. Garnish each serving with 2 tablespoons gruyere if using, and serve.