To accurately predict when a workflow will apply changes to an issue, you need to know a little bit about database transactions in YouTrack. Any request to the server that applies a change to an issue processed in a single database transaction. For example, when a user sets the value for a custom field through the user interface.
Commands support more complex interactions with the database. You can, for example, use a command to update multiple fields and add a comment to an issue. You can also apply multiple changes to issues with the YouTrack REST API. In either case, these changes are considered to be atomic, as they are processed in a single transaction.
All changes that belong to the same transaction are either committed to the database (resulting in an update) or rejected (producing an error). Before the changes in the transaction are committed to the database, YouTrack performs a check against the guard conditions in workflow rules. YouTrack only checks workflows that are attached to the project that the updated issue belongs to. If any guard condition is satisfied by the changes in the transaction, the workflow rule is triggered. The changes that are applied by the workflow are then added to the current transaction. YouTrack then performs another check to see if any guard conditions are satisfied by changes that were applied by the workflows. This process continues until none of the guard conditions in the project are satisfied. The complete set of changes that are stored in the current transaction are then committed to the database.
This means that updates applied by workflows in reaction to a change that is applied through the user interface all belong to the same transaction.
It's especially important to understand how database transactions interact with workflows when you move an issue to another project. When the transaction includes a change to the value for the project field, YouTrack only checks for guard conditions in workflows that are attached to the target project. Workflows that are attached to the project that the issue previously belonged to are ignored.