I have also looked further for routes not imported from bgp. In this case bird1 also adds prepend, because "rs client" condition is not checked here in bgp_create_attr:
https://gitlab.labs.nic.cz/labs/bird/blob/fff79b1c1e0577f487b4fb67f79a74b054d734b6/proto/bgp/attrs.c#L1029

  if (p->is_internal)
    bgp_set_attr_wa(ea->attrs+1, pool, BA_AS_PATH, 0);

On Fri, Nov 2, 2018 at 12:43 PM, Alexander Zubkov <green@qrator.net> wrote:
Hello,

I found out that bird version 2 prepends its ASN when exporting to eBGP peer and "rs client" option enabled. I made some investigation and found out that bgp code was hardly redesigned and the logic of "rs client" was changed.
Here is v1.
https://gitlab.labs.nic.cz/labs/bird/blob/fff79b1c1e0577f487b4fb67f79a74b054d734b6/proto/bgp/attrs.c#L1100

  if (!p->is_internal && !p->rs_client)
    {
      bgp_path_prepend(e, attrs, pool, p->local_as);

And this is in v2 now.
https://gitlab.labs.nic.cz/labs/bird/blob/e19d08055a4614f03e51ee72617be10946ce7919/proto/bgp/attrs.c#L1451

  if (p->is_internal ||
      (p->rs_client && src && src->rs_client))
  {

If I get it right, it does not prepend its ASN only in the case when route was received from BGP session too and that session is marked "rs client". So only prefixes from one "rs client" to another is not prepended.

It looks like it is impossible now to skip prepend for eBGP for some local routes, for example. I wish it was made an old style way - when "rs client" skips prepend unconditionally.