The TeX group an environment’s begin code leaves open for its end code, in tex.web’s group codes (§269):
none (\trivlist, \list: the bare \X opens no group at all), a semi_simple_group (\begingroup, or a
nested \begin: setspace’s spacing, lscape’s landscape, multicols, beamer’s blocks), or a box group (a
\vbox\bgroup/\hbox\bgroup/\color@hbox: a float’s \@xfloat, latex.ltx:17421-17479; \minipage, :16310).
§1063 end_group against a semi_simple_group just unsaves; against a box group it is off_save’s “Missing }
inserted” (§1064). } against a semi_simple_group is §1069 extra_right_brace (“Extra }, or forgotten
\endgroup”); against a box group §1068 packages the box, with no error there, and TeX reports the mismatch later.
A child’s located span: its own get_locator() if set, else — under
token-locators — recovered from the per-token origin handles still riding
its reverted tokens. (Origins survive revert/re-digest; get_locator merely
fails to aggregate undigested/composite content — §3.1.3.) Off the feature,
only get_locator is consulted (byte-identical behavior).