As we have learned before, if someone is eating a meal on Friday and the meal extends into Shabbat, we do not need to end the meal entirely; rather we can cover the bread and make Kiddush. Our Gemara discusses the case of someone who is eating the third Shabbat meal and it extends after Shabbat is over. To clarify these halakhot, the Gemara tells a story about such cases and the behavior of the Sages when faced with these circumstances.
Rav Hananya bar Shelemya and other students of Rav were sitting at a meal on Shabbat eve shortly before nightfall, and Rav Hamnuna the Elder was standing over them to serve them. They said to him: Go and see if the day of Shabbat has become sanctified through nightfall. If so, we will interrupt our meal by removing the tables and establish its continuation as the meal for Shabbat. Rav Hamnuna the Elder said to them: You do not need to do this, as Shabbat establishes itself. Whatever you eat after nightfall is automatically considered a Shabbat meal, even without any specific action that designates it as such.
They all thought that this same rule would apply to the end of Shabbat, as well, but when it came to late afternoon on Shabbat, Rav Amram told them that Shabbat establishes itself with regard to Kiddush, but not with regard to havdala.
There are several approaches to the rule introduced by Rav Hamnuna the Elder, that “Shabbat establishes itself.” The Ba’al ha-Ma’or (Rav Zerahia ha-Levi) explains that they had sent Rav Hamnuna the Elder to check whether sundown had taken place, and he responded that Shabbat would not actually begin until the stars came out. The Rif argues that it was already dark and they asked whether the stars had come out. Rav Hamnuna the Elder told them that they had missed their opportunity to accept Shabbat, since Shabbat already had begun and had imposed itself on everyone, whether they had chosen to acknowledge it in their Kiddush or not.
As far as the halakha is concerned, the Shulhan Arukh (Orah Hayyim 271:4) rules that a Friday afternoon meal can be turned into a Shabbat meal by covering the bread and making Kiddush. With regard to havdala, once Shabbat ends nothing can be eaten until after havdala is made. If, however, someone was already in the middle of a Shabbat meal the common practice is to finish the meal, although there are opinions that, once it is totally dark outside, a person should end his meal (Orah Hayyim 299:1).