Restart chef run after changing chef_environment

Hi - is there a good way to terminate current Chef run (within a recipe) after changing chef_environment and restart it from start, taking into account different environment-specific cookbook pinnings or attributes?

I would like to implement recipe that assigns node to specific chef environment (early in compilation phase) selected by external condition (in this case Scalr environment variable APP_ENV) and immediately restart Chef run

Code like this:

if ENV['APP_ENV'] != node['chef_envronment']
  node.normal['chef_envronment'] = ENV['APP_ENV']

won’t work as spawned client will see parent and will wait until it exits…