Actually, we broke it here:
https://github.com/web2py/web2py/commit/b4acfd0724845633f667a55e593a15576379554d.
Previously, response._view_environment was created at the end of build_environment, and then again very shortly thereafter in serve_controller (right after executing the models). We thought we could get rid of the line in build_environment, but it turns out that creates a problem for the scheduler (and presumably the shell), as the application code is executed via shell.env rather than serve_controller in those cases.
I'll open an issue and propose a fix.
Anthony