The Shulhan Aruch (Orah Haim 639:2) writes that one recites the Beracha of "Le’sheb Ba’sukka" only when he sits down to a meal consisting of at last one Ke’besa (two ounces) of "Pat" ("bread"). A number of prominent Poskim, including the Ginat Veradim (Rav Abraham Ha’levi, 1650-1712), maintain that this includes "Pat Ha’ba’a Be’kisnin" – baked grain products other than bread, such as cake. The Ginat Veradim demonstrates from the Rambam and other sources that foods such as fruits and the like are excluded from the Beracha, but not "Pat Ha’ba’a Be’kisnin." In his view, then, if one eats a Ka’besa or more of cake, for example, he would recite the Beracha of "Le’sheb Ba’sukka."
By contrast, the Hid"a (Rav Haim Yosef David Azulai, 1724-1806), in his Mahazik Beracha, writes that when he was in Jerusalem, he saw great Sadikim eating more than a Ka’besa of "Pat Ha’ba’a Be’kisnin" in the Sukka on Sukkot, without reciting a Beracha. Later Sephardic Poskim, including Hacham Bension Abba Shaul (Israel, 1924-1998) and Hacham Ovadia Yosef, accept this testimony of the Hid"a as authoritative, and conclude that one recites the Beracha of "Le’sheb Ba’sukka" only if he eats a Ka’besa or more of bread. Everything else is eaten in the Sukka without the recitation of this Beracha.
The Sha’areh Teshuba (639:3) brings a view that makes an exception in this regard when one makes Kiddush in the Sukka on Shabbat or Yom Tob morning, and will be eating his meal later. The obligation of Kiddush requires reciting Kiddush in the context of a meal, and thus one who makes Kiddush well before his meal must eat some "Mezonot" food so that the Kiddush will be considered to have been recited in the framework of a meal. Some argued that in such a case, if one eats a Ka’besa of cake, for example, he recites the Beracha of "Le’sheb Ba’sukka," even according to the Hida. The consumption of this Ka’besa assumes special significance by virtue of the fact that it comprises a "meal" with respect to Kiddush, and as such, it warrants the recitation of the Beracha. However, Hacham Ovadia Yosef does not accept this distinction, citing sources indicating that the custom in Jerusalem was not to recite a Beracha even in such a case. Therefore, the Beracha of "Le’sheb Ba’sukka" is recited only when one eats a Ka’besa or more of bread.
It should be emphasized, however, that one who eats a Ka’besa or more of "Pat Ha’ba’a Be’kisnin" must do so in the Sukka, even though a Beracha is not recited. The reason is that different views exist regarding the definition of "Pat Ha’ba’a Be’kisnin," what characteristic disqualifies a product from the status of "bread" and relegates it to the status of "Pat Ha’ba’a Be’kisnin." One view maintains that anytime dough is mixed with a sweetening agent, the "bread" is not considered "Pat," and rather has the status of "Pat Ha’ba’a Be’kisnin." Others argue that the sweetening agents must be placed together in "pockets" in the product for it to lose its status as "Pat." Yet a third view maintains that the product must be hard and crunchy. When it comes to the Halachot of Berachot, we accept all three definitions of "Pat Ha’ba’a Be’kisnin," and so we recite "Mezonot" and "Al Ha’mihya" over a product that meets any of these three definitions. However, as the requirement of Sukka constitutes a Torah obligation, we must eat such products in the Sukka, given the uncertainty involved, unless a product has all three properties. And therefore, one who eats a Ka’besa or more of cake or cookies must do so in the Sukka. Wafers, however, satisfy all three definitions of "Pat Ha’ba’a Be’kisnin," and thus they may be eaten outside the Sukka.
Summary: The Beracha of "Le’sheb Ba’sukka" is recited only when one sits down to a meal consisting of at least two ounces of bread. If one eats this amount of "Mezonot" food, such as cake or cookies, he must do so in the Sukka, but no Beracha is recited. An exception is wafers, which does not require a Sukka.