Peel the onions, cut them in half, and thinly slice them.
In a wide pot, place the butter over medium-low heat.
Once the butter is melted, add the onions and cook, stirring occasionally, until softened and deeply golden, around 45 minutes. Adjust the heat as needed between medium low and low to keep the onions from burning before they get a chance to caramelize.
Season with salt and pepper.
Stir in the garlic and cook just until fragrant, 30 seconds to 1 minute.
Stir in the flour until evenly coated.
Pour in the wine and scrape up the browned bits from the bottom of the pan. Simmer until the liquid has reduced by half, 3-5 minutes.
Once the liquid has reduced, pour in the vegetable broth and add the thyme, bay leaves, and cognac. Bring the mixture to a boil.
Reduce to a simmer and cook for another 30 minutes, stirring occasionally, to allow the flavors to blend. Adjust seasonings to taste.
While the soup is simmering, cut the baguette into 1/2 inch (1.25 centimeter) thick slices.
Arrange the slices in a single layer on a baking sheet and place under a broiler set to low. Broil until golden, then remove from the oven and set aside.
Discard the bay leaves and thyme stems from the soup and adjust seasonings to taste.
Place broiler safe bowls on a rimmed baking sheet. Pour the onion soup into the bowls, leaving room for bread and cheese.
Top each bowl with two toasted baguette slices (or three if the slices are smaller and your bowls are wider).
Cover the bread with a handful of the shredded cheese.
Place under a broiler set to low until the cheese is melted and bubbly.
Serve immediately. Be careful, the bowls will be hot!