Backport Redmine#5940: fix services_autorun for all agents

Include acceptance test.

Cherry picked from commits
- b672438c93711c904c0b38c751e4f9fbdf4449b8
- d70777771fb4434faeea042effc60d2e9a543ea6
- a0b0c255c5216fb943051c0fb39831cafc4e8d9d
- 049450fdf63f8bf3b1745fe877f66710580f667d

Conflicts:
	promises.cf
Merge pull request #274 from vohi/redmine/5940-backport

Backport Redmine#5940: fix services_autorun for all agents