[BZ-999360] avoid infinite loop when using declarative agenda