Change record status: 
Introduced in branch: 
2.1.x, 3.0.x, 3.1.x
Introduced in version: 
3.1.7, 3.0.15, 2.1.24
Description: 

EcaExecutionSwitchAccountSubscriber used to resolve the
configured model user and the session user once per PHP process, hold them in
static properties, and reuse those values for every model execution in that
process. Both are now resolved on every execution, with a stack so that nested
executions still report the account that triggered the outermost one.

What changes in practice

Nothing on a normal web request, which executes models and then ends.

The difference appears wherever one PHP process runs many executions: cron
runs, queue workers, Drush commands and persistent worker SAPIs.

  • The session_user token was stale. It reported
    whichever account happened to be current the first time any model ran in
    that process, and kept reporting it for every later execution. It now
    reflects the account that actually triggered each execution.
  • The Execute models as setting
    (eca.settings:user) was pinned.
    Changing it took
    effect only after a fresh process or a container rebuild. It now applies
    from the next execution onward.

What you need to check

If a model uses the session_user token and runs through cron, a
queue worker or Drush, verify that it still does what you intended. The token
now returns the correct account, which may differ from the value the model was
built against while the old behavior was in place.

Models that only run on web requests, or that do not use
session_user, need no attention.

Impacts: 
Site builders, administrators, editors