It seems that now after T1758 / d9ee0b95d1020b6d5412dd011ebb1ef7f6ef3fc7 the session config is not taken from the root level but the current edit level which means that trying to commit will fail if the user is not in the top level.
The config is determined using self._run([self._cli_shell_api, '--show-working-only', '--show-show-defaults', 'showConfig']) which is edit-level dependent:
[edit interfaces ethernet eth0] vyos@vyos# /bin/cli-shell-api --show-working-only --show-show-defaults showConfig address 10.0.0.1/24 hw-id 52:54:00:3f:49:25
[edit interfaces ethernet eth0] vyos@vyos# top [edit] vyos@vyos# /bin/cli-shell-api --show-working-only --show-show-defaults showConfig | head interfaces { ethernet eth0 { address 10.0.0.1/24 hw-id 52:54:00:3f:49:25
Originally found out / debugged in T1844.