Old question maybe but I just spent an hour fixing this and couldnt find an easy fix so here it is:
You can change Yii::app()->name dynamically as long as you are not using any caching component.
If you are using caching you can still set the name variable dynamically if you give the entire application a static id (the id variable of the CApplication class).
This is because the CWebUser component prefixes a stateKeyPrefix variable to the session lookup, which if not set looks for the CApplication id which if not set is a hashed version of the application name. So if you set either of these variables in your configuration file you are good to go.