Preheat oven to 400°F (200°C). Line a baking sheet with parchment paper.
Heat olive oil in a skillet over medium heat. Sauté onion and garlic until soft.
Add mushrooms, thyme, rosemary, salt, and pepper. Cook 8–10 minutes until mushrooms are tender and liquid has evaporated. Remove from heat and cool slightly.
Roll puff pastry into a rectangle on a lightly floured surface. Cut diagonal slits along both long sides, leaving a 2-inch center strip.
Spoon mushroom mixture down the center. Sprinkle Gruyère evenly over the mushrooms.
Fold pastry strips over the filling in a crisscross pattern. Brush with egg wash.
Transfer to baking sheet and bake 20–25 minutes until golden and puffed.
Garnish with thyme and flaky salt. Cool 5 minutes before slicing and serving.
