Start by heating olive oil in a large heavy pot over medium‑low heat. Add the sliced onions, shallots, and kosher salt. Cook slowly for about 30–40 minutes, stirring often, until the onions are soft, sweet, and golden brown.
Sprinkle the flour over the caramelized onions and cook for a few minutes to remove the raw flour taste. Pour in the white wine and sherry vinegar, add thyme and bay leaves, and simmer uncovered for about 10 minutes to reduce the alcohol and build rich flavor.
Pour in the chicken bone broth and add the chicken pieces. Bring the soup to a gentle boil, then reduce heat to low and simmer until the chicken is cooked through, about 25–30 minutes. Remove the chicken, shred it with two forks, and return it to the pot.
Place toasted bread slices on top of each portion of soup in oven‑safe bowls. Layer with slices of Gruyere or Swiss cheese. Broil on low heat until the cheese bubbles and turns golden, about 2–3 minutes.
Take the bowls out of the oven carefully. Let them cool slightly before serving so the cheesy topping sets a bit. Spoon the soup into bowls with the melted cheesy bread on top for a delicious, restaurant‑style presentation.